package devopsdistilled.operp.server.data.entity.account;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import devopsdistilled.operp.server.data.entity.Entiti;

@MappedSuperclass
public abstract class Account extends Entiti<Long> {

	private static final long serialVersionUID = -8130237994739975187L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long accountId;

	private Double balance;

	public Long getAccountId() {
		return accountId;
	}

	public void setAccountId(Long accountId) {
		this.accountId = accountId;
	}

	public Double getBalance() {
		return balance;
	}

	public void setBalance(Double balance) {
		this.balance = balance;
	}

	@Override
	public Long id() {
		return getAccountId();
	}

	@Override
	public String toString() {
		return new String(getAccountId() + ": " + getBalance().toString());
	}
}

package devopsdistilled.operp.server.data.entity.account;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import devopsdistilled.operp.server.data.entity.Entiti;

@MappedSuperclass
public abstract class Account extends Entiti<Long> {

	private static final long serialVersionUID = -8130237994739975187L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long accountId;

	private Double balance = 0.0;

	public Long getAccountId() {
		return accountId;
	}

	public void setAccountId(Long accountId) {
		this.accountId = accountId;
	}

	public Double getBalance() {
		return balance;
	}

	public void setBalance(Double balance) {
		this.balance = balance;
	}

	@Override
	public Long id() {
		return getAccountId();
	}

	@Override
	public String toString() {
		return new String(getAccountId() + ": " + getBalance().toString());
	}
}

Set default balance to be 0.0


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

package com.google.gcs.sdrs.dao;

import java.io.Serializable;

/**
 * Interface for Data Access Object pattern
 *
 * @author salguerod
 *
 * @param <T>
 * @param <Id>
 */
public interface Dao<T, Id extends Serializable> {

  Id save(T entity);

  void update(T object);

  T findById(Id id);

  void delete(T object);

}

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

package com.google.gcs.sdrs.dao;

import java.io.Serializable;

/**
 * Interface for Data Access Object pattern
 *
 * @author salguerod
 *
 * @param <T>
 * @param <Id>
 */
public interface Dao<T, Id extends Serializable> {

  Id save(T entity);

  void update(T entity);

  T findById(Id id);

  void delete(T entity);

}

Rename object to entity in interface.


package net.sourceforge.javydreamercsw.client.ui.nodes.actions;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;

/**
 *
 * @author Javier A. Ortiz Bultron <javier.ortiz.78@gmail.com>
 */
public class CreateTestAction extends AbstractAction {

    public CreateTestAction() {
        super("Create Test",
                new ImageIcon("com/validation/manager/resources/icons/Signage/Add Square.png"));
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                final CreateTestDialog dialog =
                        new CreateTestDialog(new javax.swing.JFrame(), true);
                dialog.setLocationRelativeTo(null);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        dialog.dispose();
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
}

package net.sourceforge.javydreamercsw.client.ui.nodes.actions;

import com.validation.manager.core.db.TestPlan;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import org.openide.util.Utilities;

/**
 *
 * @author Javier A. Ortiz Bultron <javier.ortiz.78@gmail.com>
 */
public class CreateTestAction extends AbstractAction {

    public CreateTestAction() {
        super("Create Test",
                new ImageIcon("com/validation/manager/resources/icons/Signage/Add Square.png"));
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                final CreateTestDialog dialog =
                        new CreateTestDialog(new javax.swing.JFrame(), true);
                dialog.setTestPlan(Utilities.actionsGlobalContext().lookup(TestPlan.class));
                dialog.setLocationRelativeTo(null);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        dialog.dispose();
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
}

Fix NPE while creating tests.


package com.alexstyl.specialdates.events.namedays;

import android.support.annotation.RawRes;

import com.alexstyl.specialdates.R;
import com.novoda.notils.exception.DeveloperError;

public enum NamedayLocale {
    GREEK("gr", true, R.raw.gr_namedays),
    ROMANIAN("ro", false, R.raw.ro_namedays),
    RUSSIAN("ru", false, R.raw.ru_namedays),
    LATVIAN("lv", false, R.raw.lv_namedays),
    SLOVAK("sk", false, R.raw.sk_namedays),
    CZECH("cs", false, R.raw.cs_namedays);

    private final String shortCode;
    private final boolean soundCompared;
    private final int rawResId;

    NamedayLocale(String shortCode, boolean soundCompared, @RawRes int rawResId) {
        this.shortCode = shortCode;
        this.soundCompared = soundCompared;
        this.rawResId = rawResId;
    }

    public static NamedayLocale from(String displayLanguage) {
        for (NamedayLocale locale : values()) {
            if (locale.name().equalsIgnoreCase(displayLanguage)) {
                return locale;
            }
        }
        throw new DeveloperError("No NamedayLocale found for [%s]", displayLanguage);
    }

    public int getRawResId() {
        return rawResId;
    }

    public boolean isComparedBySound() {
        return soundCompared;
    }

    public String getShortCode() {
        return shortCode;
    }
}

package com.alexstyl.specialdates.events.namedays;

import android.support.annotation.RawRes;

import com.alexstyl.specialdates.R;
import com.novoda.notils.exception.DeveloperError;

public enum NamedayLocale {
    GREEK("gr", true, R.raw.gr_namedays),
    ROMANIAN("ro", false, R.raw.ro_namedays),
    RUSSIAN("ru", false, R.raw.ru_namedays),
    LATVIAN("lv", false, R.raw.lv_namedays),
    SLOVAK("sk", false, R.raw.sk_namedays),
    CZECH("cs", false, R.raw.cs_namedays);

    private final String shortCode;
    private final boolean soundCompared;
    private final int rawResId;

    NamedayLocale(String shortCode, boolean soundCompared, @RawRes int rawResId) {
        this.shortCode = shortCode;
        this.soundCompared = soundCompared;
        this.rawResId = rawResId;
    }

    public static NamedayLocale from(String displayLanguage) {
        for (NamedayLocale locale : values()) {
            if (locale.getShortCode().equalsIgnoreCase(displayLanguage)) {
                return locale;
            }
        }
        throw new DeveloperError("No NamedayLocale found for [%s]", displayLanguage);
    }

    public int getRawResId() {
        return rawResId;
    }

    public boolean isComparedBySound() {
        return soundCompared;
    }

    public String getShortCode() {
        return shortCode;
    }
}

Use getShortCode() instead of enum name()


package com.uwetrottmann.trakt.v2.entities;

public class Username {

    /**
     * Special user name for the current user (determined by auth data).
     */
    public static final Username ME = new Username("me");

    private String encodedUsername;

    /**
     * Encodes the username returned from trakt so it is API compatible (currently replaces "." with "-").
     *
     * @param username A username as returned by the trakt API.
     * @see #ME
     */
    public Username(String username) {
        if (username == null || username.length() == 0) {
            throw new IllegalArgumentException("trakt username can not be empty.");
        }
        this.encodedUsername = username.replace(".", "-");
    }

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

package com.uwetrottmann.trakt.v2.entities;

public class Username {

    /**
     * Special user name for the current user (determined by auth data).
     */
    public static final Username ME = new Username("me");

    private String encodedUsername;

    /**
     * Encodes the username returned from trakt so it is API compatible (currently replaces "." with "-").
     *
     * @param username A username as returned by the trakt API.
     * @see #ME
     */
    public Username(String username) {
        if (username == null || username.length() == 0) {
            throw new IllegalArgumentException("trakt username can not be empty.");
        }
        // trakt encodes some special chars in usernames
        // - points "." as a dash "-"
        // - spaces " " as a dash "-"
        // - multiple dashes are reduced to one
        this.encodedUsername = username.replace(".", "-").replace(" ", "-").replaceAll("(-)+", "-");
    }

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

Remove spaces in user names.


package totemic_commons.pokefenn.entity;

import cpw.mods.fml.common.registry.EntityRegistry;
import totemic_commons.pokefenn.Totemic;
import totemic_commons.pokefenn.entity.animal.EntityBuffalo;
import totemic_commons.pokefenn.lib.Strings;

/**
 * Created by Pokefenn.
 * Licensed under MIT (If this is one of my Mods)
 */
public final class ModEntities
{
    public static void init()
    {
        EntityRegistry.registerGlobalEntityID(EntityBuffalo.class, Strings.BUFFALO_NAME, EntityRegistry.findGlobalUniqueEntityId(), 0x001330, 0x323122);
        EntityRegistry.registerModEntity(EntityBuffalo.class, Strings.BUFFALO_NAME, 0, Totemic.instance, 80, 5, true);
        //EntityRegistry.addSpawn(EntityBuffalo.class, 1000, 2, 4, EnumCreatureType.creature); //No biomes to spawn in
    }
}

package totemic_commons.pokefenn.entity;

import cpw.mods.fml.common.registry.EntityRegistry;
import totemic_commons.pokefenn.Totemic;
import totemic_commons.pokefenn.entity.animal.EntityBuffalo;
import totemic_commons.pokefenn.lib.Strings;

/**
 * Created by Pokefenn.
 * Licensed under MIT (If this is one of my Mods)
 */
public final class ModEntities
{
    public static void init()
    {
        EntityRegistry.registerGlobalEntityID(EntityBuffalo.class, Strings.BUFFALO_NAME, EntityRegistry.findGlobalUniqueEntityId(), 0x2a1c12, 0x885f3e);
        EntityRegistry.registerModEntity(EntityBuffalo.class, Strings.BUFFALO_NAME, 0, Totemic.instance, 80, 5, true);
        //EntityRegistry.addSpawn(EntityBuffalo.class, 1000, 2, 4, EnumCreatureType.creature); //No biomes to spawn in
    }
}

Change Buffalo spawn egg colors


package com.hubspot.singularity.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.google.common.base.Optional;
import com.google.inject.Inject;
import com.hubspot.singularity.SingularityService;
import com.hubspot.singularity.SingularityUser;
import com.hubspot.singularity.SingularityUserSettings;
import com.hubspot.singularity.data.UserManager;

@Path(UserResource.PATH)
@Produces({ MediaType.APPLICATION_JSON })
public class UserResource {
  public static final String PATH = SingularityService.API_BASE_PATH + "/user";

  private final UserManager userManager;

  @Inject
  public UserResource(UserManager userManager) {
    this.userManager = userManager;
  }

  @GET
  @Path("/settings")
  public Optional<SingularityUserSettings> getUserSettings() {
    if (user.isPresent()) {
      return userManager.getUserSettings(user.get().getId());
    }
    return Optional.absent();
  }
}

package com.hubspot.singularity.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.google.common.base.Optional;
import com.google.inject.Inject;
import com.hubspot.singularity.SingularityService;
import com.hubspot.singularity.SingularityUserSettings;
import com.hubspot.singularity.data.UserManager;
import com.wordnik.swagger.annotations.ApiParam;

@Path(UserResource.PATH)
@Produces({ MediaType.APPLICATION_JSON })
public class UserResource {
  public static final String PATH = SingularityService.API_BASE_PATH + "/user";

  private final UserManager userManager;

  @Inject
  public UserResource(UserManager userManager) {
    this.userManager = userManager;
  }

  @GET
  @Path("/settings")
  public Optional<SingularityUserSettings> getUserSettings(
      @ApiParam("The user id to use") @PathParam("id") String id) {
    return userManager.getUserSettings(id);
  }
}

Add user id param to getUserSettings


package com.intellij.debugger.streams.ui;

import com.intellij.debugger.DebuggerContext;
import com.intellij.debugger.engine.ContextUtil;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.memory.utils.InstanceValueDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiElementFactory;
import com.intellij.psi.PsiExpression;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.Value;

/**
 * @author Vitaliy.Bibaev
 */
public class PrimitiveValueDescriptor extends InstanceValueDescriptor {
  PrimitiveValueDescriptor(Project project, Value value) {
    super(project, value);
  }

  @Override
  public String calcValueName() {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.calcValueName();
    }

    return value.toString();
  }

  @Override
  public PsiExpression getDescriptorEvaluation(DebuggerContext debuggerContext) throws EvaluateException {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.getDescriptorEvaluation(debuggerContext);
    }

    final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myProject).getElementFactory();
    return elementFactory.createExpressionFromText("", ContextUtil.getContextElement(debuggerContext));
  }
}

package com.intellij.debugger.streams.ui;

import com.intellij.debugger.DebuggerContext;
import com.intellij.debugger.engine.ContextUtil;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.memory.utils.InstanceValueDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiElementFactory;
import com.intellij.psi.PsiExpression;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.Value;
import org.jetbrains.annotations.NotNull;

/**
 * @author Vitaliy.Bibaev
 */
public class PrimitiveValueDescriptor extends InstanceValueDescriptor {
  PrimitiveValueDescriptor(@NotNull Project project, @NotNull Value value) {
    super(project, value);
  }

  @Override
  public String calcValueName() {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.calcValueName();
    }

    return value.type().name();
  }

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

  @Override
  public PsiExpression getDescriptorEvaluation(DebuggerContext debuggerContext) throws EvaluateException {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.getDescriptorEvaluation(debuggerContext);
    }

    final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myProject).getElementFactory();
    return elementFactory.createExpressionFromText("", ContextUtil.getContextElement(debuggerContext));
  }
}

Change presentation for primitive values in collection view


package com.mooo.aimmac23.node;

import java.io.File;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class VideoRecordController {

	private ThreadPoolExecutor executor;
	RecordVideoCallable currentCallable;
	private Future<File> currentFuture;

	public VideoRecordController() {
		executor = new ThreadPoolExecutor(1, 1, 1, TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(5));
		executor.setThreadFactory(new RecorderThreadFactory());
		executor.prestartAllCoreThreads();
	}

	public void startRecording() {
		if(currentCallable != null) {
			throw new IllegalStateException("Video recording currently in progress, cannot record again");
		}
		currentCallable = new RecordVideoCallable();
		currentFuture = executor.submit(currentCallable);
	}

	public File stopRecording() throws Exception {
		if(currentCallable == null) {
			throw new IllegalStateException("Video recording not currently in progress, cannot stop!");
		}
		currentCallable.stopRecording();
		currentCallable = null;
		return currentFuture.get();
	}
	class RecorderThreadFactory implements ThreadFactory {

		@Override
		public Thread newThread(Runnable r) {
			Thread thread = new Thread(r);
			thread.setDaemon(true);
			thread.setName("VideoRecordingThread");
			return thread;
		}
	}
}

package com.mooo.aimmac23.node;

import java.io.File;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class VideoRecordController {

	private ThreadPoolExecutor executor;
	RecordVideoCallable currentCallable;
	private Future<File> currentFuture;

	public VideoRecordController() {
		executor = new ThreadPoolExecutor(1, 1, 1, TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(5));
		executor.setThreadFactory(new RecorderThreadFactory());
		executor.prestartAllCoreThreads();
	}

	public void startRecording() {
		if(currentCallable != null) {
			throw new IllegalStateException("Video recording currently in progress, cannot record again");
		}
		currentCallable = new RecordVideoCallable();
		currentFuture = executor.submit(currentCallable);
	}

	public File stopRecording() throws Exception {
		if(currentCallable == null) {
			throw new IllegalStateException("Video recording not currently in progress, cannot stop!");
		}

		// sleep for one second, to make sure we catch the end of the test
		Thread.sleep(1000);

		currentCallable.stopRecording();
		currentCallable = null;
		return currentFuture.get();
	}
	class RecorderThreadFactory implements ThreadFactory {

		@Override
		public Thread newThread(Runnable r) {
			Thread thread = new Thread(r);
			thread.setDaemon(true);
			thread.setName("VideoRecordingThread");
			return thread;
		}
	}
}

Add a 1 second sleep before we stop recording, so we can hopefully see the browser closing


package info.tehnut.xtones.network;

import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import org.checkerframework.checker.nullness.qual.Nullable;
import info.tehnut.xtones.client.XtonesClient;

final class ConfigSyncHandler implements IMessageHandler<ConfigSyncMessage, IMessage> {
    static final ConfigSyncHandler INSTANCE = new ConfigSyncHandler();

    private ConfigSyncHandler() {
    }

    private static void readConfig(final ConfigSyncMessage config) {
        XtonesClient.setServerXtoneCycling(config.hasXtoneCycling());
    }

    @Override
    @Nullable
    public IMessage onMessage(final ConfigSyncMessage config, final MessageContext context) {
        FMLCommonHandler.instance().getMinecraftServerInstance().addScheduledTask(() -> readConfig(config));
        return null;
    }
}

package info.tehnut.xtones.network;

import info.tehnut.xtones.client.XtonesClient;
import net.minecraft.client.Minecraft;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import org.checkerframework.checker.nullness.qual.Nullable;

final class ConfigSyncHandler implements IMessageHandler<ConfigSyncMessage, IMessage> {
    static final ConfigSyncHandler INSTANCE = new ConfigSyncHandler();

    private ConfigSyncHandler() {
    }

    private static void readConfig(final ConfigSyncMessage config) {
        XtonesClient.setServerXtoneCycling(config.hasXtoneCycling());
    }

    @Override
    @Nullable
    public IMessage onMessage(final ConfigSyncMessage config, final MessageContext context) {
        Minecraft.getMinecraft().addScheduledTask(() -> readConfig(config));
        return null;
    }
}

Fix config sync handling not using client task scheduler


package protocolsupport.protocol.packet.middle.clientbound.play;

import io.netty.buffer.ByteBuf;
import protocolsupport.api.ProtocolType;
import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.middle.ClientBoundMiddlePacket;
import protocolsupport.protocol.serializer.StringSerializer;
import protocolsupport.protocol.serializer.VarNumberSerializer;

public abstract class MiddleWorldSound extends ClientBoundMiddlePacket {

	protected int id;
	protected int category;
	protected String parrotedEntityType;
	protected int x;
	protected int y;
	protected int z;
	protected float volume;
	protected float pitch;

	@Override
	public void readFromServerData(ByteBuf serverdata) {
		category = VarNumberSerializer.readVarInt(serverdata);
		id = VarNumberSerializer.readVarInt(serverdata);
		parrotedEntityType = StringSerializer.readString(serverdata, ProtocolVersion.getLatest(ProtocolType.PC));
		x = serverdata.readInt();
		y = serverdata.readInt();
		z = serverdata.readInt();
		volume = serverdata.readFloat();
		pitch = serverdata.readFloat();
	}

}

package protocolsupport.protocol.packet.middle.clientbound.play;

import io.netty.buffer.ByteBuf;
import protocolsupport.protocol.packet.middle.ClientBoundMiddlePacket;
import protocolsupport.protocol.serializer.VarNumberSerializer;

public abstract class MiddleWorldSound extends ClientBoundMiddlePacket {

	protected int id;
	protected int category;
	protected String parrotedEntityType;
	protected int x;
	protected int y;
	protected int z;
	protected float volume;
	protected float pitch;

	@Override
	public void readFromServerData(ByteBuf serverdata) {
		id = VarNumberSerializer.readVarInt(serverdata);
		category = VarNumberSerializer.readVarInt(serverdata);
		x = serverdata.readInt();
		y = serverdata.readInt();
		z = serverdata.readInt();
		volume = serverdata.readFloat();
		pitch = serverdata.readFloat();
	}

}

Update sound changes (mojang rewrted the changes that they done before)


// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.google.dart.compiler.ast;

import com.google.common.collect.Lists;

/**
 * Represents a Dart block containing a single return statement.
 */
public class DartReturnBlock extends DartBlock {
  public DartReturnBlock(DartExpression returnVal) {
    super(Lists.<DartStatement> newArrayList(new DartReturnStatement(returnVal)));
    // Set the source information for the synthesized node.
    getStatements().get(0).setSourceInfo(returnVal.getSourceInfo());
  }

  @Override
  public <R> R accept(ASTVisitor<R> visitor) {
    return visitor.visitReturnBlock(this);
  }
}

// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.google.dart.compiler.ast;

import com.google.common.collect.Lists;

/**
 * Represents a Dart block containing a single return statement.
 */
public class DartReturnBlock extends DartBlock {
  private final DartExpression value;

  public DartReturnBlock(DartExpression value) {
    super(Lists.<DartStatement> newArrayList(new DartReturnStatement(value)));
    this.value = value;
    // Set the source information for the synthesized node.
    getStatements().get(0).setSourceInfo(value.getSourceInfo());
  }

  @Override
  public <R> R accept(ASTVisitor<R> visitor) {
    return visitor.visitReturnBlock(this);
  }

  public DartExpression getValue() {
    return value;
  }
}

Convert into/from => function syntax


package com.yahoo.vespa.hosted.controller.api.integration.aws;

import com.yahoo.config.provision.CloudAccount;

import java.util.Set;
import java.util.TreeSet;

/**
 * @author jonmv
 */
public class MockEnclaveAccessService implements EnclaveAccessService {

    private volatile Set<CloudAccount> currentAccounts;

    public Set<CloudAccount> currentAccounts() { return currentAccounts; }

    @Override
    public void allowAccessFor(Set<CloudAccount> accounts) {
        currentAccounts = new TreeSet<>(accounts);
    }

}

package com.yahoo.vespa.hosted.controller.api.integration.aws;

import com.yahoo.config.provision.CloudAccount;

import java.util.Set;
import java.util.TreeSet;

/**
 * @author jonmv
 */
public class MockEnclaveAccessService implements EnclaveAccessService {

    private volatile Set<CloudAccount> currentAccounts = new TreeSet<>();

    public Set<CloudAccount> currentAccounts() { return currentAccounts; }

    @Override
    public void allowAccessFor(Set<CloudAccount> accounts) {
        currentAccounts = new TreeSet<>(accounts);
    }

}

Fix test even more :'(


package org.intermine.webservice.server.user;

import java.util.Arrays;
import java.util.Map;

import org.intermine.api.InterMineAPI;
import org.intermine.api.profile.Profile;
import org.intermine.api.profile.ProfileManager;
import org.intermine.webservice.server.core.JSONService;
import org.intermine.webservice.server.exceptions.ServiceForbiddenException;
import org.intermine.webservice.server.output.JSONFormatter;

public class TokenService extends JSONService {

    private static final String DENIAL_MSG = "All token requests must be authenticated.";

    public TokenService(InterMineAPI im) {
        super(im);
    }

    @Override
    protected void execute() throws Exception {
        final ProfileManager pm = im.getProfileManager();
        Profile profile = getPermission().getProfile();

        String token = pm.generate24hrKey(profile);
        output.addResultItem(Arrays.asList("\"" + token + "\""));
    }

    @Override
    protected void validateState() {
        if (!isAuthenticated()) {
            throw new ServiceForbiddenException(DENIAL_MSG);
        }
    }

    @Override
    protected Map<String, Object> getHeaderAttributes() {
        Map<String, Object> retval = super.getHeaderAttributes();
        retval.put(JSONFormatter.KEY_INTRO, "\"token\":");
        return retval;
    }

}

package org.intermine.webservice.server.user;

import java.util.Arrays;

import org.intermine.api.InterMineAPI;
import org.intermine.api.profile.Profile;
import org.intermine.api.profile.ProfileManager;
import org.intermine.webservice.server.core.JSONService;
import org.intermine.webservice.server.exceptions.BadRequestException;
import org.intermine.webservice.server.exceptions.ServiceForbiddenException;

public class TokenService extends JSONService {

    private static final String DENIAL_MSG = "All token requests must be authenticated.";

    public TokenService(InterMineAPI im) {
        super(im);
    }

    @Override
    protected void execute() throws Exception {
        final ProfileManager pm = im.getProfileManager();
        Profile profile = getPermission().getProfile();
        String tokenType = getOptionalParameter("type", "day").toLowerCase();
        String token = null;
        if ("day".equals(tokenType)) {
            token = pm.generate24hrKey(profile);
        } else if ("perma".equals(tokenType)) {
            token = pm.generateReadOnlyAccessToken(profile);
        } else {
            throw new BadRequestException("Unknown token type: " + tokenType);
        }
        addResultValue(token, false);
    }

    @Override
    protected void validateState() {
        if (!isAuthenticated()) {
            throw new ServiceForbiddenException(DENIAL_MSG);
        }
    }

    @Override
    protected String getResultsKey() {
        return "token";
    }
}

Support more than one type of token.


package org.jctools.queues;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Queue;

import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import org.jctools.queues.spec.ConcurrentQueueSpec;
import org.jctools.queues.spec.Ordering;

@RunWith(Parameterized.class)
public class QueueSanityTestMpscChunked extends QueueSanityTestMpscArray
{
    public QueueSanityTestMpscChunked(ConcurrentQueueSpec spec, Queue<Integer> queue)
    {
        super(spec, queue);
    }

    @Parameterized.Parameters
    public static Collection<Object[]> parameters()
    {
        ArrayList<Object[]> list = new ArrayList<Object[]>();
        list.add(makeQueue(0, 1, 4, Ordering.FIFO, new MpscChunkedArrayQueue<>(2, 4)));// MPSC size 1
        list.add(makeQueue(0, 1, SIZE, Ordering.FIFO, new MpscChunkedArrayQueue<>(8, SIZE)));// MPSC size SIZE
        return list;
    }
}

package org.jctools.queues;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Queue;

import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import org.jctools.queues.spec.ConcurrentQueueSpec;
import org.jctools.queues.spec.Ordering;

@RunWith(Parameterized.class)
public class QueueSanityTestMpscChunked extends QueueSanityTestMpscArray
{
    public QueueSanityTestMpscChunked(ConcurrentQueueSpec spec, Queue<Integer> queue)
    {
        super(spec, queue);
    }

    @Parameterized.Parameters
    public static Collection<Object[]> parameters()
    {
        ArrayList<Object[]> list = new ArrayList<Object[]>();
        list.add(makeQueue(0, 1, 4, Ordering.FIFO, new MpscChunkedArrayQueue<>(2, 4)));// MPSC size 1
        list.add(makeQueue(0, 1, SIZE, Ordering.FIFO, new MpscChunkedArrayQueue<>(8, SIZE)));// MPSC size SIZE
        list.add(makeQueue(0, 1, 4096, Ordering.FIFO, new MpscChunkedArrayQueue<>(32, 4096)));// Netty recycler defaults
        return list;
    }
}

Add Netty default sizing to test


package me.proxer.library.api;

import me.proxer.library.util.ProxerUtils;
import retrofit2.Converter;
import retrofit2.Retrofit;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

/**
 * @author Ruben Gees
 */
final class EnumRetrofitConverterFactory extends Converter.Factory {

    @Override
    public Converter<?, String> stringConverter(final Type type, final Annotation[] annotations,
                                                final Retrofit retrofit) {
        if (((Class<?>) type).isEnum()) {
            return (Converter<Enum<?>, String>) value -> ProxerUtils.getApiEnumName(value);
        }

        return null;
    }
}

package me.proxer.library.api;

import me.proxer.library.util.ProxerUtils;
import retrofit2.Converter;
import retrofit2.Retrofit;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

/**
 * @author Ruben Gees
 */
final class EnumRetrofitConverterFactory extends Converter.Factory {

    @Override
    public Converter<?, String> stringConverter(final Type type, final Annotation[] annotations,
                                                final Retrofit retrofit) {
        if (((Class<?>) type).isEnum()) {
            return (Converter<Enum<?>, String>) ProxerUtils::getApiEnumName;
        }

        return null;
    }
}

Revert "Try a lambda instead of a method reference for java 8 support"


package speciemongo.net.speciemongo;

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

import com.instabug.library.IBGInvocationEvent;
import com.instabug.library.Instabug;
import com.mapbox.mapboxsdk.MapboxAccountManager;

/**
 * The {@link Application} implementation for the app.
 */
public class SgApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        // If we are in debug mode,
        if(BuildConfig.DEBUG) {

            // Enable strict mode
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .build());
            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .build());

        }

        MapboxAccountManager.start(this,
                "pk.eyJ1IjoianRrbGVpbiIsImEiOiJjaXJwZHJtOGUwMGFqaHVuaDI4bGQ2NndnIn0.nCYv5GWwefBLgO0zde2_Yw");

        // TODO change failure logs to Instabug in beta
        // Initialize Instabug
        new Instabug.Builder(this, "09eb9f6a678f5331c074cfe615d6ba3e")
                .setInvocationEvent(IBGInvocationEvent.IBGInvocationEventShake)
                .setShouldShowIntroDialog(false)
                .setDebugEnabled(true)
                .build();

    }
}

package speciemongo.net.speciemongo;

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

import com.instabug.library.IBGInvocationEvent;
import com.instabug.library.Instabug;

/**
 * The {@link Application} implementation for the app.
 */
public class SgApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        // If we are in debug mode,
        if(BuildConfig.DEBUG) {

            // Enable strict mode
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .build());
            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .build());

        }

        // Initialize Instabug
        new Instabug.Builder(this, "09eb9f6a678f5331c074cfe615d6ba3e")
                .setInvocationEvent(IBGInvocationEvent.IBGInvocationEventShake)
                .build();

    }
}

Revert "Initialized MapBox in Application"


package me.jacobcrofts.simplestructureloader.api;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

import org.json.simple.JSONArray;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

import me.jacobcrofts.simplestructureloader.util.Selection;

public final class StructureAPI {

	private StructureAPI() {}

	public static void writeToFile(String path, Selection selection) throws IOException {
		FileWriter writer = new FileWriter(path);
		writer.write(selection.toJSON().toJSONString());
		writer.close();
	}

	public static JSONArray readFromFile(String path) throws FileNotFoundException, IOException, ParseException {
		return (JSONArray) new JSONParser().parse(new FileReader(path));
	}

	public static void placeStructure(Selection selection) {
		// TODO
	}

}

package me.jacobcrofts.simplestructureloader.api;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

import org.bukkit.Location;
import org.bukkit.block.Block;
import org.json.simple.JSONArray;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

import me.jacobcrofts.simplestructureloader.util.SavedBlock;
import me.jacobcrofts.simplestructureloader.util.Selection;

public final class StructureAPI {

	private StructureAPI() {}

	public static void writeToFile(String path, Selection selection) throws IOException {
		FileWriter writer = new FileWriter(path);
		writer.write(selection.toJSON().toJSONString());
		writer.close();
	}

	public static JSONArray readFromFile(String path) throws FileNotFoundException, IOException, ParseException {
		return (JSONArray) new JSONParser().parse(new FileReader(path));
	}

	@SuppressWarnings("deprecation")
	public static void placeStructure(Selection selection, Location baseLocation) {
		for (SavedBlock block : selection.getSavedBlocks()) {
			Block realBlock = baseLocation.add(block.getRelativeX(), block.getRelativeY(), block.getRelativeZ()).getBlock();
			realBlock.setType(block.getType());
			realBlock.setData(block.getData());
		}
	}

}

Add feature: support for pasting structure at a given location


package com.netflix.appinfo.providers;

import com.netflix.appinfo.AmazonInfo;
import com.netflix.appinfo.Ec2EurekaArchaius2InstanceConfig;
import com.netflix.appinfo.EurekaInstanceConfig;
import com.netflix.archaius.api.Config;

import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;

@Singleton
public class CustomAmazonInfoProviderInstanceConfigFactory implements EurekaInstanceConfigFactory {

    private final Config configInstance;
    private final Provider<AmazonInfo> amazonInfoProvider;
    private EurekaInstanceConfig eurekaInstanceConfig;

    @Inject
    public CustomAmazonInfoProviderInstanceConfigFactory(Config configInstance, AmazonInfoProviderFactory amazonInfoProviderFactory) {
        this.configInstance = configInstance;
        this.amazonInfoProvider = amazonInfoProviderFactory.get();
    }

    @Override
    public EurekaInstanceConfig get() {
        if (eurekaInstanceConfig == null) {
            eurekaInstanceConfig = new Ec2EurekaArchaius2InstanceConfig(configInstance, amazonInfoProvider);
        }

        return eurekaInstanceConfig;
    }
}

package com.netflix.appinfo.providers;

import com.netflix.appinfo.AmazonInfo;
import com.netflix.appinfo.Ec2EurekaArchaius2InstanceConfig;
import com.netflix.appinfo.EurekaInstanceConfig;
import com.netflix.archaius.api.Config;
import com.netflix.discovery.DiscoveryManager;

import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;

@Singleton
public class CustomAmazonInfoProviderInstanceConfigFactory implements EurekaInstanceConfigFactory {

    private final Config configInstance;
    private final Provider<AmazonInfo> amazonInfoProvider;
    private EurekaInstanceConfig eurekaInstanceConfig;

    @Inject
    public CustomAmazonInfoProviderInstanceConfigFactory(Config configInstance, AmazonInfoProviderFactory amazonInfoProviderFactory) {
        this.configInstance = configInstance;
        this.amazonInfoProvider = amazonInfoProviderFactory.get();
    }

    @Override
    public EurekaInstanceConfig get() {
        if (eurekaInstanceConfig == null) {
            eurekaInstanceConfig = new Ec2EurekaArchaius2InstanceConfig(configInstance, amazonInfoProvider);

            // Copied from CompositeInstanceConfigFactory.get
            DiscoveryManager.getInstance().setEurekaInstanceConfig(eurekaInstanceConfig);
        }

        return eurekaInstanceConfig;
    }
}

Fix DiscoveryManager for DI tests


/*******************************************************************************
 * Copyright (c) 2009-2010, G. Weirich and Elexis
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    G. Weirich - initial implementation
 *
 *******************************************************************************/
package ch.elexis.labortarif2009.data;

public class Constants {
	public static final String pluginID = "ch.elexis.labortarif.ch2009"; //$NON-NLS-1$
}

/*******************************************************************************
 * Copyright (c) 2009-2010, G. Weirich and Elexis
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    G. Weirich - initial implementation
 *
 *******************************************************************************/
package ch.elexis.labortarif2009.data;

public class Constants {
	public static final String pluginID = "ch.elexis.base.ch.labortarif_2009"; //$NON-NLS-1$
}

Fix Einstellungen Abrechnung Fachspezialitäten Liste ist leer


/*
 * Copyright 2020 Martin Winandy
 *
 * 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.tinylog.core.runtime;

/**
 * Provider for acquiring the appropriate {@link RuntimeFlavor} for the actual virtual machine.
 */
public final class RuntimeProvider {

	/** */
	public RuntimeProvider() {
	}

	/**
	 * Provides the appropriate {@link RuntimeFlavor} for the actual virtual machine.
	 *
	 * @return An appropriate runtime instance
	 */
	public RuntimeFlavor getRuntime() {
		if (System.getProperty("java.runtime.name").equals("Android Runtime")) {
			return new AndroidRuntime();
		} else {
			return new JavaRuntime();
		}
	}

}

/*
 * Copyright 2020 Martin Winandy
 *
 * 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.tinylog.core.runtime;

/**
 * Provider for acquiring the appropriate {@link RuntimeFlavor} for the actual virtual machine.
 */
public final class RuntimeProvider {

	/** */
	public RuntimeProvider() {
	}

	/**
	 * Provides the appropriate {@link RuntimeFlavor} for the actual virtual machine.
	 *
	 * @return An appropriate runtime instance
	 */
	public RuntimeFlavor getRuntime() {
		if ("Android Runtime".equals(System.getProperty("java.runtime.name"))) {
			return new AndroidRuntime();
		} else {
			return new JavaRuntime();
		}
	}

}

Fix potential null pointer exception on runtimes without name


package com.tacktic.inbudget;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import io.sphere.sdk.products.ProductProjection;

import javax.money.MonetaryAmount;

import static com.tacktic.inbudget.BaseScreen.*;
import static java.util.Locale.ENGLISH;

public class Item extends GameElement {
    private final String productId;
    private final Texture texture;
    private final Rectangle item;
    private final MonetaryAmount price;

    public Item(ProductProjection product, Resources resources) {
        String slug = product.getSlug().get(ENGLISH).orElse("");
        productId = product.getId();
        texture = resources.itemImage(slug);
        item = new Rectangle();
        item.width = texture.getWidth();
        item.height = texture.getHeight();
        item.x = MathUtils.random(VIEWPORT_MARGIN, VIEWPORT_WIDTH - item.width - VIEWPORT_MARGIN);
        item.y = VIEWPORT_HEIGHT;
        price = product.getMasterVariant().getPrices().get(0).getValue();
    }

    @Override
    Texture texture() {
        return texture;
    }

    @Override
    Rectangle box() {
        return item;
    }

    public String productId() {
        return productId;
    }

    public String price() {
        String textValue = String.valueOf(price.getNumber().intValueExact());
        return "$" + textValue;
    }

    public void playSound() {

    }
}

package com.tacktic.inbudget;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import io.sphere.sdk.products.ProductProjection;

import javax.money.MonetaryAmount;

import static com.tacktic.inbudget.BaseScreen.*;
import static java.util.Locale.ENGLISH;

public class Item extends GameElement {
    private final String productId;
    private final Texture texture;
    private final Rectangle item;
    private final MonetaryAmount price;

    public Item(ProductProjection product, Resources resources) {
        String slug = product.getSlug().get(ENGLISH).orElse("");
        productId = product.getId();
        texture = resources.itemImage(slug);
        item = new Rectangle();
        item.width = texture.getWidth();
        item.height = texture.getHeight();
        item.x = MathUtils.random(VIEWPORT_MARGIN, VIEWPORT_WIDTH - item.width - VIEWPORT_MARGIN);
        item.y = VIEWPORT_HEIGHT;
        if (product.getMasterVariant().getPrices().isEmpty()) {
            throw new RuntimeException("Product without prices " + productId);
        }
        price = product.getMasterVariant().getPrices().get(0).getValue();
    }

    @Override
    Texture texture() {
        return texture;
    }

    @Override
    Rectangle box() {
        return item;
    }

    public String productId() {
        return productId;
    }

    public String price() {
        String textValue = String.valueOf(price.getNumber().intValueExact());
        return "$" + textValue;
    }

    public void playSound() {

    }
}

Check when product doesn't have a price.


package com.peterphi.servicemanager.service.rest.resource.type;

import com.peterphi.std.util.jaxb.JAXBSerialiser;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;

@XmlRootElement(name = "ProvisionResourceParameters")
@XmlType(name = "ProvisionResourceParameters")
public class ProvisionResourceParametersDTO
{
	@XmlElementWrapper(name = "metadata")
	@XmlElement(name = "kvp")
	public List<ResourceKVP> metadata = new ArrayList(0);

	public static void main(String[] args) throws Exception
	{
		System.out.println(JAXBSerialiser.getInstance(ProvisionResourceParametersDTO.class)
		                                 .serialise(new ProvisionResourceParametersDTO()));
	}
}

package com.peterphi.servicemanager.service.rest.resource.type;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;

@XmlRootElement(name = "ProvisionResourceParameters")
@XmlType(name = "ProvisionResourceParameters")
public class ProvisionResourceParametersDTO
{
	@XmlElementWrapper(name = "metadata")
	@XmlElement(name = "kvp")
	public List<ResourceKVP> metadata = new ArrayList<>(0);
}

Remove debug code to print example provision XML


//
// Copyright 2016, Yahoo Inc.
// Copyrights licensed under the New BSD License.
// See the accompanying LICENSE file for terms.
//

// [![Build Status](https://travis-ci.org/jminusminus/jmmexample.svg?branch=master)](https://travis-ci.org/jminusminus/jmmexample)
// ## Stability: 1 - Stable
// This is an example project for [Jmm](https://github.com/ricallinson/jmm).
package github.com.jminusminus.jmmexample;

public class Helloworld {

    // The following jmm commands will setup up a Jmm workspace, pull down the code for this project, test it, install it and then run it.
    //
    //     mkdir ./jmmtest
    //     cd ./jmmtest
    //     jmm here .
    //     jmm get github.com/jminusminus/simplebdd
    //     jmm get github.com/jminusminus/jmmexample
    //     jmm test ./src/github/com/jminusminus/jmmexample
    //     jmm install ./src/github/com/jminusminus/jmmexample
    //     jmmexample
    public static void main(String args[]) {
        System.out.println(Helloworld.msg());
    }

    // Return a congratulations message.
    public static String msg() {
        return "Congratulations on your first Jmm application.";
    }
}

Change README to be Jmm documentation


package prototypev.PermissiveFov.Scenes;

import org.andengine.ui.activity.BaseGameActivity;
import prototypev.PermissiveFov.ResourceManagers.GameResourceManager;

public class GameScene extends SceneBase {
    public GameScene(BaseGameActivity activity, GameResourceManager resourceManager) {
        super(activity, resourceManager);
    }
}

package prototypev.PermissiveFov.Scenes;

import org.andengine.extension.tmx.TMXTiledMap;
import org.andengine.ui.activity.BaseGameActivity;
import prototypev.PermissiveFov.LevelGeneration.Entities.Level;
import prototypev.PermissiveFov.LevelGeneration.Generators.LevelGenerator;
import prototypev.PermissiveFov.LevelGeneration.Generators.MazeGenerator;
import prototypev.PermissiveFov.LevelGeneration.Generators.RoomGenerator;
import prototypev.PermissiveFov.ResourceManagers.GameResourceManager;

public class GameScene extends SceneBase {
    public GameScene(BaseGameActivity activity, GameResourceManager resourceManager) {
        super(activity, resourceManager);

        // Generate the random level
        MazeGenerator mazeGenerator = new MazeGenerator(30, 70);
        RoomGenerator roomGenerator = new RoomGenerator(2, 3, 2, 3);
        Level level = LevelGenerator.generate(15, 15, mazeGenerator, roomGenerator, 5);

        // Set the appropriate tiles in the tiled map based on what was generated
        TMXTiledMap tiledMap = resourceManager.getTiledMap();
    }

}

Integrate level generator with game scene


package edu.kit.ipd.sdq.vitruvius.casestudies.pcmjava.seffstatements.code2seff;

import org.palladiosimulator.pcm.repository.BasicComponent;
import org.somox.gast2seff.visitors.AbstractFunctionClassificationStrategy;
import org.somox.gast2seff.visitors.InterfaceOfExternalCallFinding;
import org.somox.gast2seff.visitors.ResourceDemandingBehaviourForClassMethodFinding;

import edu.kit.ipd.sdq.vitruvius.framework.contracts.datatypes.CorrespondenceModel;
import edu.kit.ipd.sdq.vitruvius.framework.contracts.meta.correspondence.Correspondence;

public interface Code2SEFFFactory {

    BasicComponentFinding createBasicComponentFinding();

    InterfaceOfExternalCallFinding createInterfaceOfExternalCallFinding(
    		CorrespondenceModel correspondenceInstance, BasicComponent basicComponent);

    ResourceDemandingBehaviourForClassMethodFinding createResourceDemandingBehaviourForClassMethodFinding(
    		CorrespondenceModel correspondenceInstance);

    AbstractFunctionClassificationStrategy createAbstractFunctionClassificationStrategy(
            BasicComponentFinding basicComponentFinding, CorrespondenceModel correspondenceInstance,
            BasicComponent basicComponent);
}

package edu.kit.ipd.sdq.vitruvius.casestudies.pcmjava.seffstatements.code2seff;

import org.palladiosimulator.pcm.repository.BasicComponent;
import org.somox.gast2seff.visitors.AbstractFunctionClassificationStrategy;
import org.somox.gast2seff.visitors.InterfaceOfExternalCallFinding;
import org.somox.gast2seff.visitors.ResourceDemandingBehaviourForClassMethodFinding;

import edu.kit.ipd.sdq.vitruvius.framework.contracts.datatypes.CorrespondenceModel;

public interface Code2SEFFFactory {

    BasicComponentFinding createBasicComponentFinding();

    InterfaceOfExternalCallFinding createInterfaceOfExternalCallFinding(
    		CorrespondenceModel correspondenceInstance, BasicComponent basicComponent);

    ResourceDemandingBehaviourForClassMethodFinding createResourceDemandingBehaviourForClassMethodFinding(
    		CorrespondenceModel correspondenceInstance);

    AbstractFunctionClassificationStrategy createAbstractFunctionClassificationStrategy(
            BasicComponentFinding basicComponentFinding, CorrespondenceModel correspondenceInstance,
            BasicComponent basicComponent);
}

Fix several warnings in PCM-Java casestudy projects.


package com.frameworkium.integration.frameworkium.tests;

import com.frameworkium.core.ui.tests.BaseUITest;
import com.frameworkium.integration.frameworkium.pages.JQueryDemoPage;
import com.frameworkium.integration.seleniumhq.pages.SeleniumDownloadPage;
import com.frameworkium.integration.theinternet.pages.WelcomePage;
import org.testng.annotations.*;

import static com.google.common.truth.Truth.assertThat;

public class FrameworkiumBugsTest extends BaseUITest {

    @BeforeMethod//(dependsOnMethods = "configureBrowserBeforeTest")
    public void configureBrowserBeforeUse_allows_browser_access_in_before_method() {
        configureBrowserBeforeUse();
        WelcomePage.open();
        tearDownBrowser();
    }

    public void ensure_jQueryAjaxDone_does_not_fail() {
        String headingText =
                JQueryDemoPage.open()
                        .waitForJQuery()
                        .getHeadingText();
        assertThat(headingText).isEqualTo("jQuery UI Demos");
    }

    public void use_base_page_visibility() {
        SeleniumDownloadPage.open()
                .hideContent()
                .forceVisibleContent()
                .waitForContent();
    }

    @Test(dependsOnMethods = {"use_base_page_visibility"})
    public void ensure_BaseUITest_wait_is_updated_after_browser_reset() {
        // tests bug whereby BasePage.wait wasn't updated after browser reset
        SeleniumDownloadPage.open().waitForContent();
    }

    public void use_base_page_logger() {
        SeleniumDownloadPage.open().log();
    }

}

package com.frameworkium.integration.frameworkium.tests;

import com.frameworkium.core.ui.tests.BaseUITest;
import com.frameworkium.integration.frameworkium.pages.JQueryDemoPage;
import com.frameworkium.integration.seleniumhq.pages.SeleniumDownloadPage;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import static com.google.common.truth.Truth.assertThat;

// tests if BeforeMethods are run despite not being in this group
@Test(groups = "fw-bugs")
public class FrameworkiumBugsTest extends BaseUITest {

    @BeforeMethod(dependsOnMethods = "configureBrowserBeforeTest")
    public void configureBrowserBeforeUse_allows_browser_access_in_before_method() {
        assertThat(getDriver().getPageSource()).isNotEmpty();
    }

    public void ensure_jQueryAjaxDone_does_not_fail() {
        String headingText =
                JQueryDemoPage.open()
                        .waitForJQuery()
                        .getHeadingText();
        assertThat(headingText).isEqualTo("jQuery UI Demos");
    }

    public void use_base_page_visibility() {
        SeleniumDownloadPage.open()
                .hideContent()
                .forceVisibleContent()
                .waitForContent();
    }

    @Test(dependsOnMethods = {"use_base_page_visibility"})
    public void ensure_BaseUITest_wait_is_updated_after_browser_reset() {
        // tests bug whereby BasePage.wait wasn't updated after browser reset
        SeleniumDownloadPage.open().waitForContent();
    }

    public void use_base_page_logger() {
        SeleniumDownloadPage.open().log();
    }

}

Update @BeforeMethod test to use dependsOnMethods and removed page load


package edu.stuy.starlorn.upgrades;

public class StutterShotUpgrade extends GunUpgrade {
    protected boolean _fast_shot;

    public StutterShotUpgrade() {
        super();
        _name = "Stutter Shot";
        _description = "P-Pew P-Pew P-Pew!";
        _fast_shot = false;
    }

    @Override
    public double getShotSpeed(double shotspeed) {
        return shotspeed;
    }

    @Override
    public double getCooldown(double cooldown) {
        _fast_shot = !_fast_shot;
        if (_fast_shot) {
            return cooldown * 3 / 2;
        } else {
            return cooldown / 2;
        }
    }

    @Override
    public String getSpriteName() {
        return "upgrade/stuttershot";
    }

    @Override
    public Upgrade clone() {
        return new SpeedShotUpgrade();
    }
}

package edu.stuy.starlorn.upgrades;

public class StutterShotUpgrade extends GunUpgrade {
    protected boolean _fast_shot;

    public StutterShotUpgrade() {
        super();
        _name = "Stutter Shot";
        _description = "P-Pew P-Pew P-Pew!";
        _fast_shot = false;
    }

    @Override
    public double getShotSpeed(double shotspeed) {
        return shotspeed;
    }

    @Override
    public double getCooldown(double cooldown) {
        _fast_shot = !_fast_shot;
        if (_fast_shot) {
            return cooldown * 3 / 2;
        } else {
            return cooldown / 2;
        }
    }

    @Override
    public String getSpriteName() {
        return "upgrade/stuttershot";
    }

    @Override
    public Upgrade clone() {
        return new StutterShotUpgrade();
    }
}

Fix StutterShot not being generated.


/*
 * Copyright 2016, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package org.spine3.tools.codestyle;

/**
 * @author Alexander Aleksandrov
 */
public class JavaSources {
    private static final String ext = ".java";
    private static final String readFileErrMsg = "Cannot read the contents of the file: ";

    public static String javaExt(){
        return ext;
    }

    public static String getReadFileErrMsg(){
        return readFileErrMsg;
    }
}

/*
 * Copyright 2016, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package org.spine3.tools.codestyle;

/**
 * @author Alexander Aleksandrov
 */
public class JavaSources {
    private JavaSources(){}
    private static final String ext = ".java";
    private static final String readFileErrMsg = "Cannot read the contents of the file: ";

    public static String javaExt(){
        return ext;
    }

    public static String getReadFileErrMsg(){
        return readFileErrMsg;
    }
}

Fix lack of private constructor in utility method.


package com.github.webdriverextensions.junitrunner;

import com.github.webdriverextensions.junitrunner.annotations.Firefox;
import com.github.webdriverextensions.junitrunner.annotations.IgnoreFirefox;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(WebDriverRunner.class)
@Firefox()
public class IgnoreBrowserTest {

    @Test
    @IgnoreFirefox
    public void ignoredTest() {
        assert false; // Fail test if test runs
    }
}

package com.github.webdriverextensions.junitrunner;

import static org.junit.Assert.fail;

import org.junit.Test;
import org.junit.runner.RunWith;

import com.github.webdriverextensions.junitrunner.annotations.Firefox;
import com.github.webdriverextensions.junitrunner.annotations.IgnoreFirefox;

@RunWith(WebDriverRunner.class)
@Firefox
public class IgnoreBrowserTest {

    @Test
    @IgnoreFirefox
    public void ignoredTest() {
	fail("This test should be ignored");
    }
}

Use junit assert instead of java keyword


package info.u_team.u_team_test.data.provider;

import java.util.function.BiConsumer;

import info.u_team.u_team_core.data.*;
import info.u_team.u_team_test.init.TestBlocks;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootTable;

public class TestLootTablesProvider extends CommonLootTablesProvider {

	public TestLootTablesProvider(GenerationData data) {
		super(data);
	}

	@Override
	protected void registerLootTables(BiConsumer<ResourceLocation, LootTable> consumer) {
		registerBlock(TestBlocks.BASIC_TILEENTITY, addTileEntityBlockLootTable(TestBlocks.BASIC_TILEENTITY), consumer);
		registerBlock(TestBlocks.BASIC_ENERGY_CREATOR, addTileEntityBlockLootTable(TestBlocks.BASIC_ENERGY_CREATOR), consumer);
		registerBlock(TestBlocks.BASIC_FLUID_INVENTORY, addTileEntityBlockLootTable(TestBlocks.BASIC_FLUID_INVENTORY), consumer);
	}

}

package info.u_team.u_team_test.data.provider;

import java.util.function.BiConsumer;

import info.u_team.u_team_core.data.*;
import info.u_team.u_team_test.init.*;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootTable;

public class TestLootTablesProvider extends CommonLootTablesProvider {

	public TestLootTablesProvider(GenerationData data) {
		super(data);
	}

	@Override
	protected void registerLootTables(BiConsumer<ResourceLocation, LootTable> consumer) {
		registerBlock(TestBlocks.BASIC, addFortuneBlockLootTable(TestBlocks.BASIC, TestItems.BASIC), consumer);
		registerBlock(TestBlocks.BASIC_TILEENTITY, addTileEntityBlockLootTable(TestBlocks.BASIC_TILEENTITY), consumer);
		registerBlock(TestBlocks.BASIC_ENERGY_CREATOR, addTileEntityBlockLootTable(TestBlocks.BASIC_ENERGY_CREATOR), consumer);
		registerBlock(TestBlocks.BASIC_FLUID_INVENTORY, addTileEntityBlockLootTable(TestBlocks.BASIC_FLUID_INVENTORY), consumer);
	}

}

Add loot table for basic block


package com.hamishrickerby.http_server;

import junit.framework.TestCase;

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

/**
 * Created by rickerbh on 16/08/2016.
 */
public class DirectoryListingResponseTest extends TestCase {
    List<String> listing = new ArrayList<String>(Arrays.asList("test.html", "ihniwid.jpg"));

    public void testEnsureDirectoryListingTextMatchesFiles() {
        String responseText = getDirectoryListing();
        assertTrue(responseText.contains("/"));
        assertTrue(responseText.contains(listing.get(0)));
        assertTrue(responseText.contains(listing.get(1)));
    }

    private String getDirectoryListing() {
        DirectoryListingResponse response = new DirectoryListingResponse(new Request("GET / HTTP/1.1"));
        response.setRootPath("./src/test/resources");
        return new String(response.body());
    }

    public void testEnsureDirectoryListingHasHTMLLinks() {
        String responseText = getDirectoryListing();
        assertTrue(responseText.contains("" + listing.get(0) + ""));
        assertTrue(responseText.contains("" + listing.get(1) + ""));
    }
}

package com.hamishrickerby.http_server;

import junit.framework.TestCase;

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

/**
 * Created by rickerbh on 16/08/2016.
 */
public class DirectoryListingResponseTest extends TestCase {
    List<String> listing = new ArrayList<String>(Arrays.asList("test.html", "ihniwid.jpg"));

    public void testEnsureDirectoryListingTextMatchesFiles() {
        String responseText = getDirectoryListing();
        assertTrue(responseText.contains("/"));
        assertTrue(responseText.contains(listing.get(0)));
        assertTrue(responseText.contains(listing.get(1)));
    }

    private String getDirectoryListingForPath(String location) {
        DirectoryListingResponse response = new DirectoryListingResponse(new Request("GET " + location + " HTTP/1.1"));
        response.setRootPath("./src/test/resources");
        return new String(response.body());
    }

    private String getDirectoryListing() {
        return getDirectoryListingForPath("/");
    }

    public void testEnsureDirectoryListingHasHTMLLinks() {
        String responseText = getDirectoryListing();
        assertTrue(responseText.contains("" + listing.get(0) + ""));
        assertTrue(responseText.contains("" + listing.get(1) + ""));
    }
}

Make directory listing test helper more generic


package com.emailclue.api.model;

import com.fasterxml.jackson.annotation.JsonCreator;

public class EmailSent {

    private final String eventId;

    @JsonCreator()
    public EmailSent(String eventId) {
        this.eventId = eventId;
    }

}

package com.emailclue.api.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class EmailSent {

    private final String eventId;

    @JsonCreator()
    public EmailSent(@JsonProperty("eventId") String eventId) {
        this.eventId = eventId;
    }

    public String getEventId() {
        return eventId;
    }

}

Add getter for eventId so that it is serialised


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

package org.osgi.service.cdi.runtime.dto.template;

import org.osgi.dto.DTO;

/**
 * Description of a CDI container.
 *
 * @NotThreadSafe
 * @author $Id$
 */
public class ContainerTemplateDTO extends DTO {
	/**
	 * The id of the CDI container.
	 */
	public String id;

	/**
	 * The extension dependencies of this CDI container.
	 */
	public ExtensionTemplateDTO[]	extensions;

	/**
	 * The components defined in this CDI container.
	 */
	public ComponentTemplateDTO[]	components;
}

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

package org.osgi.service.cdi.runtime.dto.template;

import java.util.List;
import org.osgi.dto.DTO;
import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO.Type;

/**
 * Description of a CDI container.
 *
 * @NotThreadSafe
 * @author $Id$
 */
public class ContainerTemplateDTO extends DTO {
	/**
	 * The id of the CDI container.
	 */
	public String id;

	/**
	 * The extension dependencies of this CDI container.
	 *

	 * Must not be {@code null}
	 *

	 * May be empty if the container does not require CDI extensions.
	 */
	public List<ExtensionTemplateDTO>	extensions;

	/**
	 * The components defined in this CDI container.
	 *

	 * Must not be {@code null}
	 *

	 * Has at lest one element for the {@link Type#APPLICATION application
	 * component}.
	 */
	public List<ComponentTemplateDTO>	components;
}

Fix some DTO arrays to lists


/*
 * 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.forrest.core.exception;

public class ProcessingException extends Exception {

	/**
	 *
	 */
	private static final long serialVersionUID = -5175336575758457083L;

	public ProcessingException(final String message, final Exception e) {
		super(message, e);
	}

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

}

/*
 * 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.forrest.core.exception;

public class ProcessingException extends Exception {

	/**
	 *
	 */
	private static final long serialVersionUID = -5175336575758457083L;

	public ProcessingException(final String message, final Exception e) {
		super(message, e);
	}

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

	@Override
	public String getMessage() {
		String msg = super.getMessage();
		if (getCause() != null) {
			msg = msg + " caused by " + getCause().getMessage();
		}
		return msg;
	}

}

Append cause error message to our processing error message


package org.myrobotlab.document.transformer;

import org.myrobotlab.document.transformer.StageConfiguration;

import java.util.List;

import org.myrobotlab.document.Document;

/**
 * This will set a field on a document with a value
 *
 * @author kwatters
 *
 */
public class SetStaticFieldValue extends AbstractStage {

	private String fieldName = null;
	private String value = null;

	@Override
	public void startStage(StageConfiguration config) {

		if (config != null) {
			fieldName = config.getStringParam("fieldName");
			value = config.getStringParam("value");
		}
	}

	@Override
	public List<Document> processDocument(Document doc) {
		doc.addToField(fieldName, value);
		return null;
	}

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

	@Override
	public void flush() {
		// Only required if this stage does any batching.  NO-OP here.
	}

	public String getFieldName() {
		return fieldName;
	}

	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}

	public String getValue() {
		return value;
	}

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

}

package org.myrobotlab.document.transformer;

import org.myrobotlab.document.transformer.StageConfiguration;

import java.util.List;

import org.myrobotlab.document.Document;

/**
 * This will set a field on a document with a value
 *
 * @author kwatters
 *
 */
public class SetStaticFieldValue extends AbstractStage {

	private String fieldName = null;
	private String value = null;
  private List<String> values = null;

	@Override
	public void startStage(StageConfiguration config) {

		if (config != null) {
			fieldName = config.getStringParam("fieldName");
			value = config.getStringParam("value");
      values = config.getListParam("values");
		}
	}

	@Override
	public List<Document> processDocument(Document doc) {
    if (values != null) {
      for (String value : values) {
        doc.addToField(fieldName, value);
      }
    } else {
      doc.addToField(fieldName, value);
    }

		return null;
	}

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

	@Override
	public void flush() {
		// Only required if this stage does any batching.  NO-OP here.
	}

	public String getFieldName() {
		return fieldName;
	}

	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}

	public String getValue() {
		return value;
	}

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

}

Allow a list of static values.


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

import org.springframework.stereotype.Service;

import ch.ralscha.extdirectspring.annotation.ExtDirectMethod;
import ch.ralscha.extdirectspring.annotation.ExtDirectMethodType;
import ch.ralscha.extdirectspring.bean.ExtDirectFormPostResponse;

@Service
public class InfoService {

	@ExtDirectMethod(value = ExtDirectMethodType.FORM_POST, group = "itest_info_service")
	public ExtDirectFormPostResponse updateInfo(Info info) {
		ExtDirectFormPostResponse resp = new ExtDirectFormPostResponse();
		resp.addResultProperty("user-name-lower-case", info.getUserName().toLowerCase());
		return resp;
	}
}

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

import org.springframework.stereotype.Service;

import ch.ralscha.extdirectspring.annotation.ExtDirectMethod;
import ch.ralscha.extdirectspring.annotation.ExtDirectMethodType;
import ch.ralscha.extdirectspring.bean.ExtDirectFormPostResponse;

@Service
public class InfoService {

	@ExtDirectMethod(value = ExtDirectMethodType.FORM_POST, group = "itest_info_service", streamResponse = true)
	public ExtDirectFormPostResponse updateInfo(Info info) {
		ExtDirectFormPostResponse resp = new ExtDirectFormPostResponse();
		resp.addResultProperty("user-name-lower-case", info.getUserName().toLowerCase());
		return resp;
	}
}

Add a FORM_POST method with streamResponse=true


package org.kurento.client;

import org.kurento.jsonrpc.client.JsonRpcWSConnectionListener;

public class JsonRpcConnectionListenerKurento implements JsonRpcWSConnectionListener {

  private KurentoConnectionListener listener;

  public JsonRpcConnectionListenerKurento(KurentoConnectionListener listener) {
    this.listener = listener;
  }

  @Override
  public void connectionFailed() {
    listener.connectionFailed();
  }

  @Override
  public void connected() {
    listener.connected();
  }

  @Override
  public void disconnected() {
    listener.disconnected();
  }

  @Override
  public void reconnected(boolean sameServer) {
    listener.reconnected(sameServer);
  }

  public static JsonRpcWSConnectionListener create(KurentoConnectionListener listener) {

    if (listener == null) {
      return null;
    }

    return new JsonRpcConnectionListenerKurento(listener);
  }

  @Override
  public void reconnecting() {

  }

}

package org.kurento.client;

import org.kurento.jsonrpc.client.JsonRpcWSConnectionListener;

public class JsonRpcConnectionListenerKurento implements JsonRpcWSConnectionListener {

  private KurentoConnectionListener listener;

  public JsonRpcConnectionListenerKurento(KurentoConnectionListener listener) {
    this.listener = listener;
  }

  @Override
  public void connectionFailed() {
    listener.connectionFailed();
  }

  @Override
  public void connected() {
    listener.connected();
  }

  @Override
  public void disconnected() {
    listener.disconnected();
  }

  @Override
  public void reconnected(boolean sameServer) {
    listener.reconnected(sameServer);
  }

  public static JsonRpcWSConnectionListener create(KurentoConnectionListener listener) {

    if (listener == null) {
      return null;
    }

    return new JsonRpcConnectionListenerKurento(listener);
  }

  @Override
  public void reconnecting() {
    listener.disconnected();
  }

}

Call disconnected event when reconnecting


package uk.ac.ebi.quickgo.ontology.metadata;

import uk.ac.ebi.quickgo.common.loader.GZIPFiles;
import uk.ac.ebi.quickgo.rest.metadata.MetaData;

import java.nio.file.Path;
import java.util.List;

import static java.util.stream.Collectors.toList;

/**
 * Populate a MetaData instance with information about the data provided by this service
 *
 * @author Tony Wardell
 * Date: 07/03/2017
 * Time: 10:51
 * Created with IntelliJ IDEA.
 */
public class MetaDataProvider {
    private final Path ontologyPath;

    public MetaDataProvider(Path ontologyPath) {
        this.ontologyPath = ontologyPath;
    }

    public MetaData lookupMetaData() {
        List<MetaData> goLines = GZIPFiles.lines(ontologyPath)
                                          .skip(1)
                                          .filter(s -> s.startsWith("GO"))
                                          .limit(1)
                                          .map(s -> {
                                              String[] a = s.split("\t");
                                              return new MetaData(a[2], a[1]);
                                          })
                                          .collect(toList());
        return (goLines.size() == 1) ? goLines.get(0) : null;
    }
}

package uk.ac.ebi.quickgo.ontology.metadata;

import uk.ac.ebi.quickgo.common.loader.GZIPFiles;
import uk.ac.ebi.quickgo.rest.metadata.MetaData;
import uk.ac.ebi.quickgo.rest.service.ServiceConfigException;

import com.google.common.base.Preconditions;
import java.nio.file.Path;
import java.util.List;

import static java.util.stream.Collectors.toList;

/**
 * Populate a MetaData instance with information about the data provided by this service
 *
 * @author Tony Wardell
 * Date: 07/03/2017
 * Time: 10:51
 * Created with IntelliJ IDEA.
 */
public class MetaDataProvider {
    private final Path ontologyPath;

    public MetaDataProvider(Path ontologyPath) {
        Preconditions.checkArgument(ontologyPath != null, "The path to the source of the Ontology metadata cannot " +
                "be null.");
        this.ontologyPath = ontologyPath;
    }

    /**
     * Lookup the MetaData for the Ontology service
     * @return MetaData instance
     */
    public MetaData lookupMetaData() {
        try {
            List<MetaData> goLines = GZIPFiles.lines(ontologyPath)
                                              .skip(1)
                                              .filter(s -> s.startsWith("GO"))
                                              .map(s -> {
                                                  String[] a = s.split("\t");
                                                  return new MetaData(a[2], a[1]);
                                              })
                                              .collect(toList());
            Preconditions.checkState(goLines.size() == 1, "Unable to read the correct number of lines for Ontology " +
                    "metadata");
            return goLines.get(0);
        } catch (Exception e) {
            throw new ServiceConfigException(e);
        }

    }
}

Add preconditions, cope with exception during file read.


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

/**
 *
 * @author Bob
 * @author Alice
 */
public class MyApplication {

  /**
   * @param args the command line arguments (by bob)
   */
  public static void main(String[] args) {
    // TODO code application logic here
  }

}

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

/**
 *
 * @author Bob
 * @author Alice
 */
public class MyApplication {

  /**
   * @param args the command line arguments (by alice)
   */
  public static void main(String[] args) {
    // TODO code application logic here
  }

}

Update by Alice, after rebase skip


package lv.ctco.cukesrest.loadrunner;

import java.util.*;

public class LoadRunnerAction {

    private List<LoadRunnerTransaction> transactions = new ArrayList<LoadRunnerTransaction>();

    public List<LoadRunnerTransaction> getTransactions() {
        return transactions;
    }

    public void setTransactions(List<LoadRunnerTransaction> transactions) {
        this.transactions = transactions;
    }

    public void addTransaction(LoadRunnerTransaction trx) {
        transactions.add(trx);
    }

    public String format() {
        StringBuilder result = new StringBuilder().append("Action() {\n" +
            "int HttpRetCode;\n" +
            "int transactionStatus;\n" +
            "int actionStatus = LR_PASS;" +
            "lr_continue_on_error(1);\n");
        for (LoadRunnerTransaction transaction : transactions) {
            result.append(transaction.format());
        }
        return result.append("lr_exit(LR_EXIT_ACTION_AND_CONTINUE , actionStatus);\n" + "return 0;\n}\n\n").toString();
    }
}

package lv.ctco.cukesrest.loadrunner;

import java.util.*;

public class LoadRunnerAction {

    private List<LoadRunnerTransaction> transactions = new ArrayList<LoadRunnerTransaction>();

    public List<LoadRunnerTransaction> getTransactions() {
        return transactions;
    }

    public void setTransactions(List<LoadRunnerTransaction> transactions) {
        this.transactions = transactions;
    }

    public void addTransaction(LoadRunnerTransaction trx) {
        transactions.add(trx);
    }

    public String format() {
        StringBuilder result = new StringBuilder().append("Action() {\n" +
            "int HttpRetCode;\n" +
            "int transactionStatus;\n" +
            "int actionStatus = LR_PASS;\n" +
            "lr_continue_on_error(1);\n");
        for (LoadRunnerTransaction transaction : transactions) {
            result.append(transaction.format());
        }
        return result.append("lr_exit(LR_EXIT_ACTION_AND_CONTINUE , actionStatus);\n" + "return 0;\n}\n\n").toString();
    }
}

Add new line for LR_PASS;


package fi.reaktor.training.totallylazy.data;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.googlecode.totallylazy.Sequence;

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

public class Beers {

    private static Sequence<Beer> beers;
    // TODO: static init is nasty and JSON should be read asynchronously e.g. with RxJava
    public static Beers init(InputStream inputStream, ObjectMapper objectMapper) throws IOException {
        beers = objectMapper.readValue(inputStream, new TypeReference<Sequence<Beer>>() {});
        return new Beers();
    }

    public static Sequence<Beer> listAll() {
        return beers;
    }
}

package fi.reaktor.training.totallylazy.data;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.googlecode.totallylazy.Sequence;

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

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class Beers {

    private static Sequence<Beer> beers;
    private static Observable<Sequence<Beer>> beerObservable;

    public static Beers init(InputStream inputStream, ObjectMapper objectMapper) throws IOException {
        beers = objectMapper.readValue(inputStream, new TypeReference<Sequence<Beer>>() {});

        // TODO: not used yet
        beerObservable = Observable.<Sequence<Beer>>create((subscriber) -> {
            try {
                Sequence<Beer> beerSeq = objectMapper.readValue(inputStream, new TypeReference<Sequence<Beer>>() {
                });
                subscriber.onNext(beerSeq);
                subscriber.onCompleted();
            } catch (IOException e) {
                subscriber.onError(e);
            }
        }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());

        return new Beers();
    }

    public static Sequence<Beer> listAll() {
        return beers;
    }
}

Add async json loading with RxJava


package org.openscore.lang.compiler;/*******************************************************************************
* (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License v2.0 which accompany this distribution.
*
* The Apache License is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
*******************************************************************************/

import org.openscore.lang.entities.CompilationArtifact;

import java.util.Set;

//todo: Eliya - add JavaDoc
public interface SlangCompiler {
    CompilationArtifact compileFlow(SlangSource source, Set<SlangSource> path);

    CompilationArtifact compile(SlangSource source, String operationName, Set<SlangSource> path);
}

package org.openscore.lang.compiler;/*******************************************************************************
* (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License v2.0 which accompany this distribution.
*
* The Apache License is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
*******************************************************************************/

import org.openscore.lang.entities.CompilationArtifact;

import java.util.Set;

//todo: Eliya - add JavaDoc
public interface SlangCompiler {
    CompilationArtifact compileFlow(SlangSource source, Set<SlangSource> path);

    CompilationArtifact compile(SlangSource source, String operationName, Set<SlangSource> path);

    //SlangPreCompiledMetaData preCompile(SlangSource source);
}

Add new API for pre-compilation of slang files to produce meta-data


package io.github.lukehutch.fastclasspathscanner.issues.issue80;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;

import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
import io.github.lukehutch.fastclasspathscanner.utils.ReflectionUtils;

public class Issue80Test {
    @Test
    public void issue80() {
        // TODO: this test will fail in JDK9+, because there is no rt.jar.
        // TODO: Need to scan system modules when "!!" is in the scan spec.
        if (!ReflectionUtils.JAVA_VERSION_IS_9_PLUS) {
            assertThat(new FastClasspathScanner("!!", "java.util").scan().getNamesOfAllStandardClasses())
                    .contains("java.util.ArrayList");
        }
        assertThat(new FastClasspathScanner("java.util").scan().getNamesOfAllStandardClasses()).isEmpty();
    }
}

package io.github.lukehutch.fastclasspathscanner.issues.issue80;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;

import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;

public class Issue80Test {
    @Test
    public void issue80() {
        assertThat(new FastClasspathScanner("!!", "java.util").scan().getNamesOfAllStandardClasses())
                .contains("java.util.ArrayList");
    }
}

Test now works out of the box on JDK9+


package jp.ac.nii.prl.mape.monitoring.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.amazonaws.services.ec2.model.Instance;

import jp.ac.nii.prl.mape.monitoring.model.Model;
import jp.ac.nii.prl.mape.monitoring.service.EC2Service;

@RestController
@RequestMapping("/monitor")
@Component
public class MonitoringController {

	@Autowired
	private EC2Service ec2Service;

	@RequestMapping(method=RequestMethod.GET)
	public List<Instance> monitor() {
		System.out.println("Here");
		return ec2Service.getInstances();
	}
}

package jp.ac.nii.prl.mape.monitoring.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.amazonaws.services.ec2.model.Instance;
import com.amazonaws.services.ec2.model.SecurityGroup;

import jp.ac.nii.prl.mape.monitoring.model.Model;
import jp.ac.nii.prl.mape.monitoring.service.EC2Service;
import jp.ac.nii.prl.mape.monitoring.service.ModelService;

@RestController
@RequestMapping("/monitor")
@Component
public class MonitoringController {

	@Autowired
	private EC2Service ec2Service;

	@Autowired
	private ModelService modelService;

	@RequestMapping(value="/instances", method=RequestMethod.GET)
	public List<Instance> getInstances() {
		return ec2Service.getInstances();
	}

	@RequestMapping(value="/securityGroups", method=RequestMethod.GET)
	public List<SecurityGroup> getSecurityGroups() {
		return ec2Service.getSecurityGroups();
	}

	@RequestMapping(method=RequestMethod.GET)
	public Model getModel() {
		return modelService.createModel(ec2Service.getInstances(), ec2Service.getSecurityGroups());
	}
}

Create Model with instances and securityGroups


package org.estatio.module.application.app;

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

import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.Programmatic;

@DomainService(
        nature = NatureOfService.DOMAIN
)
public class CodaDocCodeService {

    @Programmatic
    public List<String> listAll() {
        return Arrays.asList(
                "FR-GEN", "RA-PROF", "MV-DIV", "FR-ART17", "NCR-GEN", "NCR-ART17", "MV-DVE"
        );
    }
}

package org.estatio.module.application.app;

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

import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.Programmatic;

@DomainService(
        nature = NatureOfService.DOMAIN
)
public class CodaDocCodeService {

    @Programmatic
    public List<String> listAll() {
        return Arrays.asList(
                "FR-GEN", "RA-PROF", "MV-DIV", "FR-ART17", "NCR-GEN", "NCR-ART17"
        );
    }
}

Revert "ECP-1090: adds doc code MV-DVE for coda docs to sync"


/*
 * Copyright (C) 2009 Google Inc.
 *
 * 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.google.ase.locale;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.google.ase.Constants;
import com.google.ase.IntentBuilders;

public class LocaleReceiver extends BroadcastReceiver {

  @Override
  public void onReceive(Context context, Intent intent) {
    String scriptName = intent.getStringExtra(Constants.EXTRA_SCRIPT_NAME);
    Log.v("LocaleReceiver", "Locale initiated launch of " + scriptName);
    context.startService(IntentBuilders.buildStartInTerminalIntent(scriptName));
  }
}

/*
 * Copyright (C) 2009 Google Inc.
 *
 * 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.google.ase.locale;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.google.ase.Constants;
import com.google.ase.IntentBuilders;

public class LocaleReceiver extends BroadcastReceiver {

  @Override
  public void onReceive(Context context, Intent intent) {
    String scriptName = intent.getStringExtra(Constants.EXTRA_SCRIPT_NAME);
    Log.v("LocaleReceiver", "Locale initiated launch of " + scriptName);
    context.startActivity(IntentBuilders.buildStartInTerminalIntent(scriptName));
  }
}

Fix bug that prevents Locale from launching scripts.