package org.opentosca.toscana.cli.commands.transformation;

import java.io.IOException;

import org.opentosca.toscana.cli.ApiController;

import picocli.CommandLine.Command;

@Command(name = "info",
    description = {"Information about the specific Transformation"},
    customSynopsis = {"@|bold toscana transformation info|@ @|yellow -c=<name>|@ @|yellow -p=<name>|@ [@|yellow -mv|@]",
        "   or: @|bold toscana transformation info|@ @|yellow -t=<csar/platform>|@ [@|yellow -mv|@]%n"})
public class TransformationInfo extends AbstractTransformation implements Runnable {

    /**
     shows available Information about a specified Transformations
     */
    public TransformationInfo() {
    }

    @Override
    public void run() {
        ApiController api = startApi();

        try {
            final String[] entered = getInput();
            if (entered != null) {
                System.out.println(api.startTransformation(entered[0], entered[1]));
            }
        } catch (IOException e) {
            System.err.println(e.getMessage());
        }
    }
}

package org.opentosca.toscana.cli.commands.transformation;

import java.io.IOException;

import org.opentosca.toscana.cli.ApiController;

import picocli.CommandLine.Command;

@Command(name = "info",
    description = {"Information about the specific Transformation"},
    customSynopsis = {"@|bold toscana transformation info|@ @|yellow -c=<name>|@ @|yellow -p=<name>|@ [@|yellow -mv|@]",
        "   or: @|bold toscana transformation info|@ @|yellow -t=<csar/platform>|@ [@|yellow -mv|@]%n"})
public class TransformationInfo extends AbstractTransformation implements Runnable {

    /**
     shows available Information about a specified Transformations
     */
    public TransformationInfo() {
    }

    @Override
    public void run() {
        ApiController api = startApi();

        try {
            final String[] entered = getInput();
            if (entered != null) {
                System.out.println(api.infoTransformation(entered[0], entered[1]));
            }
        } catch (IOException e) {
            System.err.println(e.getMessage());
        }
    }
}

Fix cli transformation info starts transformation


/*
 * Copyright 2015 Open Networking Laboratory
 *
 * 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.onosproject.store.intent.impl;

import org.onosproject.net.intent.IntentData;
import org.onosproject.store.Timestamp;
import org.onosproject.store.impl.ClockService;

/**
 * ClockService that uses IntentData versions as timestamps.
 */
public class IntentDataClockManager<K> implements ClockService<K, IntentData> {
    @Override
    public Timestamp getTimestamp(K key, IntentData intentData) {
        return intentData.version();
    }
}

/*
 * Copyright 2015 Open Networking Laboratory
 *
 * 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.onosproject.store.intent.impl;

import org.onosproject.net.intent.IntentData;
import org.onosproject.store.Timestamp;
import org.onosproject.store.impl.ClockService;
import org.onosproject.store.impl.MultiValuedTimestamp;

/**
 * ClockService that uses IntentData versions as timestamps.
 */
public class IntentDataClockManager<K> implements ClockService<K, IntentData> {
    @Override
    public Timestamp getTimestamp(K key, IntentData intentData) {
        return new MultiValuedTimestamp<>(intentData.version(), System.nanoTime());
    }
}

Fix entries getting stuck in the pending map.


/*
 * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg
 *
 * 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.b2international.snowowl.core.domain;

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

/**
 * @since 7.7
 */
public final class SetMembers extends PageableCollectionResource<SetMember> {

	private static final long serialVersionUID = 1L;

	public SetMembers(int limit, int total) {
		super(Collections.emptyList(), null, limit, total);
	}

	public SetMembers(List<SetMember> items, String searchAfter, int limit, int total) {
		super(items, searchAfter, limit, total);
	}

}

/*
 * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg
 *
 * 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.b2international.snowowl.core.domain;

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

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

/**
 * @since 7.7
 */
public final class SetMembers extends PageableCollectionResource<SetMember> {

	private static final long serialVersionUID = 1L;

	public SetMembers(int limit, int total) {
		super(Collections.emptyList(), null, limit, total);
	}

	@JsonCreator
	public SetMembers(
			@JsonProperty("items") List<SetMember> items,
			@JsonProperty("searchAfter") String searchAfter,
			@JsonProperty("limit") int limit,
			@JsonProperty("total") int total) {
		super(items, searchAfter, limit, total);
	}

}

Add JSON deserialization annotations to collection resource


/*
 *
 *  Copyright (c) 2017 Otávio Santana and others
 *   All rights reserved. This program and the accompanying materials
 *   are made available under the terms of the Eclipse Public License v1.0
 *   and Apache License v2.0 which accompanies this distribution.
 *   The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 *   and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
 *
 *   You may elect to redistribute this code under either of these licenses.
 *
 *   Contributors:
 *
 *   Otavio Santana
 *
 */
package org.jnosql.diana.api.key;

import java.util.List;
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.stream.StreamSupport;

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

final class KeyValueQueryParserServiceLoader {

    private static final List<KeyValueQueryParser> LOADERS;

    static final Optional<KeyValueQueryParser> INSTANCE;

    private static final String MESSAGE = "Could not found an implementation of ColumnQueryParser in service loader.";

    static {
        ServiceLoader<KeyValueQueryParser> serviceLoader = ServiceLoader.load(KeyValueQueryParser.class);
        LOADERS = StreamSupport.stream(serviceLoader.spliterator(), false).collect(toList());
        INSTANCE = LOADERS.stream().findFirst();
    }

    private KeyValueQueryParserServiceLoader() {
    }

    static KeyValueQueryParser getInstance() {
        return INSTANCE.orElseThrow(() -> new IllegalStateException(MESSAGE));
    }
}

/*
 *
 *  Copyright (c) 2017 Otávio Santana and others
 *   All rights reserved. This program and the accompanying materials
 *   are made available under the terms of the Eclipse Public License v1.0
 *   and Apache License v2.0 which accompanies this distribution.
 *   The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 *   and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
 *
 *   You may elect to redistribute this code under either of these licenses.
 *
 *   Contributors:
 *
 *   Otavio Santana
 *
 */
package org.jnosql.diana.api.key;

import java.util.List;
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.stream.StreamSupport;

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

final class KeyValueQueryParserServiceLoader {

    private static final List<KeyValueQueryParser> LOADERS;

    static final Optional<KeyValueQueryParser> INSTANCE;

    private static final String MESSAGE = "Could not found an implementation of KeyValueQueryParser in service loader.";

    static {
        ServiceLoader<KeyValueQueryParser> serviceLoader = ServiceLoader.load(KeyValueQueryParser.class);
        LOADERS = StreamSupport.stream(serviceLoader.spliterator(), false).collect(toList());
        INSTANCE = LOADERS.stream().findFirst();
    }

    private KeyValueQueryParserServiceLoader() {
    }

    static KeyValueQueryParser getInstance() {
        return INSTANCE.orElseThrow(() -> new IllegalStateException(MESSAGE));
    }
}

Fix Exception Message on Key-Valeu Query Service Loader


package com.peak.salut;

import android.util.Log;
import com.arasthel.asyncjob.AsyncJob;

import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.net.Socket;

public class BackgroundDataJob implements AsyncJob.OnBackgroundJob{

    private Salut salutInstance;
    private Socket clientSocket;
    private String data;

    public BackgroundDataJob(Salut salutInstance, Socket clientSocket)
    {
        this.clientSocket = clientSocket;
        this.salutInstance = salutInstance;
    }

    @Override
    public void doOnBackground() {
        try
        {
            //If this code is reached, a client has connected and transferred data.
            Log.v(Salut.TAG, "A device is sending data...");
            BufferedInputStream bufferedRead = new BufferedInputStream(clientSocket.getInputStream());
            DataInputStream dataStreamFromOtherDevice = new DataInputStream(bufferedRead);
            data = dataStreamFromOtherDevice.readUTF();
            dataStreamFromOtherDevice.close();

            Log.d(Salut.TAG, "\nSuccessfully received data.\n");

            if(!data.isEmpty())
            {
                salutInstance.dataReceiver.currentContext.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        salutInstance.dataReceiver.dataCallback.onDataReceived(data);
                    }
                });
            }
        }
        catch(Exception ex)
        {
            Log.e(Salut.TAG, "An error occurred while trying to receive data.");
            ex.printStackTrace();
        }
        finally {
            try
            {
                clientSocket.close();
            }
            catch (Exception ex)
            {
                Log.e(Salut.TAG, "Failed to close data socket.");
            }
        }
    }
}

package com.peak.salut;

import android.util.Log;
import com.arasthel.asyncjob.AsyncJob;

import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.net.Socket;

public class BackgroundDataJob implements AsyncJob.OnBackgroundJob{

    private Salut salutInstance;
    private Socket clientSocket;
    private String data;

    public BackgroundDataJob(Salut salutInstance, Socket clientSocket)
    {
        this.clientSocket = clientSocket;
        this.salutInstance = salutInstance;
    }

    @Override
    public void doOnBackground() {
        try
        {
            //If this code is reached, a client has connected and transferred data.
            Log.v(Salut.TAG, "A device is sending data...");
            BufferedInputStream bufferedRead = new BufferedInputStream(clientSocket.getInputStream());
            DataInputStream dataStreamFromOtherDevice = new DataInputStream(bufferedRead);
            data = dataStreamFromOtherDevice.readUTF();
            dataStreamFromOtherDevice.close();

            Log.d(Salut.TAG, "\nSuccessfully received data.\n");

            if(!data.isEmpty())
            {
                salutInstance.dataReceiver.dataCallback.onDataReceived(data);
            }
        }
        catch(Exception ex)
        {
            Log.e(Salut.TAG, "An error occurred while trying to receive data.");
            ex.printStackTrace();
        }
        finally {
            try
            {
                clientSocket.close();
            }
            catch (Exception ex)
            {
                Log.e(Salut.TAG, "Failed to close data socket.");
            }
        }
    }
}

Fix to remove Activity as necessary arg


package org.bouncycastle.crypto.tls;

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

/**
 * A generic class for ciphersuites in TLS 1.0.
 */
abstract class TlsCipherSuite
{
    protected static final short KE_RSA = 1;
    protected static final short KE_RSA_EXPORT = 2;
    protected static final short KE_DHE_DSS = 3;
    protected static final short KE_DHE_DSS_EXPORT = 4;
    protected static final short KE_DHE_RSA = 5;
    protected static final short KE_DHE_RSA_EXPORT = 6;
    protected static final short KE_DH_DSS = 7;
    protected static final short KE_DH_RSA = 8;
    protected static final short KE_DH_anon = 9;
    protected static final short KE_SRP = 10;
    protected static final short KE_SRP_RSA = 11;
    protected static final short KE_SRP_DSS = 12;

    protected abstract TlsCipher createCipher(byte[] ms, byte[] cr, byte[] sr);

    protected abstract void skipServerCertificate() throws IOException;
    protected abstract void processServerCertificate(Certificate serverCertificate,
        CertificateVerifyer verifyer) throws IOException;

    protected abstract void processServerKeyExchange(InputStream is, byte[] cr, byte[] sr)
        throws IOException;
    protected abstract void skipServerKeyExchange() throws IOException;

    protected abstract byte[] generateClientKeyExchange() throws IOException;

    protected abstract byte[] getPremasterSecret();
}

package org.bouncycastle.crypto.tls;

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

/**
 * A generic class for ciphersuites in TLS 1.0.
 */
abstract class TlsCipherSuite
{
    protected static final short KE_RSA = 1;
    protected static final short KE_RSA_EXPORT = 2;
    protected static final short KE_DHE_DSS = 3;
    protected static final short KE_DHE_DSS_EXPORT = 4;
    protected static final short KE_DHE_RSA = 5;
    protected static final short KE_DHE_RSA_EXPORT = 6;
    protected static final short KE_DH_DSS = 7;
    protected static final short KE_DH_RSA = 8;
    protected static final short KE_DH_anon = 9;
    protected static final short KE_SRP = 10;
    protected static final short KE_SRP_RSA = 11;
    protected static final short KE_SRP_DSS = 12;

    protected abstract void skipServerCertificate() throws IOException;
    protected abstract void processServerCertificate(Certificate serverCertificate,
        CertificateVerifyer verifyer) throws IOException;

    protected abstract void skipServerKeyExchange() throws IOException;
    protected abstract void processServerKeyExchange(InputStream is, byte[] cr, byte[] sr)
        throws IOException;

    protected abstract byte[] generateClientKeyExchange() throws IOException;

    protected abstract byte[] getPremasterSecret();

    protected abstract TlsCipher createCipher(byte[] ms, byte[] cr, byte[] sr);
}

Reorder methods to match the order TlsProtocolHandler will call them during handshake


package eu.lestard.easydi;

import org.junit.Before;
import org.junit.Test;

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

/**
 * This test is used to verify the behaviour of EasyDI dealing with interfaces.
 */
public class InterfaceTest {

    public static interface A {
    }

    public static interface B {
    }

    public static class ExampleOne implements A{
    }

    public static class ExampleTwo implements A, B {
    }

    private EasyDI easyDI;

    @Before
    public void setup() throws Exception{
        easyDI = new EasyDI();
    }

    @Test
    public void success_withBinding(){
        easyDI.bindInterface(A.class, ExampleOne.class);

        final A instance = easyDI.getInstance(A.class);
        assertThat(instance).isNotNull().isInstanceOf(ExampleOne.class);
    }

    @Test(expected = IllegalStateException.class)
    public void fail_noBinding(){
        easyDI.getInstance(A.class);
    }

    @Test
    public void success_lastBindingIsUsed(){
        easyDI.bindInterface(A.class, ExampleOne.class);
        easyDI.bindInterface(A.class, ExampleTwo.class);

        final A instance = easyDI.getInstance(A.class);
        assertThat(instance).isNotNull().isInstanceOf(ExampleTwo.class);
    }
}

package eu.lestard.easydi;

import org.junit.Before;
import org.junit.Test;

import javax.inject.Singleton;

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

/**
 * This test is used to verify the behaviour of EasyDI dealing with interfaces.
 */
public class InterfaceTest {

    public static interface A {
    }

    public static interface B {
    }

    public static class ExampleOne implements A{
    }

    public static class ExampleTwo implements A, B {
    }

    private EasyDI easyDI;

    @Before
    public void setup() throws Exception{
        easyDI = new EasyDI();
    }

    @Test
    public void success_withBinding(){
        easyDI.bindInterface(A.class, ExampleOne.class);

        final A instance = easyDI.getInstance(A.class);
        assertThat(instance).isNotNull().isInstanceOf(ExampleOne.class);
    }

    @Test(expected = IllegalStateException.class)
    public void fail_noBinding(){
        easyDI.getInstance(A.class);
    }

    @Test
    public void success_lastBindingIsUsed(){
        easyDI.bindInterface(A.class, ExampleOne.class);
        easyDI.bindInterface(A.class, ExampleTwo.class);

        final A instance = easyDI.getInstance(A.class);
        assertThat(instance).isNotNull().isInstanceOf(ExampleTwo.class);
    }

    @Singleton
    public static interface WannabeSingleton {}

    public static class NonSingleton implements WannabeSingleton{}

    /**
     * The {@link javax.inject.Singleton} annotation is ignored when it is added to
     * interfaces.
     */
    @Test
    public void fail_interfacesCantBeMarkedAsSingleton(){

        easyDI.bindInterface(WannabeSingleton.class, NonSingleton.class);

        final WannabeSingleton instanceOne = easyDI.getInstance(WannabeSingleton.class);
        final WannabeSingleton instanceTwo = easyDI.getInstance(WannabeSingleton.class);

        assertThat(instanceOne).isNotSameAs(instanceTwo);
    }
}

Add Test case for Interface with @Singleton annotation


package com.soulgalore.web.performance.navigation.datacollector;

import com.soulgalore.web.performance.navigation.timings.Timing;
import org.openqa.selenium.JavascriptExecutor;

import java.util.Map;

/**
 * Superclass for browser specific data collection, subclass as needed.
 */
public class TimingDataCollector {

    public void collectPageData(JavascriptExecutor js, Map<String, String> pageInfo) {
    }

    public void collectMarks(JavascriptExecutor js, Timing results) {
    }

    public void collectMeasurements(JavascriptExecutor js, Timing results) {
    }

}

package com.soulgalore.web.performance.navigation.datacollector;

import com.soulgalore.web.performance.navigation.timings.Timing;
import org.openqa.selenium.JavascriptExecutor;

import java.util.Map;

/**
 * Superclass for browser specific data collection, subclass as needed.
 */
public abstract class TimingDataCollector {

    public void collectPageData(JavascriptExecutor js, Map<String, String> pageInfo) {
    }

    public void collectMarks(JavascriptExecutor js, Timing results) {
    }

    public void collectMeasurements(JavascriptExecutor js, Timing results) {
    }

}

Make base class for data collectors abstract.


package com.voxelwind.server.game.level.provider.anvil.util;

import com.flowpowered.nbt.ByteTag;
import com.flowpowered.nbt.CompoundMap;
import com.flowpowered.nbt.ShortTag;
import com.voxelwind.api.game.item.ItemStack;
import com.voxelwind.api.game.item.ItemType;
import com.voxelwind.api.game.item.ItemTypes;
import com.voxelwind.server.game.item.VoxelwindItemStack;

public class VoxelwindNBTUtils {
    public static ItemStack createItemStack(CompoundMap map) {
        ByteTag countTag = (ByteTag) map.get("Count");
        ShortTag damageTag = (ShortTag) map.get("Damage");
        ShortTag idTag = (ShortTag) map.get("id");

        // TODO: "tag" compound
        ItemType type = ItemTypes.forId(idTag.getValue());
        return new VoxelwindItemStack(type, countTag.getValue(), type.createDataFor(damageTag.getValue()).orElse(null));
    }
}

package com.voxelwind.server.game.level.provider.anvil.util;

import com.flowpowered.nbt.*;
import com.google.common.base.Preconditions;
import com.voxelwind.api.game.item.ItemStack;
import com.voxelwind.api.game.item.ItemType;
import com.voxelwind.api.game.item.ItemTypes;
import com.voxelwind.server.game.item.VoxelwindItemStack;

public class VoxelwindNBTUtils {
    public static ItemStack createItemStack(CompoundMap map) {
        ByteTag countTag = (ByteTag) map.get("Count");
        ShortTag damageTag = (ShortTag) map.get("Damage");
        ShortTag idTag = (ShortTag) map.get("id");

        // TODO: "tag" compound
        ItemType type = ItemTypes.forId(idTag.getValue());
        return new VoxelwindItemStack(type, countTag.getValue(), type.createDataFor(damageTag.getValue()).orElse(null));
    }

    public static ItemStack[] createItemStacks(ListTag<CompoundTag> tag, int knownSize) {
        ItemStack[] all = new ItemStack[knownSize];
        for (CompoundTag slotTag : tag.getValue()) {
            CompoundMap slotMap = slotTag.getValue();
            Tag<?> inSlotTagRaw = slotMap.get("Slot");
            Preconditions.checkArgument(inSlotTagRaw != null, "Slot NBT tag is missing from compound");
            Preconditions.checkArgument(inSlotTagRaw instanceof ByteTag, "Slot NBT tag is not a Byte");
            ByteTag inSlotTag = (ByteTag) inSlotTagRaw;
            if (inSlotTag.getValue() < 0 || inSlotTag.getValue() >= knownSize) {
                throw new IllegalArgumentException("Found illegal slot " + inSlotTag.getValue());
            }
            all[inSlotTag.getValue()] = createItemStack(slotMap);
        }
        return all;
    }
}

Add NBT block entity inventory deserialization


/*
 * Copyright 2008 The Kuali Foundation.
 *
 * Licensed under the Educational Community License, Version 1.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.opensource.org/licenses/ecl1.php
 *
 * 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.kuali.kfs.module.purap.document.validation.impl;

public class PurchaseOrderSplitDocumentRule extends PurchasingDocumentRuleBase {

}

/*
 * Copyright 2008 The Kuali Foundation.
 *
 * Licensed under the Educational Community License, Version 1.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.opensource.org/licenses/ecl1.php
 *
 * 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.kuali.kfs.module.purap.document.validation.impl;

public class PurchaseOrderSplitDocumentRule extends PurchaseOrderDocumentRule {

}

Change for KULPURAP-2710, PO Split validation


package org.motechproject.nms.api.web.contract.mobileAcademy;

/**
 * API response object for getting course version
 */
public class CourseVersionResponse {

    private int courseVersion;

    public CourseVersionResponse() {
    }

    public CourseVersionResponse(int courseVersion) {

        this.courseVersion = courseVersion;
    }

    public Integer getCourseVersion() {
        return courseVersion;
    }

    public void setCourseVersion(Integer courseVersion) {
        this.courseVersion = courseVersion;
    }
}

package org.motechproject.nms.api.web.contract.mobileAcademy;

/**
 * API response object for getting course version
 */
public class CourseVersionResponse {

    private long courseVersion;

    public CourseVersionResponse() {
    }

    public CourseVersionResponse(long courseVersion) {

        this.courseVersion = courseVersion;
    }

    public Long getCourseVersion() {
        return courseVersion;
    }

    public void setCourseVersion(Long courseVersion) {
        this.courseVersion = courseVersion;
    }
}

Fix a bug in MA tests. Casting version.getMillis to an int resulted in the integer rolling over and returning a negative number


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

import io.atomix.cluster.NodeId;
import io.atomix.utils.Identifier;

import java.util.concurrent.CompletableFuture;

/**
 * Anti-entropy protocol dispatcher.
 */
public interface AntiEntropyProtocolDispatcher<T extends Identifier> extends GossipProtocolDispatcher<T> {

  /**
   * Sends an anti-entropy advertisement.
   *
   * @param identifier the location to which to send the advertisement
   * @param advertisement the anti-entropy advertisement to send
   * @return a future to be completed with the advertisement response
   */
  <K> CompletableFuture<AntiEntropyResponse<K>> advertise(T identifier, AntiEntropyAdvertisement<K> advertisement);

}

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

import io.atomix.utils.Identifier;

import java.util.concurrent.CompletableFuture;

/**
 * Anti-entropy protocol dispatcher.
 */
public interface AntiEntropyProtocolDispatcher<T extends Identifier> extends GossipProtocolDispatcher<T> {

  /**
   * Sends an anti-entropy advertisement.
   *
   * @param identifier the location to which to send the advertisement
   * @param advertisement the anti-entropy advertisement to send
   * @return a future to be completed with the advertisement response
   */
  <K> CompletableFuture<AntiEntropyResponse<K>> advertise(T identifier, AntiEntropyAdvertisement<K> advertisement);

}

Remove cluster dependency from gossip protocols.


package org.apache.beam.runners.spark.structuredstreaming.utils;

import java.util.ArrayList;
import java.util.List;
import org.apache.beam.runners.spark.structuredstreaming.translation.helpers.EncoderHelpers;
import org.apache.beam.sdk.coders.Coder;
import org.apache.beam.sdk.coders.VarIntCoder;
import org.apache.spark.sql.SparkSession;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
/**
 * Test of the wrapping of Beam Coders as Spark ExpressionEncoders.
 */
public class EncodersTest {

  @Test
  public void beamCoderToSparkEncoderTest() {
    SparkSession sparkSession = SparkSession.builder().appName("beamCoderToSparkEncoderTest")
        .master("local[4]").getOrCreate();
    List<Integer> data = new ArrayList<>();
    data.add(1);
    data.add(2);
    data.add(3);
    sparkSession.createDataset(data, EncoderHelpers.fromBeamCoder(VarIntCoder.of()));
//    sparkSession.createDataset(data, EncoderHelpers.genericEncoder());
  }
}

package org.apache.beam.runners.spark.structuredstreaming.utils;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.List;
import org.apache.beam.runners.spark.structuredstreaming.translation.helpers.EncoderHelpers;
import org.apache.beam.sdk.coders.VarIntCoder;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.SparkSession;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
/**
 * Test of the wrapping of Beam Coders as Spark ExpressionEncoders.
 */
public class EncodersTest {

  @Test
  public void beamCoderToSparkEncoderTest() {
    SparkSession sparkSession = SparkSession.builder().appName("beamCoderToSparkEncoderTest")
        .master("local[4]").getOrCreate();
    List<Integer> data = new ArrayList<>();
    data.add(1);
    data.add(2);
    data.add(3);
    Dataset<Integer> dataset = sparkSession
        .createDataset(data, EncoderHelpers.fromBeamCoder(VarIntCoder.of()));
    List<Integer> results = dataset.collectAsList();
    assertEquals(data, results);
  }
}

Add an assert of equality in the encoders test


package com.microsoft.azure.v2.credentials;

import com.google.common.base.Charsets;
import com.google.common.io.CharStreams;
import com.microsoft.azure.v2.credentials.http.MockHttpClient;
import com.microsoft.rest.v2.http.HttpRequest;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStreamReader;

import static org.junit.Assert.*;

public class RefreshTokenClientTests {
    @Test
    public void refreshToken() throws IOException {
        final MockHttpClient httpClient = new MockHttpClient();
        final RefreshTokenClient client = new RefreshTokenClient("http://my.base.url", httpClient);

        client.refreshToken("mockTenant", "mockClientId", "mockResource", "mockRefreshToken", false);

        assertEquals(1, httpClient.requests().size());
        final HttpRequest request = httpClient.requests().get(0);
        assertEquals("POST", request.httpMethod());
        assertEquals("RefreshTokenClient$RefreshTokenService.refreshToken", request.callerMethod());
        assertEquals("http://my.base.url/mockTenant/oauth2/token", request.url());
        assertEquals("client_id=mockClientId&grant_type=refresh_token&resource=mockResource&refresh_token=mockRefreshToken", CharStreams.toString(new InputStreamReader(request.body().createInputStream(), Charsets.UTF_8)));
    }
}

package com.microsoft.azure.v2.credentials;

import com.google.common.base.Charsets;
import com.google.common.io.CharStreams;
import com.microsoft.azure.v2.credentials.http.MockHttpClient;
import com.microsoft.rest.v2.http.HttpRequest;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStreamReader;

import static org.junit.Assert.*;

public class RefreshTokenClientTests {
    @Test
    public void refreshToken() throws IOException {
        final MockHttpClient httpClient = new MockHttpClient();
        final RefreshTokenClient client = new RefreshTokenClient("http://my.base.url", httpClient);

        client.refreshToken("mockTenant", "mockClientId", "mockResource", "mockRefreshToken", false);

        assertEquals(1, httpClient.requests().size());
        final HttpRequest request = httpClient.requests().get(0);
        assertEquals("POST", request.httpMethod());
        assertEquals("com.microsoft.azure.v2.credentials.RefreshTokenClient$RefreshTokenService.refreshToken", request.callerMethod());
        assertEquals("http://my.base.url/mockTenant/oauth2/token", request.url());
        assertEquals("client_id=mockClientId&grant_type=refresh_token&resource=mockResource&refresh_token=mockRefreshToken", CharStreams.toString(new InputStreamReader(request.body().createInputStream(), Charsets.UTF_8)));
    }
}

Fix type name comparison in credentials test


// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.aws;

/**
 * @author mortent
 */
public class TenantRoles {
    private final String hostRole;
    private final String hostServiceRole;
    private final String containerRole;

    public TenantRoles(String hostRole, String hostServiceRole, String containerRole) {
        this.hostRole = hostRole;
        this.hostServiceRole = hostServiceRole;
        this.containerRole = containerRole;
    }

    public String hostRole() {
        return hostRole;
    }

    public String hostServiceRole() {
        return hostServiceRole;
    }

    public String containerRole() {
        return containerRole;
    }
}

// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.aws;

/**
 * @author mortent
 */
public class TenantRoles {
    private final String hostRole;
    private final String tenantHostServiceRole;
    private final String containerRole;

    public TenantRoles(String hostRole, String tenantHostServiceRole, String containerRole) {
        this.hostRole = hostRole;
        this.tenantHostServiceRole = tenantHostServiceRole;
        this.containerRole = containerRole;
    }

    public String hostRole() {
        return hostRole;
    }

    public String hostServiceRole() {
        return tenantHostServiceRole;
    }

    public String containerRole() {
        return containerRole;
    }
}

Rename host role and host service role


package com.desmond.squarecamera;

import android.support.annotation.NonNull;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;

/**
 * Created by desmond on 4/8/15.
 */
public class ResizeAnimation extends Animation {
    final int mStartLength;
    final int mFinalLength;
    final boolean mIsPortrait;
    final View mView;

    public ResizeAnimation(@NonNull View view, final ImageParameters imageParameters) {
        mStartLength = view.getContext().getResources().getDimensionPixelSize(R.dimen.cover_start_width);
        mFinalLength = imageParameters.getAnimationParameter();
        mIsPortrait = imageParameters.isPortrait();
        mView = view;
    }

    @Override
    protected void applyTransformation(float interpolatedTime, Transformation t) {
        int newLength = (int) (mStartLength + (mFinalLength - mStartLength) * interpolatedTime);

        if (mIsPortrait) {
            mView.getLayoutParams().height = newLength;
        } else {
            mView.getLayoutParams().width = newLength;
        }
        mView.requestLayout();
    }

    @Override
    public void initialize(int width, int height, int parentWidth, int parentHeight) {
        super.initialize(width, height, parentWidth, parentHeight);
    }

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

package com.desmond.squarecamera;

import android.support.annotation.NonNull;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;

/**
 * Created by desmond on 4/8/15.
 */
public class ResizeAnimation extends Animation {
    final int mStartLength;
    final int mFinalLength;
    final boolean mIsPortrait;
    final View mView;

    public ResizeAnimation(@NonNull View view, final ImageParameters imageParameters) {
        mStartLength = view.getContext().getResources().getDimensionPixelSize(R.dimen.cover_start_width);
        mFinalLength = imageParameters.getAnimationParameter();
        mIsPortrait = imageParameters.isPortrait();
        mView = view;
    }

    @Override
    protected void applyTransformation(float interpolatedTime, Transformation t) {
        int newLength = (int) (mStartLength + (mFinalLength - mStartLength) * interpolatedTime);

        if (mIsPortrait) {
            mView.getLayoutParams().height = newLength;
        } else {
            mView.getLayoutParams().width = newLength;
        }
    }

    @Override
    public void initialize(int width, int height, int parentWidth, int parentHeight) {
        super.initialize(width, height, parentWidth, parentHeight);
    }

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

Remove a double call to requestLayout in applyTransformation


package com.handson.rx;

import com.handson.infra.EventStreamClient;
import com.handson.infra.RxNettyEventEventStreamClient;
import rx.schedulers.Schedulers;

import java.io.IOException;

public class Application {

    public static void main(String[] args) throws IOException {
        EventStreamClient forexEventStreamClient = new RxNettyEventEventStreamClient(8096);
        ForexServer forexServer = new ForexServer(8080, forexEventStreamClient);
        forexServer.createServer().start();

        EventStreamClient stockEventStreamClient = new RxNettyEventEventStreamClient(8097);

        StockQuoteServer stockQuoteServer = new StockQuoteServer(8081, stockEventStreamClient, forexEventStreamClient, Schedulers.immediate());
        stockQuoteServer.createServer().start();

        EventStreamClient tradeEventStreamClient = new RxNettyEventEventStreamClient(8098);
        VwapServer vwapServer = new VwapServer(8082, tradeEventStreamClient, Schedulers.immediate());
        vwapServer.createServer().start();

        System.out.println("Servers ready!");
        System.out.println("Press any key to exit");
        //new RxNettyEventEventStreamClient(8080).readServerSideEvents().toBlocking().forEach(System.out::println);
        System.in.read();
    }
}

package com.handson.rx;

import com.handson.infra.EventStreamClient;
import com.handson.infra.RxNettyEventEventStreamClient;
import rx.schedulers.Schedulers;

import java.io.IOException;

public class Application {

    public static void main(String[] args) throws IOException {
        EventStreamClient forexEventStreamClient = new RxNettyEventEventStreamClient(8096);
        ForexServer forexServer = new ForexServer(8080, forexEventStreamClient);
        forexServer.createServer().start();

        EventStreamClient stockEventStreamClient = new RxNettyEventEventStreamClient(8097);

        StockQuoteServer stockQuoteServer = new StockQuoteServer(8081, stockEventStreamClient, forexEventStreamClient, Schedulers.newThread());
        stockQuoteServer.createServer().start();

        EventStreamClient tradeEventStreamClient = new RxNettyEventEventStreamClient(8098);
        VwapServer vwapServer = new VwapServer(8082, tradeEventStreamClient, Schedulers.immediate());
        vwapServer.createServer().start();

        System.out.println("Servers ready!");
        System.out.println("Press any key to exit");
        //new RxNettyEventEventStreamClient(8080).readServerSideEvents().toBlocking().forEach(System.out::println);
        System.in.read();
    }
}

Fix bug related to timeout()


/*
 *  Copyright (C) 2016 VSCT
 *
 *  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.vsct.dt.strowgr.admin.template.template;

import java.util.StringJoiner;

public class DefaultTemplates {
    public static final String SYSLOG_DEFAULT_TEMPLATE = new StringJoiner("\n")
            .add("source s_{{application}}_{{platform}} { udp(ip(127.0.0.1) port({{syslog_port}})); };")
            .add("destination d_{{application}}_{{platform}} { file(\"/HOME/hapadm/{{application}}/logs/{{application}}{{platform}}/haproxy.log\", perm(0664)); };")
            .add("log { source(s_{{application}}_{{platform}}); filter(f_local0); destination(d_{{application}}_{{platform}}); };")
            .add("\n")
            .toString();
}

/*
 *  Copyright (C) 2016 VSCT
 *
 *  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.vsct.dt.strowgr.admin.template.template;

import java.util.StringJoiner;

public class DefaultTemplates {
    public static final String SYSLOG_DEFAULT_TEMPLATE = new StringJoiner("\n")
            .add("source s_{{application}}_{{platform}} { udp(ip(127.0.0.1) port({{syslog_port}})); };")
            .add("destination d_{{application}}_{{platform}} { file(\"/HOME/hapadm/{{application}}/logs/{{application}}{{platform}}/haproxy{{application}}{{platform}}.log\", perm(0664)); };")
            .add("log { source(s_{{application}}_{{platform}}); filter(f_local0); destination(d_{{application}}_{{platform}}); };")
            .add("\n")
            .toString();
}

Add {{application}}{{platform}} to log filename


/*
 * 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.ops4j.pax.web.itest.base.client;

public class HttpTestClientFactory {

	/**
	 * creates a default HttpTestClient based on Apache HttpComponents with
	 * some default configuration.
	 *

	 *
Return-Code: 200 OK

	 *
Keystore: src/test/resources/keystore

	 *
Request-Header: Accept-Language=en

	 *

	 * @return Apache HttpComponents HttpTestClient
	 */
	public static HttpTestClient createHttpComponentsTestClient(){
		return new HttpComponentsTestClient()
			.withKeystore("src/test/resources/keystore", "admin", "admin")
			.addRequestHeader("Acccept-Language", "en")
			.withReturnCode(200);
	}

}

/*
 * 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.ops4j.pax.web.itest.base.client;

public class HttpTestClientFactory {

	/**
	 * creates a default HttpTestClient based on Apache HttpComponents with
	 * some default configuration.
	 *

	 *
Return-Code: 200 OK

	 *
Keystore: src/test/resources/keystore

	 *
Request-Header: Accept-Language=en

	 *

	 * @return Apache HttpComponents HttpTestClient
	 */
	public static HttpTestClient createHttpComponentsTestClient(){
		return new HttpComponentsTestClient()
			.withKeystore("src/test/resources/keystore", "admin", "admin")
			.addRequestHeader("Accept-Language", "en")
			.withReturnCode(200);
	}

}

Fix typo in Accept-Language header


// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

package com.yahoo.vespa.hosted.node.admin.task.util.process;

import static com.yahoo.vespa.hosted.node.admin.task.util.file.IOExceptionUtil.uncheck;

/**
 * @author hakonhall
 */
public class ProcessStarterImpl implements ProcessStarter {
    @Override
    public ProcessApi2 start(ProcessBuilder processBuilder) {
        Process process = uncheck(() -> processBuilder.start());
        return new ProcessApi2Impl(process);
    }
}

// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

package com.yahoo.vespa.hosted.node.admin.task.util.process;

import com.yahoo.log.LogLevel;

import java.util.logging.Logger;

import static com.yahoo.vespa.hosted.node.admin.task.util.file.IOExceptionUtil.uncheck;

/**
 * @author hakonhall
 */
public class ProcessStarterImpl implements ProcessStarter {
    private static final Logger logger = Logger.getLogger(ProcessStarterImpl.class.getName());

    @Override
    public ProcessApi2 start(ProcessBuilder processBuilder) {
        if (logger.isLoggable(LogLevel.DEBUG)) {
            logger.log(LogLevel.DEBUG, "Spawning process: " + processBuilder.command());
        }

        Process process = uncheck(() -> processBuilder.start());
        return new ProcessApi2Impl(process);
    }
}

Add debug of all spawned processes


package ca.corefacility.bioinformatics.irida.ria.web.models.datatables;

import java.util.Date;

import ca.corefacility.bioinformatics.irida.model.announcements.Announcement;
import ca.corefacility.bioinformatics.irida.model.user.User;
import ca.corefacility.bioinformatics.irida.ria.web.components.datatables.models.DataTablesResponseModel;

/**
 * User interface model for DataTables for administration of {@link Announcement}
 */
public class DTAnnouncementAdmin implements DataTablesResponseModel {
	private Long id;
	private String message;
	private Date createdDate;
	private User user;

	public DTAnnouncementAdmin(Announcement announcement) {
		this.id = announcement.getId();
		// Only display the first line of the message.
		this.message = announcement.getMessage().split("\\r?\\n")[0];
		this.createdDate = announcement.getCreatedDate();
		this.user = announcement.getUser();
	}

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

	public String getMessage() {
		return message;
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public User getUser() {
		return user;
	}
}

package ca.corefacility.bioinformatics.irida.ria.web.models.datatables;

import java.util.Date;

import ca.corefacility.bioinformatics.irida.model.announcements.Announcement;
import ca.corefacility.bioinformatics.irida.model.user.User;
import ca.corefacility.bioinformatics.irida.ria.web.components.datatables.models.DataTablesResponseModel;

/**
 * User interface model for DataTables for administration of {@link Announcement}
 */
public class DTAnnouncementAdmin implements DataTablesResponseModel {
	private Long id;
	private String message;
	private Date createdDate;
	private User user;

	public DTAnnouncementAdmin(Announcement announcement) {
		this.id = announcement.getId();
		// Only display the first line of the message.
		this.message = announcement.getMessage().split("\\r?\\n")[0];
		if(this.message.length() > 80){
			// If the message is still really long just take a substring of it.
			this.message = this.message.substring(0, 79) + " ...";
		}
		this.createdDate = announcement.getCreatedDate();
		this.user = announcement.getUser();
	}

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

	public String getMessage() {
		return message;
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public User getUser() {
		return user;
	}
}

Truncate really long message previews


/*
 * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. 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.wso2.carbon.messaging;

import java.util.Map;

/**
 * An interface which represents the message after loading in to memory (After first built)
 */
public interface MessageDataSource {

    public String getValueAsString(String path);

    public String getValueAsString(String path, Map<String, String> properties);

    public Object getValue(String path);

    public Object getDataObject();

    public String getContentType();

    public void setContentType(String type);

    public void serializeData();

}

/*
 * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. 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.wso2.carbon.messaging;

import java.util.Map;

/**
 * An interface which represents the message after loading in to memory (After first built)
 */
public interface MessageDataSource {

    public String getValueAsString(String path);

    public String getValueAsString(String path, Map<String, String> properties);

    public Object getValue(String path);

    public Object getDataObject();

    public String getContentType();

    public void setContentType(String type);

    public void serializeData();

    public String getMessageAsString();

}

Add method to get the content as a string which is required for message manipulations in runtime


package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_1_9_r1__1_9_r2__1_10__1_11;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddlePosition;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.protocol.serializer.VarNumberSerializer;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class Position extends MiddlePosition {

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData(ProtocolVersion version) {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_POSITION_ID, version);
		serializer.writeDouble(x);
		serializer.writeDouble(y);
		serializer.writeDouble(z);
		serializer.writeFloat(yaw);
		serializer.writeFloat(pitch);
		serializer.writeByte(flags);
		VarNumberSerializer.writeVarInt(serializer, teleportConfirmId);
		return RecyclableSingletonList.create(serializer);
	}

}

package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_1_9_r1__1_9_r2__1_10__1_11;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddlePosition;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.protocol.serializer.VarNumberSerializer;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class Position extends MiddlePosition {

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData(ProtocolVersion version) {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_POSITION_ID, version);
		serializer.writeDouble(xOrig);
		serializer.writeDouble(yOrig);
		serializer.writeDouble(zOrig);
		serializer.writeFloat(yawOrig);
		serializer.writeFloat(pitchOrig);
		serializer.writeByte(flags);
		VarNumberSerializer.writeVarInt(serializer, teleportConfirmId);
		return RecyclableSingletonList.create(serializer);
	}

}

Write original coords for versions that support position flags


/*
 * Bytecode Analysis Framework
 * Copyright (C) 2003, University of Maryland
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package edu.umd.cs.daveho.ba;

public interface Debug {
    /**
     * Set this to true to enable data structure integrity checks.
     * These checks are somewhat expensive, but hey, computers are fast.
     */
    public static final boolean VERIFY_INTEGRITY = false /*true*/;
}

/*
 * Bytecode Analysis Framework
 * Copyright (C) 2003, University of Maryland
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package edu.umd.cs.daveho.ba;

public interface Debug {
    /**
     * Set this to true to enable data structure integrity checks.
     * These checks are somewhat expensive, but hey, computers are fast.
     */
    public static final boolean VERIFY_INTEGRITY = Boolean.getBoolean("cfg.verifyIntegrity");
}

Use a property to set VERIFY_INTEGRITY.


/*
 * 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.commons.math.analysis;

import java.io.Serializable;

import org.apache.commons.math.FunctionEvaluationException;

/**
 * An interface representing a multivariate matrix function.
 * @version $Revision$ $Date$
 * @since 2.0
 */
public interface MultivariateMatrixFunction extends Serializable {

    /**
     * Compute the value for the function at the given point.
     * @param point point at which the function must be evaluated
     * @return function value for the given point
     * @exception FunctionEvaluationException if the function evaluation fails
     * @exception IllegalArgumentException if points dimension is wrong
     */
    double[][] value(double[] point)
        throws FunctionEvaluationException, IllegalArgumentException;

}

/*
 * 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.commons.math.analysis;

import org.apache.commons.math.FunctionEvaluationException;

/**
 * An interface representing a multivariate matrix function.
 * @version $Revision$ $Date$
 * @since 2.0
 */
public interface MultivariateMatrixFunction {

    /**
     * Compute the value for the function at the given point.
     * @param point point at which the function must be evaluated
     * @return function value for the given point
     * @exception FunctionEvaluationException if the function evaluation fails
     * @exception IllegalArgumentException if points dimension is wrong
     */
    double[][] value(double[] point)
        throws FunctionEvaluationException, IllegalArgumentException;

}

Drop Serializable. Interface is new to 2.0, and not implemented except in test code, so no need to do anything further


/*
 * 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.rave.rest.interceptor;

import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import org.apache.rave.rest.model.JsonResponseWrapper;

/**
 * Created with IntelliJ IDEA.
 * User: erinnp
 * Date: 7/22/13
 * Time: 4:56 PM
 * To change this template use File | Settings | File Templates.
 */
public class JsonResponseWrapperInterceptor extends AbstractPhaseInterceptor<Message> {

    public JsonResponseWrapperInterceptor() {
        super(Phase.WRITE);
    }

    @Override
    public void handleMessage(Message message) throws Fault {
        Object o = message.getContent(Object.class);

        JsonResponseWrapper wrapper = new JsonResponseWrapper(o);

        message.setContent(JsonResponseWrapper.class, wrapper);
    }
}

Add apache headers to interceptor


package org.jboss.as.test.clustering.twoclusters.bean.common;

import org.jboss.as.test.clustering.twoclusters.bean.SerialBean;

import javax.annotation.PostConstruct;
import javax.ejb.Remove;
import java.util.logging.Level;
import java.util.logging.Logger;

public class CommonStatefulSBImpl implements CommonStatefulSB {

    private SerialBean bean;
    private static final Logger log = Logger.getLogger(CommonStatefulSBImpl.class.getName());

    @PostConstruct
    private void init() {
        bean = new SerialBean();
        log.log(Level.INFO, "New SFSB created: {0}.", this);
    }

    @Override
    public int getSerial() {
        log.log(Level.INFO, "getSerial() called on non-forwarding node " + getCurrentNode());
        return bean.getSerial();
    }

    @Override
    public int getSerialAndIncrement() {
        log.log(Level.INFO, "getSerialAndIncrement() called on non-forwarding node " + getCurrentNode());
        return bean.getSerialAndIncrement();
    }

    @Override
    public byte[] getCargo() {
        log.log(Level.INFO, "getCargo() called on non-forwarding node " + getCurrentNode());
        return bean.getCargo();
    }

    @Remove
    private void destroy() {
        // Let the container do the work.
    }

    private String getCurrentNode() {
        return System.getProperty("jboss.node.name", "unknown");
    }
}

package org.jboss.as.test.clustering.twoclusters.bean.common;

import org.jboss.as.test.clustering.twoclusters.bean.SerialBean;

import javax.annotation.PostConstruct;
import javax.ejb.Remove;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import java.util.logging.Level;
import java.util.logging.Logger;

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class CommonStatefulSBImpl implements CommonStatefulSB {

    private SerialBean bean;
    private static final Logger log = Logger.getLogger(CommonStatefulSBImpl.class.getName());

    @PostConstruct
    private void init() {
        bean = new SerialBean();
        log.log(Level.INFO, "New SFSB created: {0}.", this);
    }

    @Override
    public int getSerial() {
        log.log(Level.INFO, "getSerial() called on non-forwarding node " + getCurrentNode());
        return bean.getSerial();
    }

    @Override
    public int getSerialAndIncrement() {
        log.log(Level.INFO, "getSerialAndIncrement() called on non-forwarding node " + getCurrentNode());
        return bean.getSerialAndIncrement();
    }

    @Override
    public byte[] getCargo() {
        log.log(Level.INFO, "getCargo() called on non-forwarding node " + getCurrentNode());
        return bean.getCargo();
    }

    @Remove
    private void destroy() {
        // Let the container do the work.
    }

    private String getCurrentNode() {
        return System.getProperty("jboss.node.name", "unknown");
    }
}

Disable transactions for invocations on RemoteStatefulSB


package com.sometrik.framework;

import android.content.Context;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class FWPicker extends Spinner implements NativeMessageHandler {

  ArrayAdapter<String> adapter;

  public FWPicker(Context context) {
    super(context);
  adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item);
  }

  @Override
  public void handleMessage(NativeMessage message) {

    switch(message.getMessage()){
    case ADD_OPTION:
      adapter.add(message.getTextValue());
      setAdapter(adapter);
      break;
    }
  }

  @Override
  public void showView() {

  }

  @Override
  public int getElementId() {
    return getId();
  }

}

package com.sometrik.framework;

import java.util.ArrayList;
import java.util.TreeMap;

import android.content.Context;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class FWPicker extends Spinner implements NativeMessageHandler {

  ArrayAdapter<String> adapter;
  ArrayList<Integer> numberList;
  TreeMap<Integer, String> valueMap;

  public FWPicker(Context context) {
    super(context);
    adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item);
    valueMap = new TreeMap<Integer, String>();
    numberList = new ArrayList<Integer>();
  }

  @Override
  public void handleMessage(NativeMessage message) {

    switch (message.getMessage()) {
    case ADD_OPTION:
      valueMap.put(message.getValue(), message.getTextValue());
      numberList.add(message.getValue());
      for (int i = 0; i < numberList.size(); i++) {
	adapter.add(valueMap.get(numberList.get(i)));
      }
      setAdapter(adapter);
      break;
    default:
      System.out.println("Message couldn't be handled by Picker");
      break;
    }
  }

  @Override
  public void showView() {

  }

  @Override
  public int getElementId() {
    return getId();
  }

}

Add adapter option number sorting


/**
 * Copyright (c) 2012 committers of YAKINDU and others.
 * 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:
 * 	committers of YAKINDU - initial API and implementation
 *
 */
package org.yakindu.sct.model.stext.ui.validation;

import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.util.CancelIndicator;
import org.eclipse.xtext.validation.ResourceValidatorImpl;
import org.yakindu.sct.model.sgraph.resource.AbstractSCTResource;

/**
 *
 * @author andreas muelder - Initial contribution and API
 *
 */
public class SCTResourceValidatorImpl extends ResourceValidatorImpl {

	@Override
	protected void resolveProxies(final Resource resource,
			final CancelIndicator monitor) {
		if (resource instanceof AbstractSCTResource) {
			((AbstractSCTResource) resource)
					.resolveLazyCrossReferences(monitor);
		}
	}
}

/**
 * Copyright (c) 2012 committers of YAKINDU and others.
 * 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:
 * 	committers of YAKINDU - initial API and implementation
 *
 */
package org.yakindu.sct.model.stext.ui.validation;

import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.util.CancelIndicator;
import org.eclipse.xtext.validation.ResourceValidatorImpl;
import org.yakindu.sct.model.sgraph.resource.AbstractSCTResource;

/**
 *
 * @author andreas muelder - Initial contribution and API
 *
 */
public class SCTResourceValidatorImpl extends ResourceValidatorImpl {

	@Override
	protected void resolveProxies(final Resource resource, final CancelIndicator monitor) {
		if (resource instanceof AbstractSCTResource) {
			((AbstractSCTResource) resource).resolveLazyCrossReferences(monitor);
		} else
			super.resolveProxies(resource, monitor);
	}
}

Call super.resolveProxies when loaded with another resource than AbstractSCtResource


/*
 * 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.camel.component.elasticsearch;

import org.apache.camel.builder.RouteBuilder;
import org.elasticsearch.client.core.MainResponse;
import org.junit.Test;

public class ElasticsearchInfoTest extends ElasticsearchBaseTest {

    @Test
    public void testInfo() throws Exception {
        MainResponse infoResult = template.requestBody("direct:info", "test", MainResponse.class);
        assertNotNull(infoResult.getClusterName());
        assertNotNull(infoResult.getNodeName());
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:info").to("elasticsearch-rest://elasticsearch?operation=Info&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
            }
        };
    }
}

/*
 * 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.camel.component.elasticsearch;

import org.apache.camel.builder.RouteBuilder;
import org.elasticsearch.action.main.MainResponse;
import org.junit.Test;

public class ElasticsearchInfoTest extends ElasticsearchBaseTest {

    @Test
    public void testInfo() throws Exception {
        MainResponse infoResult = template.requestBody("direct:info", "test", MainResponse.class);
        assertNotNull(infoResult.getClusterName());
        assertNotNull(infoResult.getNodeName());
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:info").to("elasticsearch-rest://elasticsearch?operation=Info&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
            }
        };
    }
}

Revert "Fixed ElasticSearchInfoTest after upgrading to 7.3.1"


package org.realityforge.replicant.client;

import arez.Arez;
import arez.annotations.ArezComponent;
import arez.annotations.Observable;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * The Channel object contains the address of the channel and the optional filter for the channel.
 */
@ArezComponent
public abstract class Channel
{
  @Nonnull
  private final ChannelAddress _address;
  @Nullable
  private Object _filter;

  @Nonnull
  public static Channel create( @Nonnull final ChannelAddress address, @Nullable final Object filter )
  {
    return new Arez_Channel( address, filter );
  }

  Channel( @Nonnull final ChannelAddress address, @Nullable final Object filter )
  {
    _address = Objects.requireNonNull( address );
    _filter = filter;
  }

  @Nonnull
  public ChannelAddress getAddress()
  {
    return _address;
  }

  @Observable
  @Nullable
  public Object getFilter()
  {
    return _filter;
  }

  public void setFilter( @Nullable final Object filter )
  {
    _filter = filter;
  }

  @Override
  public String toString()
  {
    if ( Arez.areNamesEnabled() )
    {
      return "Channel[" + _address + " :: Filter=" + FilterUtil.filterToString( _filter ) + "]";
    }
    else
    {
      return super.toString();
    }
  }
}

package org.realityforge.replicant.client;

import arez.Arez;
import arez.annotations.ArezComponent;
import arez.annotations.Observable;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * The Channel object contains the address of the channel and the optional filter for the channel.
 */
@ArezComponent
public abstract class Channel
{
  @Nonnull
  private final ChannelAddress _address;
  @Nullable
  private Object _filter;

  @Nonnull
  public static Channel create( @Nonnull final ChannelAddress address )
  {
    return create( address, null );
  }

  @Nonnull
  public static Channel create( @Nonnull final ChannelAddress address, @Nullable final Object filter )
  {
    return new Arez_Channel( address, filter );
  }

  Channel( @Nonnull final ChannelAddress address, @Nullable final Object filter )
  {
    _address = Objects.requireNonNull( address );
    _filter = filter;
  }

  @Nonnull
  public ChannelAddress getAddress()
  {
    return _address;
  }

  @Observable
  @Nullable
  public Object getFilter()
  {
    return _filter;
  }

  public void setFilter( @Nullable final Object filter )
  {
    _filter = filter;
  }

  @Override
  public String toString()
  {
    if ( Arez.areNamesEnabled() )
    {
      return "Channel[" + _address + " :: Filter=" + FilterUtil.filterToString( _filter ) + "]";
    }
    else
    {
      return super.toString();
    }
  }
}

Add simplified factory for channel


package java.sql;

/**
 *   Stub to keep J9 happy for now
 *
 */
public class SQLException extends Exception {

    SQLException() {
        super();
    }
    SQLException(String s) {
        super(s);
    }

    SQLException(String s, String t) {
        super(s);
    }

    SQLException(String s, String t, int i) {
        super(s);
    }
}

package java.sql;

/**
 *   Stub for now
 *
 */
public class SQLException extends Exception {

    SQLException() {
        super();
    }
    SQLException(String s) {
        super(s);
    }

    SQLException(String s, String t) {
        super(s);
    }

    SQLException(String s, String t, int i) {
        super(s);
    }
}

Remove scandalous besmirchment of J9


package org.metaborg.meta.lang.dynsem.interpreter.nodes.matching;

import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.source.SourceSection;

public abstract class FalseLiteralTermMatchPattern extends LiteralMatchPattern {

	public FalseLiteralTermMatchPattern(SourceSection source) {
		super(source);
	}

	@Specialization
	public boolean doSuccess(boolean b) {
		return b;
	}

}

package org.metaborg.meta.lang.dynsem.interpreter.nodes.matching;

import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.source.SourceSection;

public abstract class FalseLiteralTermMatchPattern extends LiteralMatchPattern {

	public FalseLiteralTermMatchPattern(SourceSection source) {
		super(source);
	}

	@Specialization
	public boolean doSuccess(boolean b) {
		return !b;
	}

}

Fix false boolean match (wrong semantics)


package stexfires.record.mapper.field;

import org.jetbrains.annotations.NotNull;
import stexfires.record.TextField;

import java.util.Objects;

/**
 * @author Mathias Kalb
 * @since 0.1
 */
public class AddPostfixFieldTextMapper implements FieldTextMapper {

    private final String postfix;

    public AddPostfixFieldTextMapper(String postfix) {
        Objects.requireNonNull(postfix);
        this.postfix = postfix;
    }

    @Override
    public final @NotNull String mapToText(@NotNull TextField field) {
        String text = field.text();
        return (text == null) ? postfix : text + postfix;
    }

}

package stexfires.record.mapper.field;

import org.jetbrains.annotations.NotNull;
import stexfires.record.TextField;

import java.util.Objects;

/**
 * @author Mathias Kalb
 * @since 0.1
 */
// TODO Rename Postfix into Suffix
public class AddPostfixFieldTextMapper implements FieldTextMapper {

    private final String postfix;

    public AddPostfixFieldTextMapper(String postfix) {
        Objects.requireNonNull(postfix);
        this.postfix = postfix;
    }

    @Override
    public final @NotNull String mapToText(@NotNull TextField field) {
        String text = field.text();
        return (text == null) ? postfix : text + postfix;
    }

}

Add TODO comment für Postfix


package de.philipphager.disclosure.util.assertion;

public final class Assertions {
  @SuppressWarnings("PMD.UnnecessaryConstructor") private Assertions() {
    //No instances of helper classes.
  }

  public static <T> T ensureNotNull(T t) {
    if (t == null) {
      throw new IllegalStateException("must not be null");
    }
    return t;
  }

  public static <T> T ensureNotNull(T t, String message) {
    if (t == null) {
      throw new IllegalStateException(message);
    }
    return t;
  }
}

package de.philipphager.disclosure.util.assertion;

public final class Assertions {
  @SuppressWarnings("PMD.UnnecessaryConstructor") private Assertions() {
    //No instances of helper classes.
  }

  public static <T> T ensureNotNull(T t) {
    if (t == null) {
      throw new IllegalStateException("must not be null");
    }
    return t;
  }

  public static <T> T ensureNotNull(T t, String message) {
    if (t == null) {
      throw new IllegalStateException(message);
    }
    return t;
  }

  public static void check(boolean argument, String message) {
    if (!argument) {
      throw new IllegalStateException(message);
    }
  }
}

Add util assertion method to check a state.


package net.qbar.common.block;

import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.qbar.common.tile.TileBoiler;

public class BlockBoiler extends BlockMachineBase
{
    public BlockBoiler()
    {
        super("boiler", Material.IRON);
    }

    @Override
    public TileEntity createNewTileEntity(final World worldIn, final int meta)
    {
        return new TileBoiler();
    }
}

package net.qbar.common.block;

import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.qbar.common.tile.TileBoiler;
import net.qbar.common.util.FluidUtils;

public class BlockBoiler extends BlockMachineBase
{
    public BlockBoiler()
    {
        super("boiler", Material.IRON);
    }

    @Override
    public boolean onBlockActivated(final World w, final BlockPos pos, final IBlockState state,
            final EntityPlayer player, final EnumHand hand, final EnumFacing facing, final float hitX, final float hitY,
            final float hitZ)
    {
        if (player.isSneaking())
            return false;
        if (!w.isRemote)
        {
            final TileBoiler boiler = (TileBoiler) w.getTileEntity(pos);

            if (boiler != null)
            {
                if (FluidUtils.drainPlayerHand(boiler.getFluidTank().getInternalFluidHandler(), player)
                        || FluidUtils.fillPlayerHand(boiler.getFluidTank().getInternalFluidHandler(), player))
                    return true;
            }
        }
        return false;
    }

    @Override
    public TileEntity createNewTileEntity(final World worldIn, final int meta)
    {
        return new TileBoiler();
    }
}

Add fluidtank hand filling to boiler


package com.conveyal.taui.models;

import java.util.List;

/**
 * Created by matthewc on 3/28/16.
 */
public class Reroute extends Modification {
    public String name;

    public String feed;
    public String[] routes;
    public String[] trips;

    public String fromStop;
    public String toStop;

    public List<AddTripPattern.Segment> segments;

    /** speed of the adjusted segment, km/h, per segment */
    public int[] segmentSpeeds;

    /** dwell time at adjusted stops, seconds */
    public int dwellTime;

    @Override
    public String getType() {
        return "reroute";
    }
}

package com.conveyal.taui.models;

import java.util.List;

/**
 * Created by matthewc on 3/28/16.
 */
public class Reroute extends Modification {
    public String name;

    public String feed;
    public String[] routes;
    public String[] trips;

    public String fromStop;
    public String toStop;

    public List<AddTripPattern.Segment> segments;

    /** speed of the adjusted segment, km/h, per segment */
    public int[] segmentSpeeds;

    /** dwell time at adjusted stops, seconds */
    public int dwellTime;
    public int[] dwellTimes;

    @Override
    public String getType() {
        return "reroute";
    }
}

Add dwell times array to reroute modifications


package org.typemeta.funcj.codec.mpack;

import org.junit.Assert;
import org.typemeta.funcj.codec.TestBase;

import javax.xml.bind.DatatypeConverter;
import java.io.*;

public class MpackCodecTest extends TestBase {

    @Override
    protected <T> void roundTrip(T val, Class<T> clazz) {
        final MpackCodecCore codec = prepareCodecCore(MpackCodecs.mpackCodec());

        final ByteArrayOutputStream baos = new ByteArrayOutputStream();

        codec.encode(clazz, val, baos);

        final byte[] ba = baos.toByteArray();

        if (printData) {
            System.out.println(DatatypeConverter.printHexBinary(ba));
        }

        if (printSizes) {
            System.out.println("Encoded MessagePack " + clazz.getSimpleName() + " data size = " + ba.length + " bytes");
        }

        final ByteArrayInputStream bais = new ByteArrayInputStream(ba);
        final T val2 = codec.decode(clazz, bais);

        if (!printData && !val.equals(val2)) {
            System.out.println(DatatypeConverter.printHexBinary(ba));
        }

        Assert.assertEquals(val, val2);
    }
}

package org.typemeta.funcj.codec.mpack;

import org.junit.Assert;
import org.typemeta.funcj.codec.TestBase;

import javax.xml.bind.DatatypeConverter;
import java.io.*;

public class MpackCodecTest extends TestBase {

    @Override
    protected <T> void roundTrip(T val, Class<T> clazz) {
        final MpackCodecCore codec = prepareCodecCore(MpackCodecs.mpackCodec());

        final ByteArrayOutputStream baos = new ByteArrayOutputStream();

        codec.encode(clazz, val, baos);

        final byte[] ba = baos.toByteArray();

        if (printData()) {
            System.out.println(DatatypeConverter.printHexBinary(ba));
        }

        if (printSizes()) {
            System.out.println("Encoded MessagePack " + clazz.getSimpleName() + " data size = " + ba.length + " bytes");
        }

        final ByteArrayInputStream bais = new ByteArrayInputStream(ba);
        final T val2 = codec.decode(clazz, bais);

        if (!printData() && !val.equals(val2)) {
            System.out.println(DatatypeConverter.printHexBinary(ba));
        }

        Assert.assertEquals(val, val2);
    }
}

Make unit test vars overridable.


package com.clashsoft.hypercube.util;

import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.scene.paint.Material;
import javafx.scene.paint.PhongMaterial;

import java.io.File;

public final class TextureLoader
{
	public static Material material(String domain, String imageSource)
	{
		final PhongMaterial material = new PhongMaterial(Color.WHITE);
		material.setDiffuseMap(load(domain, imageSource));
		return material;
	}

	public static Image load(String domain, String imageSource)
	{
		try
		{
			return new Image(domain + File.separator + imageSource + ".png");
		}
		catch (Exception ex)
		{
			throw new RuntimeException("Cannot load image: " + domain + "/" + imageSource, ex);
		}
	}
}

package com.clashsoft.hypercube.util;

import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.scene.paint.Material;
import javafx.scene.paint.PhongMaterial;

public final class TextureLoader
{
	public static Material material(String domain, String imageSource)
	{
		final PhongMaterial material = new PhongMaterial(Color.WHITE);
		material.setDiffuseMap(load(domain, imageSource));
		return material;
	}

	public static Image load(String domain, String imageSource)
	{
		try
		{
			return new Image(domain + '/' + imageSource + ".png");
		}
		catch (Exception ex)
		{
			throw new RuntimeException("Cannot load image: " + domain + "/" + imageSource, ex);
		}
	}
}

Fix Texture Loading on Windows


/* NEST (New Scala Test)
 * Copyright 2007-2013 LAMP/EPFL
 * @author Grzegorz Kossakowski
 */

package scala.tools.partest.javaagent;

import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;

/**
 * Profiling agent that instruments byte-code to insert calls to
 * {@link scala.tools.partest.instrumented.Profiler#methodCalled(String, String, String)}
 * by using ASM library for byte-code manipulation.
 */
public class ProfilingAgent {
	public static void premain(String args, Instrumentation inst) throws UnmodifiableClassException {
	  // NOTE: we are adding transformer that won't be applied to classes that are already loaded
	  // This should be ok because premain should be executed before main is executed so Scala library
	  // and the test-case itself won't be loaded yet. We rely here on the fact that ASMTransformer does
	  // not depend on Scala library. In case our assumptions are wrong we can always insert call to
	  // inst.retransformClasses.
		inst.addTransformer(new ASMTransformer(), true);
	}
}

/* NEST (New Scala Test)
 * Copyright 2007-2013 LAMP/EPFL
 * @author Grzegorz Kossakowski
 */

package scala.tools.partest.javaagent;

import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;

/**
 * Profiling agent that instruments byte-code to insert calls to
 * {@link scala.tools.partest.instrumented.Profiler#methodCalled(String, String, String)}
 * by using ASM library for byte-code manipulation.
 */
public class ProfilingAgent {
	public static void premain(String args, Instrumentation inst) throws UnmodifiableClassException {
	  // NOTE: we are adding transformer that won't be applied to classes that are already loaded
	  // This should be ok because premain should be executed before main is executed so Scala library
	  // and the test-case itself won't be loaded yet. We rely here on the fact that ASMTransformer does
	  // not depend on Scala library. In case our assumptions are wrong we can always insert call to
	  // inst.retransformClasses.
	  inst.addTransformer(new ASMTransformer(), false);
	}
}

Set `canRetransform` flag to `false` in instrumentation.


package info.u_team.u_team_core.util.registry;

import java.util.function.Supplier;

import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraftforge.fml.RegistryObject;

public class BlockRegistryObject<B extends Block, I extends BlockItem> implements Supplier<B> {

	private final RegistryObject<B> block;
	private final RegistryObject<I> item;

	public BlockRegistryObject(RegistryObject<B> block, RegistryObject<I> item) {
		this.block = block;
		this.item = item;
	}

	@Override
	public B get() {
		return block.get();
	}

	public boolean hasItem() {
		return item.isPresent();
	}

	public I getItem() {
		return item.get();
	}

}

package info.u_team.u_team_core.util.registry;

import java.util.function.Supplier;

import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.RegistryObject;

public class BlockRegistryObject<B extends Block, I extends BlockItem> implements Supplier<B> {

	private final RegistryObject<B> block;
	private final RegistryObject<I> item;

	public BlockRegistryObject(RegistryObject<B> block, RegistryObject<I> item) {
		this.block = block;
		this.item = item;
	}

	public boolean isPresent() {
		return block.isPresent();
	}

	@Override
	public B get() {
		return block.get();
	}

	public ResourceLocation getId() {
		return block.getId();
	}

	public boolean hasItem() {
		return item.isPresent();
	}

	public I getItem() {
		return item.get();
	}

	public ResourceLocation getItemId() {
		return item.getId();
	}

}

Add more getters to block registry object


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

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

public class svq {

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

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

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

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

public class svq {

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

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

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

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

Convert bmp to byte array


package jkind.api.examples;

import java.io.FileReader;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;

import jkind.api.xml.Kind2WebInputStream;
import jkind.api.xml.LineInputStream;

public class Kind2WebExample {
	public static void main(String[] args) throws Exception {
		if (args.length != 2) {
			System.err.println("Usage: Kind2WebExample [url] [filename]");
			return;
		}

		URI uri = new URI(args[0]);
		String filename = args[1];

		try (LineInputStream lines = new LineInputStream(new Kind2WebInputStream(uri,
				getKindArgs(), getLustre(filename)))) {
			String line;
			while ((line = lines.readLine()) != null) {
				System.out.print(line);
			}
		}
	}

	private static List<String> getKindArgs() {
		List<String> args = new ArrayList<>();
		args.add("-xml");
		return args;
	}

	private static String getLustre(String filename) throws IOException {
		try (FileReader reader = new FileReader(filename)) {
			StringBuilder result = new StringBuilder();
			int i;
			while ((i = reader.read()) != -1) {
				result.append((char) i);
			}
			return result.toString();
		}
	}
}

package jkind.api.examples;

import java.io.FileReader;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;

import jkind.api.xml.Kind2WebInputStream;
import jkind.api.xml.LineInputStream;

public class Kind2WebExample {
	public static void main(String[] args) throws Exception {
		if (args.length != 2) {
			System.err.println("Usage: Kind2WebExample [url] [filename]");
			return;
		}

		URI uri = new URI(args[0]);
		String filename = args[1];

		try (LineInputStream lines = new LineInputStream(new Kind2WebInputStream(uri,
				getKindArgs(), getLustre(filename)))) {
			String line;
			while ((line = lines.readLine()) != null) {
				System.out.print(line);
			}
		}
	}

	private static List<String> getKindArgs() {
		List<String> args = new ArrayList<>();
		args.add("-xml");
		args.add("--timeout_wall");
		args.add("100");
		return args;
	}

	private static String getLustre(String filename) throws IOException {
		try (FileReader reader = new FileReader(filename)) {
			StringBuilder result = new StringBuilder();
			int i;
			while ((i = reader.read()) != -1) {
				result.append((char) i);
			}
			return result.toString();
		}
	}
}

Add default time out to Kind 2 web example


// Prevayler(TM) - The Open-Source Prevalence Layer.
// Copyright (C) 2001 Klaus Wuestefeld.
// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.

package org.prevayler.util.clock;

import java.util.Date;

/** A deterministic Clock that always returns the same time until it is forced to advance. A new BrokenClock's time() starts off at new Date(Long.MIN_VALUE);
 */
public class BrokenClock implements Clock, java.io.Serializable {

	protected long _millis = Long.MIN_VALUE;
	private Date _time = new Date(_millis);

	public Date time() { return _time; }

	synchronized void advanceTo(Date newTime) {
		long newMillis = newTime.getTime();
		if (newMillis <= _millis) throw new RuntimeException("A Clock can only be set to the future. Current time: " + _time + " new time: " + newTime);
		_millis = newMillis;
		_time = newTime;
	}

}

// Prevayler(TM) - The Open-Source Prevalence Layer.
// Copyright (C) 2001 Klaus Wuestefeld.
// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.

package org.prevayler.util.clock;

import java.util.Date;

/** A deterministic Clock that always returns the same time until it is forced to advance. A new BrokenClock's time() starts off at new Date(Long.MIN_VALUE);
 */
public class BrokenClock implements Clock, java.io.Serializable {

	protected long _millis = Long.MIN_VALUE;
	private Date _time = new Date(_millis);

	public Date time() { return _time; }

	synchronized void advanceTo(Date newTime) {
		long newMillis = newTime.getTime();
		if (newMillis < _millis) throw new RuntimeException("A Clock can only be set to the future. Current time: " + _time + " new time: " + newTime);
		_millis = newMillis;
		_time = newTime;
	}

}

Allow clock to be set to current time.