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

import org.spine3.Event;

/**
 * Exception that is thrown when unsupported event is obtained
 * or in case there is no class for given Protobuf event message.
 *
 * @author Mikhail Melnik
 */
public class MissingEventApplierException extends RuntimeException {

    public MissingEventApplierException(Event event) {
        super("There is no registered applier for the event: " + event.getEventClass());
    }

    private static final long serialVersionUID = 0L;

}

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

import org.spine3.Event;

/**
 * This exception is thrown on a discovery of an event class, which is not handled by any of
 * the applier methods of an aggregate root class.
 *
 * @author Mikhail Melnik
 */
public class MissingEventApplierException extends RuntimeException {

    public MissingEventApplierException(Event event) {
        super("There is no registered applier for the event: " + event.getEventClass());
    }

    private static final long serialVersionUID = 0L;

}

Adjust Javadoc for the exception.

Adjust Javadoc for the exception.


/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * 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.facebook.litho;

/** Data class for params used to log error in LithoView. */
public class ComponentLogParams {
  public final String logProductId;
  public final String logType;
  public final int samplingFrequency;
  public final boolean failHarder;

  public ComponentLogParams(
      String logProductId, String logType, int samplingFrequency, boolean failHarder) {
    this.logProductId = logProductId;
    this.logType = logType;
    this.samplingFrequency = samplingFrequency;
    this.failHarder = failHarder;
  }

  public ComponentLogParams(String logProductId, String logType) {
    this(logProductId, logType, /* take default*/ 0, false);
  }
}

/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * 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.facebook.litho;

import com.facebook.infer.annotation.Nullsafe;

/** Data class for params used to log error in LithoView. */
@Nullsafe(Nullsafe.Mode.LOCAL)
public class ComponentLogParams {
  public final String logProductId;
  public final String logType;
  public final int samplingFrequency;
  public final boolean failHarder;

  public ComponentLogParams(
      String logProductId, String logType, int samplingFrequency, boolean failHarder) {
    this.logProductId = logProductId;
    this.logType = logType;
    this.samplingFrequency = samplingFrequency;
    this.failHarder = failHarder;
  }

  public ComponentLogParams(String logProductId, String logType) {
    this(logProductId, logType, /* take default*/ 0, false);
  }
}

Annotate clean classes as @Nullsafe:: (7/14) libraries/components/litho-core/src/main/java/com/facebook/litho/

Reviewed By: pasqualeanatriello

Differential Revision: D28505831

fbshipit-source-id: e4831c9e49a9c08a495dacb85c3ed82a5ad1b507


/**
 * Get more info at : www.jrebirth.org .
 * Copyright JRebirth.org © 2011-2013
 * Contact : sebastien.bordes@jrebirth.org
 *
 * 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.jrebirth.core.concurrent;

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

/**
 * This annotation is used to.
 *
 * @author Sébastien Bordes
 */
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface RunInto {

    /**
     * Define the RunType value.
     *
     * The default value is RunType.JIT
     */
    RunType value() default RunType.JIT;
}

/**
 * Get more info at : www.jrebirth.org .
 * Copyright JRebirth.org © 2011-2013
 * Contact : sebastien.bordes@jrebirth.org
 *
 * 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.jrebirth.core.concurrent;

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

/**
 * This annotation is used to.
 *
 * @author Sébastien Bordes
 */
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface RunInto {

    /**
     * Define the RunType value.
     *
     * The default value is RunType.JIT
     */
    RunType value() default RunType.JIT;
}

Document and inherit please :D

Document and inherit please :D


package net.rebworks.lunchy.domain.places;

import net.rebworks.lunchy.domain.Place;
import net.rebworks.lunchy.resources.LunchResource;

import javax.inject.Inject;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import java.net.URI;
import java.util.Arrays;
import java.util.SortedSet;
import java.util.TreeSet;

public class BangkokKitchen implements Place {

    private static final TreeSet<String> ALIASES = new TreeSet<>(Arrays.asList("bangkokkitchen", "bkk", "bkgbg"));
    public static final String NAME = ALIASES.first();

    private final UriInfo uriInfo;

    @Inject
    public BangkokKitchen(@Context final UriInfo uriInfo) {
        this.uriInfo = uriInfo;
    }

    @Override
    public String getName() {
        return NAME;
    }

    @Override
    public SortedSet<String> getAliases() {
        return ALIASES;
    }

    @Override
    public URI getWebsite() {
        return URI.create("http://www.bkgbg.se/lunch");
    }

    @Override
    public URI getUri() {
        return LunchResource.getPlaceURI(uriInfo, NAME);
    }
}

package net.rebworks.lunchy.domain.places;

import net.rebworks.lunchy.domain.Place;
import net.rebworks.lunchy.resources.LunchResource;

import javax.inject.Inject;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import java.net.URI;
import java.util.Arrays;
import java.util.SortedSet;
import java.util.TreeSet;

public class BangkokKitchen implements Place {

    private static final TreeSet<String> ALIASES = new TreeSet<>(Arrays.asList("bangkokkitchen", "bkk", "bkgbg"));
    public static final String NAME = ALIASES.first();

    private final UriInfo uriInfo;

    @Inject
    public BangkokKitchen(@Context final UriInfo uriInfo) {
        this.uriInfo = uriInfo;
    }

    @Override
    public String getName() {
        return "Bangkok Kitchen";
    }

    @Override
    public SortedSet<String> getAliases() {
        return ALIASES;
    }

    @Override
    public URI getWebsite() {
        return URI.create("http://www.bkgbg.se/lunch");
    }

    @Override
    public URI getUri() {
        return LunchResource.getPlaceURI(uriInfo, NAME);
    }
}

Fix the name for Bangkok Kitchen

Fix the name for Bangkok Kitchen


package de.iani.cubequest.quests;

import de.iani.cubequest.Reward;
import de.iani.cubequest.conditions.GameModeCondition;
import de.iani.cubequest.conditions.ServerFlagCondition;
import org.bukkit.GameMode;

public abstract class EconomyInfluencingAmountQuest extends AmountQuest {

    public static final String SURVIVAL_ECONOMY_TAG = "survival_economy";

    public EconomyInfluencingAmountQuest(int id, String name, String displayMessage,
            String giveMessage, String successMessage, Reward successReward, int amount) {
        super(id, name, displayMessage, giveMessage, successMessage, successReward, amount);
        init();
    }

    public EconomyInfluencingAmountQuest(int id, String name, String displayMessage,
            String giveMessage, String successMessage, Reward successReward) {
        super(id, name, displayMessage, giveMessage, successMessage, successReward, 0);
        init();
    }

    public EconomyInfluencingAmountQuest(int id) {
        super(id);
        init();
    }

    private void init() {
        addQuestProgressCondition(new ServerFlagCondition(false, SURVIVAL_ECONOMY_TAG), false);
        addQuestProgressCondition(new GameModeCondition(false, GameMode.SURVIVAL), false);
    }

}

package de.iani.cubequest.quests;

import de.iani.cubequest.Reward;
import de.iani.cubequest.conditions.ServerFlagCondition;

public abstract class EconomyInfluencingAmountQuest extends AmountQuest {

    public static final String SURVIVAL_ECONOMY_TAG = "survival_economy";

    public EconomyInfluencingAmountQuest(int id, String name, String displayMessage,
            String giveMessage, String successMessage, Reward successReward, int amount) {
        super(id, name, displayMessage, giveMessage, successMessage, successReward, amount);
        init();
    }

    public EconomyInfluencingAmountQuest(int id, String name, String displayMessage,
            String giveMessage, String successMessage, Reward successReward) {
        super(id, name, displayMessage, giveMessage, successMessage, successReward, 0);
        init();
    }

    public EconomyInfluencingAmountQuest(int id) {
        super(id);
        init();
    }

    private void init() {
        addQuestProgressCondition(new ServerFlagCondition(false, SURVIVAL_ECONOMY_TAG), false);
    }

}

Remove duplicate default progress condition.


// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.metrics;

import org.chromium.base.metrics.RecordHistogram;

/**
 * Centralizes UMA data collection for Android-specific MediaSession features.
 */
public class MediaSessionUMA {
    // MediaSessionAction defined in tools/metrics/histograms/histograms.xml.
    public static final int MEDIA_SESSION_ACTION_SOURCE_MEDIA_NOTIFICATION = 0;
    public static final int MEDIA_SESSION_ACTION_SOURCE_MAX = 1;

    public static void recordPlay(int action) {
        assert action >= 0 && action < MEDIA_SESSION_ACTION_SOURCE_MAX;
        RecordHistogram.recordEnumeratedHistogram("Media.Session.Play", action,
                MEDIA_SESSION_ACTION_SOURCE_MAX);
    }

    public static void recordPause(int action) {
        assert action >= 0 && action < MEDIA_SESSION_ACTION_SOURCE_MAX;
        RecordHistogram.recordEnumeratedHistogram("Media.Session.Pause", action,
                MEDIA_SESSION_ACTION_SOURCE_MAX);
    }
}

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.metrics;

import org.chromium.base.metrics.RecordHistogram;

/**
 * Centralizes UMA data collection for Android-specific MediaSession features.
 */
public class MediaSessionUMA {
    // MediaSessionAction defined in tools/metrics/histograms/histograms.xml.
    public static final int MEDIA_SESSION_ACTION_SOURCE_MEDIA_NOTIFICATION = 0;
    // TODO(mlamouri): UMA do not handle well enumerations with only one value.
    // Other values will be addede later (like RemoteContro/MediaSession/etc.)
    // interactions but we have to fax the max value for now in order to prevent
    // crashes.
    public static final int MEDIA_SESSION_ACTION_SOURCE_MAX = 2;

    public static void recordPlay(int action) {
        assert action >= 0 && action < MEDIA_SESSION_ACTION_SOURCE_MAX;
        RecordHistogram.recordEnumeratedHistogram("Media.Session.Play", action,
                MEDIA_SESSION_ACTION_SOURCE_MAX);
    }

    public static void recordPause(int action) {
        assert action >= 0 && action < MEDIA_SESSION_ACTION_SOURCE_MAX;
        RecordHistogram.recordEnumeratedHistogram("Media.Session.Pause", action,
                MEDIA_SESSION_ACTION_SOURCE_MAX);
    }
}

Fix crash because of UMA enum with only one value.

UMA code expect enums to have a minimum of 1 and with an enum with only
one value, the maximum would also be 1. It is failing two checks (minimum
being equals to maximum and buckets number being lower than 3).

Setting the maximum to 3 solves the problem. This is a temporary hack
given that we are going to add another value to the enum on trunk.

BUG=522344
TBR=avayvod@chromium.org, jwd@chromium.org, miguelg@chromium.org

Review URL: https://codereview.chromium.org/1298513005

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#344213}


package com.cdrussell.caster.rx.casterrxjava;

import android.os.SystemClock;
import android.util.Log;

class Database {

    private static final String TAG = Database.class.getSimpleName();

    static String readValue() {
        SystemClock.sleep(50);

        for (int i = 0; i < 100; i++) {
            Log.i(TAG, String.format("Reading value: %d%%", i));
            SystemClock.sleep(20);
        }
        Log.i(TAG, "Reading value: 100%");
        return "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.";
    }
}

package com.cdrussell.caster.rx.casterrxjava;

import android.os.SystemClock;
import android.util.Log;

/**
 * Fake database implementation that is slow to return a value.
 */
class Database {

    private static final String TAG = Database.class.getSimpleName();

    static String readValue() {
        SystemClock.sleep(50);

        for (int i = 0; i < 100; i++) {
            Log.i(TAG, String.format("Reading value: %d%%", i));
            SystemClock.sleep(20);
        }
        Log.i(TAG, "Reading value: 100%");

        return "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.";
    }
}

Add class comment detailing class is a fake database


package com.github.macrodata.skyprint.section;

import lombok.Setter;
import lombok.ToString;

import java.util.List;

import static com.github.macrodata.skyprint.section.SectionHelper.*;

@ToString
public class RootSection extends Section {

    @Setter
    private MetadataSection metadata;

    @Setter
    private String name;

    @Setter
    private List<ResourceSection> resources;

    @Setter
    private List<GroupSection> groups;

    public MetadataSection getMetadata() {
        if (metadata == null)
            lazy(this::setMetadata, get(this, MetadataSection.class));
        return metadata;
    }

    public String getName() {
        if (name == null)
            lazy(this::setName, get(this, OverviewSection.class).getName());
        return name;
    }

    @Override
    public String getDescription() {
        if (super.getDescription() == null)
            lazy(this::setDescription, get(this, OverviewSection.class).getDescription());
        return super.getDescription();
    }

    public List<ResourceSection> getResources() {
        if (resources == null)
            lazy(this::setResources, list(this, ResourceSection.class));
        return resources;
    }

    public List<GroupSection> getGroups() {
        if (groups == null)
            lazy(this::setGroups, list(this, GroupSection.class));
        return groups;
    }

}

package com.github.macrodata.skyprint.section;

import lombok.Setter;
import lombok.ToString;

import javax.xml.transform.stream.StreamSource;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;

import static com.github.macrodata.skyprint.section.SectionHelper.*;

@ToString
public class RootSection extends Section {

    @Setter
    private Map<String, String> metadata;

    @Setter
    private String name;

    @Setter
    private List<ResourceSection> resources;

    @Setter
    private List<GroupSection> groups;

    public Map<String, String> getMetadata() {
        if (metadata == null)
            lazy(this::setMetadata, get(this, MetadataSection.class));
        return metadata;
    }

    public String getName() {
        if (name == null)
            lazy(this::setName, get(this, OverviewSection.class).getName());
        return name;
    }

    @Override
    public String getDescription() {
        if (super.getDescription() == null)
            lazy(this::setDescription, get(this, OverviewSection.class).getDescription());
        return super.getDescription();
    }

    public List<ResourceSection> getResources() {
        if (resources == null)
            lazy(this::setResources, list(this, ResourceSection.class));
        return resources;
    }

    public List<GroupSection> getGroups() {
        if (groups == null)
            lazy(this::setGroups, list(this, GroupSection.class));
        return groups;
    }

}

Change metadata type to map

Change metadata type to map


package org.jenkinsci.plugins.codedx.model;

public enum StatisticGroup {
    Unspecified("Unspecified"),
    Info("Info"),
    Low("Low"),
    Medium("Medium"),
    High("High"),

    FalsePositives("False Positives"),
    Ignored("Ignored"),
    Escalated("Escalated"),
    Assigned("Assigned"),
    Fixed("Fixed"),
    Unresolved("Unresolved"),
    New("New");

    private String value;

    private StatisticGroup(String value) {
        this.value = value;
    }

    public String toString() {
        return value;
    }

    public static StatisticGroup forValue(String value) {
        for (StatisticGroup group : StatisticGroup.values()) {
            if (group.value.equals(value)) {
                return group;
            }
        }
        return null;
    }

}

package org.jenkinsci.plugins.codedx.model;

public enum StatisticGroup {
    Unspecified("Unspecified"),
    Info("Info"),
    Low("Low"),
    Medium("Medium"),
    High("High"),

    FalsePositive("False Positive"),
    Ignored("Ignored"),
    Escalated("Escalated"),
    Assigned("Assigned"),
    Fixed("Fixed"),
    Unresolved("Unresolved"),
    New("New");

    private String value;

    private StatisticGroup(String value) {
        this.value = value;
    }

    public String toString() {
        return value;
    }

    public static StatisticGroup forValue(String value) {
        for (StatisticGroup group : StatisticGroup.values()) {
            if (group.value.equals(value)) {
                return group;
            }
        }
        return null;
    }

}

Fix typo that was causing null pointer exceptions


package cpw.mods.fml.common.launcher;

import cpw.mods.fml.relauncher.FMLLaunchHandler;
import net.minecraft.launchwrapper.LaunchClassLoader;

public class FMLServerTweaker extends FMLTweaker {
    @Override
    public String getLaunchTarget()
    {
        return "net.minecraft.server.MinecraftServer";
    }

    @Override
    public void injectIntoClassLoader(LaunchClassLoader classLoader)
    {
        classLoader.addClassLoaderExclusion("com.mojang.util.");
        classLoader.addTransformerExclusion("cpw.mods.fml.repackage.");
        classLoader.addTransformerExclusion("cpw.mods.fml.relauncher.");
        classLoader.addTransformerExclusion("cpw.mods.fml.common.asm.transformers.");
        classLoader.addClassLoaderExclusion("LZMA.");
        FMLLaunchHandler.configureForServerLaunch(classLoader, this);
        FMLLaunchHandler.appendCoreMods();
    }
}

package cpw.mods.fml.common.launcher;

import cpw.mods.fml.relauncher.FMLLaunchHandler;
import net.minecraft.launchwrapper.LaunchClassLoader;

public class FMLServerTweaker extends FMLTweaker {
    @Override
    public String getLaunchTarget()
    {
        return "net.minecraft.server.MinecraftServer";
    }

    @Override
    public void injectIntoClassLoader(LaunchClassLoader classLoader)
    {
        // The mojang packages are excluded so the log4j2 queue is correctly visible from
        // the obfuscated and deobfuscated parts of the code. Without, the UI won't show anything
        classLoader.addClassLoaderExclusion("com.mojang.");
        classLoader.addTransformerExclusion("cpw.mods.fml.repackage.");
        classLoader.addTransformerExclusion("cpw.mods.fml.relauncher.");
        classLoader.addTransformerExclusion("cpw.mods.fml.common.asm.transformers.");
        classLoader.addClassLoaderExclusion("LZMA.");
        FMLLaunchHandler.configureForServerLaunch(classLoader, this);
        FMLLaunchHandler.appendCoreMods();
    }
}

Fix server side to write properly

Fix server side to write properly


package de.craften.craftenlauncher.logic.download;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

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

public class VersionLoader {
    public static List<String> getVersionStringList() {
        String jsonString = DownloadHelper.downloadFileToString("https://s3.amazonaws.com/Minecraft.Download/versions/versions.json");
        JsonObject versionsJson = new Gson().fromJson(jsonString, JsonObject.class);

        List<String> versions = new ArrayList<>();
        for (JsonElement version : versionsJson.getAsJsonArray("versions")) {
            versions.add(version.getAsJsonObject().get("id").getAsString());
        }
        return versions;
    }
}

package de.craften.craftenlauncher.logic.download;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

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

public class VersionLoader {
    private static final Logger LOGGER = LogManager.getLogger(VersionLoader.class);

    public static List<String> getVersionStringList() {
        String jsonString = DownloadHelper.downloadFileToString("https://s3.amazonaws.com/Minecraft.Download/versions/versions.json");
        JsonObject versionsJson = new Gson().fromJson(jsonString, JsonObject.class);

        if (versionsJson != null) {
            List<String> versions = new ArrayList<>();
            for (JsonElement version : versionsJson.getAsJsonArray("versions")) {
                versions.add(version.getAsJsonObject().get("id").getAsString());
            }
            return versions;
        } else {
            LOGGER.warn("Downloading versions list failed, using local versions only");
            return new ArrayList<>(); //TODO cache the versions or throw an exception
        }
    }
}

Fix crash when the launcher is started without internet access.


/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.sip.communicator.impl.neomedia.device;

import javax.media.*;

import net.java.sip.communicator.impl.neomedia.imgstreaming.*;
import net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming.*;

/**
 * Add ImageStreaming capture device.
 *
 * @author Sebastien Vincent
 */
public class ImageStreamingAuto
{
    /**
     * Add capture devices.
     *
     * @throws Exception if problem when adding capture devices
     */
    public ImageStreamingAuto() throws Exception
    {
        String name = "Desktop streaming";
        CaptureDeviceInfo devInfo
            = new CaptureDeviceInfo(
                    name,
                    new MediaLocator(
                            ImageStreamingUtils.LOCATOR_PROTOCOL + ":" + name),
                    DataSource.getFormats());

        /* add to JMF device manager */
        CaptureDeviceManager.addDevice(devInfo);
        CaptureDeviceManager.commit();
    }
}

/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.sip.communicator.impl.neomedia.device;

import javax.media.*;

import net.java.sip.communicator.impl.neomedia.imgstreaming.*;
import net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming.*;

/**
 * Add ImageStreaming capture device.
 *
 * @author Sebastien Vincent
 */
public class ImageStreamingAuto
{
    /**
     * Add capture devices.
     *
     * @throws Exception if problem when adding capture devices
     */
    public ImageStreamingAuto() throws Exception
    {
        String name = "Experimental desktop streaming";
        CaptureDeviceInfo devInfo
            = new CaptureDeviceInfo(
                    name,
                    new MediaLocator(
                            ImageStreamingUtils.LOCATOR_PROTOCOL + ":" + name),
                    DataSource.getFormats());

        /* add to JMF device manager */
        CaptureDeviceManager.addDevice(devInfo);
        CaptureDeviceManager.commit();
    }
}

Change name displayed for desktop streaming device in the media configuration panel.


package io.quarkus.cli.core;

import java.io.BufferedReader;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.util.Properties;

import io.smallrye.common.classloader.ClassPathUtils;
import picocli.CommandLine;

public class QuarkusCliVersion implements CommandLine.IVersionProvider {

    private static String version;

    public static String version() {
        if (version != null) {
            return version;
        }
        final URL quarkusPropsUrl = Thread.currentThread().getContextClassLoader().getResource("quarkus.properties");
        if (quarkusPropsUrl == null) {
            throw new RuntimeException("Failed to locate quarkus.properties on the classpath");
        }
        final Properties props = new Properties();
        ClassPathUtils.consumeAsPath(quarkusPropsUrl, p -> {
            try (BufferedReader reader = Files.newBufferedReader(p)) {
                props.load(reader);
            } catch (IOException e) {
                throw new RuntimeException("Failed to load quarkus.properties", e);
            }
        });
        version = props.getProperty("quarkus-core-version");
        if (version == null) {
            throw new RuntimeException("Failed to locate quarkus-core-version property in the bundled quarkus.properties");
        }
        return version;
    }

    @Override
    public String[] getVersion() throws Exception {
        return new String[] { version() };
    }

}

package io.quarkus.cli.core;

import java.io.BufferedReader;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.util.Properties;

import io.smallrye.common.classloader.ClassPathUtils;
import picocli.CommandLine;

public class QuarkusCliVersion implements CommandLine.IVersionProvider {

    private static String version;

    public static String version() {
        if (version != null) {
            return version;
        }

        final Properties props = new Properties();
        final URL quarkusPropertiesUrl = Thread.currentThread().getContextClassLoader().getResource("quarkus.properties");
        if (quarkusPropertiesUrl == null) {
            throw new RuntimeException("Failed to locate quarkus.properties on the classpath");
        }

        // we have a special case for file and jar as using getResourceAsStream() on Windows might cause file locks
        if ("file".equals(quarkusPropertiesUrl.getProtocol()) || "jar".equals(quarkusPropertiesUrl.getProtocol())) {
            ClassPathUtils.consumeAsPath(quarkusPropertiesUrl, p -> {
                try (BufferedReader reader = Files.newBufferedReader(p)) {
                    props.load(reader);
                } catch (IOException e) {
                    throw new RuntimeException("Failed to load quarkus.properties", e);
                }
            });
        } else {
            try {
                props.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("quarkus.properties"));
            } catch (IOException e) {
                throw new IllegalStateException("Failed to load quarkus.properties", e);
            }
        }

        version = props.getProperty("quarkus-core-version");
        if (version == null) {
            throw new RuntimeException("Failed to locate quarkus-core-version property in the bundled quarkus.properties");
        }

        return version;
    }

    @Override
    public String[] getVersion() throws Exception {
        return new String[] { version() };
    }

}

Simplify loading of Quarkus CLI version

Simplify loading of Quarkus CLI version


package model;

import org.junit.Test;

import static org.junit.Assert.assertNotNull;

/**
 * Tests {@link FileLink FileLink} class.
 *
 * @author Shawn Aten (shawn@filestack.com)
 */
public class TestFileLink {
    private static final String API_KEY = "XXXXXXXXXXXXXXXXXXXXXXX";
    private static final String HANDLE = "XXXXXXXXXXXXXXXXXXXXX";

    @Test
    public void testInstantiation() {
        FileLink fileLink = new FileLink(API_KEY, HANDLE);
        assertNotNull("Unable to create FileLink", fileLink);
    }
}

package model;

import org.junit.Test;

import static org.junit.Assert.assertNotNull;

/**
 * Tests {@link FileLink FileLink} class.
 */
public class TestFileLink {
    private static final String API_KEY = "XXXXXXXXXXXXXXXXXXXXXXX";
    private static final String HANDLE = "XXXXXXXXXXXXXXXXXXXXX";

    @Test
    public void testInstantiation() {
        FileLink fileLink = new FileLink(API_KEY, HANDLE);
        assertNotNull("Unable to create FileLink", fileLink);
    }
}

Remove @author annotation in Javadoc.

Remove @author annotation in Javadoc.


package com.avairebot.orion.scheduler;

import com.avairebot.orion.Orion;
import com.avairebot.orion.cache.CacheType;
import com.avairebot.orion.cache.adapters.MemoryAdapter;
import com.avairebot.orion.contracts.scheduler.Job;

public class GarbageCollectorJob extends Job {

    public GarbageCollectorJob(Orion orion) {
        super(orion);
    }

    @Override
    public void run() {
        MemoryAdapter adapter = (MemoryAdapter) orion.getCache().getAdapter(CacheType.MEMORY);

        for (String key : adapter.getCacheKeys()) {
            if (!adapter.has(key)) {
                adapter.forget(key);
            }
        }
    }
}

package com.avairebot.orion.scheduler;

import com.avairebot.orion.Orion;
import com.avairebot.orion.audio.AudioHandler;
import com.avairebot.orion.audio.GuildMusicManager;
import com.avairebot.orion.cache.CacheType;
import com.avairebot.orion.cache.adapters.MemoryAdapter;
import com.avairebot.orion.contracts.scheduler.Job;

import java.util.Map;

public class GarbageCollectorJob extends Job {

    public GarbageCollectorJob(Orion orion) {
        super(orion);
    }

    @Override
    public void run() {
        MemoryAdapter adapter = (MemoryAdapter) orion.getCache().getAdapter(CacheType.MEMORY);

        adapter.getCacheKeys().removeIf(key -> !adapter.has(key));

        for (Map.Entry<Long, GuildMusicManager> entry : AudioHandler.MUSIC_MANAGER.entrySet()) {
            if (entry.getValue() == null) {
                AudioHandler.MUSIC_MANAGER.remove(entry.getKey());
                continue;
            }

            if (entry.getValue().getLastActiveMessage() == null) {
                continue;
            }

            if (entry.getValue().getLastActiveMessage().getGuild().getAudioManager().isConnected()) {
                continue;
            }

            if (!adapter.has(getCacheFingerprint(entry.getKey()))) {
                adapter.put(getCacheFingerprint(entry.getKey()), 0, 120);
                continue;
            }

            adapter.forget(getCacheFingerprint(entry.getKey()));

            AudioHandler.MUSIC_MANAGER.remove(entry.getKey());
        }
    }

    private String getCacheFingerprint(Long guildId) {
        return "garbage-collector.music-queue." + guildId;
    }
}

Add music manager cleanup to the garbage collector


package com.ichorcommunity.latch.enums;

public enum LockType {
    /*
     * Accessible by everyone
     */
    PUBLIC,

    /*
     * Accessible by the group
     */
    GUILD,

    /*
     * Requires a password every time to use
     */
    PASSWORD_ALWAYS,

    /*
     * Requires a password the first time a player accesses it
     */
    PASSWORD_ONCE,

    /*
     * Owned/controlled by one person, access able to be shared
     */
    PRIVATE,

    /*
     * Allows all players to deposit items, only the owner to withdraw
     */
    DONATION;

}

package com.ichorcommunity.latch.enums;

public enum LockType {
    /*
     * Accessible by everyone
     */
    PUBLIC,

    /*
     * Accessible by the group
     */
    GUILD,

    /*
     * Requires a password every time to use
     */
    PASSWORD_ALWAYS,

    /*
     * Requires a password the first time a player accesses it
     */
    PASSWORD_ONCE,

    /*
     * Owned/controlled by one person, access able to be shared
     */
    PRIVATE;

    /*
     * Allows all players to deposit items, only the owner to withdraw
     */
    //Donation locks not possible to make without Sponge Inventory implementation
    //DONATION;

}

Disable donation lock for now

Disable donation lock for now


package org.scenarioo.mytinytodo;

import org.junit.Before;
import org.junit.Test;
import org.scenarioo.mytinytodo.base.TinyTodoWebTest;
import org.scenarioo.mytinytodo.pages.TaskListsPage;
import org.scenarioo.mytinytodo.pages.TasksPage;

public class TaskListManagementWebTest extends TinyTodoWebTest {

	private TaskListsPage taskListsPage;
	private TasksPage tasksPage;

	@Before
	public void init() {
		taskListsPage = create(TaskListsPage.class);
		tasksPage = create(TasksPage.class);
	}

	@Test
	public void createTaskList() {
		start();
		taskListsPage.createTaskList("Todo 2");
		taskListsPage.showTaskList("Todo 2");
		tasksPage.assertIsEmpty();
	}

	@Test
	public void renameTaskList() {
		start();
		taskListsPage.createTaskList("Todo with spelling mstake");
		taskListsPage.selectTaskList("Todo with spelling mstake");
		taskListsPage.renameSelectedTaskList("Todo without spelling mistake");
	}

	@Test
	public void deleteTaskList() {
		start();
		taskListsPage.createTaskList("Todo to be removed");
		taskListsPage.selectTaskList("Todo to be removed");
		taskListsPage.deleteSelectedTaskList();
	}
}

package org.scenarioo.mytinytodo;

import org.junit.Before;
import org.junit.Test;
import org.scenarioo.mytinytodo.base.TinyTodoWebTest;
import org.scenarioo.mytinytodo.pages.TaskListsPage;
import org.scenarioo.mytinytodo.pages.TasksPage;

public class TaskListManagementWebTest extends TinyTodoWebTest {

	private TaskListsPage taskListsPage;
	private TasksPage tasksPage;

	@Before
	public void init() {
		taskListsPage = create(TaskListsPage.class);
		tasksPage = create(TasksPage.class);
	}

	@Test
	public void createTaskList() {
		start();
		taskListsPage.createTaskList("Todo 2");
		taskListsPage.selectTaskList("Todo 2");
		tasksPage.assertIsEmpty();
	}

	@Test
	public void renameTaskList() {
		start();
		taskListsPage.createTaskList("Todo with spelling mstake");
		taskListsPage.selectTaskList("Todo with spelling mstake");
		taskListsPage.renameSelectedTaskList("Todo without spelling mistake");
	}

	@Test
	public void deleteTaskList() {
		start();
		taskListsPage.createTaskList("Todo to be removed");
		taskListsPage.selectTaskList("Todo to be removed");
		taskListsPage.deleteSelectedTaskList();
	}
}

Remove strange old "showTaskList" call now and forever!


package com.pholser.junit.quickcheck.internal.generator;

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

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 *
Mark a parameter of a {@link com.pholser.junit.quickcheck.Property}
 * method with this annotation, in addition to {@link javax.annotation.Nullable},
 * to configure the probability of generating a null value.

 */
@Target({ PARAMETER, FIELD, ANNOTATION_TYPE, TYPE_USE })
@Retention(RUNTIME)
public @interface NullAllowed {
    /**
     * @return probability of generating null {@code float} value, in the range [0,1]
     */
    float probability() default 0.5f;
}

package com.pholser.junit.quickcheck.internal.generator;

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

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 *
Mark a parameter of a {@link com.pholser.junit.quickcheck.Property}
 * method with this annotation, in addition to {@link javax.annotation.Nullable},
 * to configure the probability of generating a null value.

 */
@Target({ PARAMETER, FIELD, ANNOTATION_TYPE, TYPE_USE })
@Retention(RUNTIME)
public @interface NullAllowed {
    /**
     * @return probability of generating null {@code float} value, in the range [0,1]
     */
    float probability() default 0.2f;
}

Reduce default probability of nulls

Reduce default probability of nulls


package me.soundlocker.soundlocker;

import android.os.AsyncTask;

import org.apache.commons.lang3.ArrayUtils;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class DownloadSongByteData extends AsyncTask<URL, Integer, Byte[]> {

    @Override
    protected Byte[] doInBackground(URL... params) {
        URL url = params[0];
        HttpURLConnection urlConnection = null;
        try {
            urlConnection = (HttpURLConnection) url.openConnection();
            InputStream fileInputStream = new BufferedInputStream(urlConnection.getInputStream());
            byte[] result = inputStreamToByteArray(fileInputStream);
            return ArrayUtils.toObject(result);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            urlConnection.disconnect();
        }
        return null;
    }

    private byte[] inputStreamToByteArray(InputStream inStream) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        byte[] buffer = new byte[8192];
        int bytesRead;
        while ((bytesRead = inStream.read(buffer)) > 0) {
            baos.write(buffer, 0, bytesRead);
        }
        return baos.toByteArray();
    }
}

package me.soundlocker.soundlocker;

import android.os.AsyncTask;

import org.apache.commons.lang3.ArrayUtils;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

import javax.net.ssl.HttpsURLConnection;

public class DownloadSongByteData extends AsyncTask<URL, Integer, Byte[]> {

    @Override
    protected Byte[] doInBackground(URL... params) {
        URL url = params[0];
        HttpsURLConnection urlConnection = null;
        try {
            urlConnection = (HttpsURLConnection) url.openConnection();
            InputStream fileInputStream = new BufferedInputStream(urlConnection.getInputStream());
            byte[] result = inputStreamToByteArray(fileInputStream);
            return ArrayUtils.toObject(result);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            urlConnection.disconnect();
        }
        return null;
    }

    private byte[] inputStreamToByteArray(InputStream inStream) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        byte[] buffer = new byte[8192];
        int bytesRead;
        while ((bytesRead = inStream.read(buffer)) > 0) {
            baos.write(buffer, 0, bytesRead);
        }
        return baos.toByteArray();
    }
}

Use HttpsURLConnection for Spotify previews


package de.tuberlin.dima.schubotz.fse.mappers;

import eu.stratosphere.api.java.functions.FlatMapFunction;
import eu.stratosphere.util.Collector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Cleans main task queries. TODO find way to do this using stratosphere built in data input?
 * Required due to Stratosphere split on {@link de.tuberlin.dima.schubotz.fse.MainProgram#QUERY_SEPARATOR}
 */
public class QueryCleaner extends FlatMapFunction<String, String> {
	Log LOG = LogFactory.getLog(QueryCleaner.class);

	@Override
	public void flatMap(String in, Collector<String> out) throws Exception {
		if (in.trim().length() == 0 || in.startsWith("\r\n</topics>")) {
			if (LOG.isWarnEnabled()) {
				LOG.warn("Corrupt query " + in);
			}
			return;
		}
		if (in.startsWith("<?xml")) {
			in += "</topic></topics>";
		}else if (!in.endsWith( "</topic>" )) {
			in += "</topic>";
		}
		out.collect(in);
	}
}

package de.tuberlin.dima.schubotz.fse.mappers;

import eu.stratosphere.api.java.functions.FlatMapFunction;
import eu.stratosphere.util.Collector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Cleans main task queries. TODO find way to do this using stratosphere built in data input?
 * Required due to Stratosphere split on {@link de.tuberlin.dima.schubotz.fse.MainProgram#QUERY_SEPARATOR}
 */
public class QueryCleaner extends FlatMapFunction<String, String> {
	Log LOG = LogFactory.getLog(QueryCleaner.class);

	@Override
	public void flatMap(String in, Collector<String> out) throws Exception {
        //TODO: check if \r is required
		if (in.trim().length() == 0 || in.startsWith("\r\n</topics>")) {
			if (LOG.isWarnEnabled()) {
				LOG.warn("Corrupt query " + in);
			}
			return;
		}
		if (in.startsWith("<?xml")) {
			in += "</topic></topics>";
		}else if (!in.endsWith( "</topic>" )) {
			in += "</topic>";
		}
		out.collect(in);
	}
}

Make \r in topics optional

Make \r in topics optional


package jpaoletti.jpm.core.operations;

import java.util.List;
import jpaoletti.jpm.core.InstanceId;
import jpaoletti.jpm.core.PMContext;
import jpaoletti.jpm.core.PMException;

/**
 *
 * @author jpaoletti
 */
public class SelectItemOperation extends OperationCommandSupport {

    public SelectItemOperation(String operationId) {
        super(operationId);
    }

    public SelectItemOperation() {
        super("selectitem");
    }

    @Override
    protected void doExecute(PMContext ctx) throws PMException {
        super.doExecute(ctx);
        final String _item = (String) ctx.getParameter("idx");
        if (_item != null) {
            final InstanceId id = buildInstanceId(ctx.getEntity(), _item);
            final List<InstanceId> selectedIndexes = ctx.getEntityContainer().getSelectedInstanceIds();
            if (selectedIndexes.contains(id)) {
                selectedIndexes.remove(id);
            } else {
                selectedIndexes.add(id);
            }
        }
    }

    @Override
    protected boolean checkEntity() {
        return true;
    }
}

package jpaoletti.jpm.core.operations;

import java.util.List;
import jpaoletti.jpm.core.InstanceId;
import jpaoletti.jpm.core.PMContext;
import jpaoletti.jpm.core.PMException;

/**
 *
 * @author jpaoletti
 */
public class SelectItemOperation extends OperationCommandSupport {

    public SelectItemOperation(String operationId) {
        super(operationId);
    }

    public SelectItemOperation() {
        super("selectitem");
    }

    @Override
    protected void doExecute(PMContext ctx) throws PMException {
        super.doExecute(ctx);
        final String _item = (String) ctx.getParameter("idx");
        if (_item != null) {
            final InstanceId id = buildInstanceId(ctx.getEntity(), _item);
            final List<InstanceId> selectedIndexes = ctx.getEntityContainer().getSelectedInstanceIds();
            if (selectedIndexes.contains(id)) {
                selectedIndexes.remove(id);
            } else {
                selectedIndexes.add(id);
            }
        }
    }

    @Override
    protected boolean checkEntity() {
        return true;
    }

    @Override
    protected boolean checkOperation() {
        return false;
    }
}

Select item dont check for operation existance


package ch.hevs.aislab.magpie.test.java;

import org.junit.Test;

import alice.tuprolog.Term;
import ch.hevs.aislab.magpie.event.LogicTupleEvent;

import static junit.framework.TestCase.assertEquals;

public class LogicTupleTest {

    @Test
    public void createLogicTuple() {

        // This method tests if the following LogicTuple is created correctly using the different constructors
        final String logicTuple = "blood_pressure(Sys,Dias)";

        // Creation with multiple arguments
        LogicTupleEvent bp1 = new LogicTupleEvent("blood_pressure", "Sys", "Dias");
        String tupleFromArgs = bp1.toTuple();
        assertEquals(logicTuple, tupleFromArgs);

        // Creation from a tuProlog Term
        Term t = Term.createTerm(logicTuple);
        LogicTupleEvent bp2 = new LogicTupleEvent(t);
        String tupleFromTerm = bp2.toTuple();
        assertEquals(logicTuple, tupleFromTerm);

        // Creation from String
        LogicTupleEvent bp3 = new LogicTupleEvent(logicTuple);
        String tupleFromString = bp3.toTuple();
        assertEquals(logicTuple, tupleFromString);
    }
}

package ch.hevs.aislab.magpie.test.java;

import org.junit.Test;

import alice.tuprolog.Term;
import ch.hevs.aislab.magpie.event.LogicTupleEvent;

import static junit.framework.TestCase.assertEquals;

public class LogicTupleTest {

    @Test
    public void createLogicTuple() {

        // This method tests if the following LogicTuple is created correctly using the different constructors
        final String logicTuple = "blood_pressure(Sys,Dias)";

        // Creation with multiple arguments
        LogicTupleEvent bp1 = new LogicTupleEvent("blood_pressure", "Sys", "Dias");
        String tupleFromArgs = bp1.toTuple();
        assertEquals(logicTuple, tupleFromArgs);

        // Creation from a tuProlog Term
        Term t = Term.createTerm(logicTuple);
        LogicTupleEvent bp2 = new LogicTupleEvent(t);
        String tupleFromTerm = bp2.toTuple();
        assertEquals(logicTuple, tupleFromTerm);

        // Creation from String
        LogicTupleEvent bp3 = new LogicTupleEvent(logicTuple);
        String tupleFromString = bp3.toTuple();
        assertEquals(logicTuple, tupleFromString);
    }

    @Test
    public void getNameAndArguments() {

        String name = "blood_pressure";
        String arg1 = "Sys";
        String arg2 = "Dias";
        LogicTupleEvent ev = new LogicTupleEvent(name, arg1, arg2);

        assertEquals(name, ev.getName());
        assertEquals(arg1, ev.getArguments().get(0));
        assertEquals(arg2, ev.getArguments().get(1));
    }
}

Add test that checks whether the name and the arguments are correct


/**
 * Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.engine.view.calc;

import com.opengamma.core.change.ChangeEvent;
import com.opengamma.core.change.ChangeListener;

/**
 * Change listener for a single view definition which notifies a computation job.
 */
public class ViewDefinitionChangeListener implements ChangeListener {

  private final ViewComputationJob _computationJob;
  private final String _viewDefinitionName;

  public ViewDefinitionChangeListener(ViewComputationJob computationJob, String viewDefinitionName) {
    _computationJob = computationJob;
    _viewDefinitionName = viewDefinitionName;
  }

  @Override
  public void entityChanged(ChangeEvent event) {
    if (event.getAfterId() == null) {
      // View definition could have been deleted - do we want to stop the process?
      return;
    }
    if (event.getBeforeId().getValue().equals(getViewDefinitionName())) {
      getViewComputationJob().dirtyViewDefinition();
    }
  }

  private String getViewDefinitionName() {
    return _viewDefinitionName;
  }

  private ViewComputationJob getViewComputationJob() {
    return _computationJob;
  }

}

/**
 * Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.engine.view.calc;

import com.opengamma.core.change.ChangeEvent;
import com.opengamma.core.change.ChangeListener;

/**
 * Change listener for a single view definition which notifies a computation job.
 */
public class ViewDefinitionChangeListener implements ChangeListener {

  private final ViewComputationJob _computationJob;
  private final String _viewDefinitionName;

  public ViewDefinitionChangeListener(ViewComputationJob computationJob, String viewDefinitionName) {
    _computationJob = computationJob;
    _viewDefinitionName = viewDefinitionName;
  }

  @Override
  public void entityChanged(ChangeEvent event) {
    if (event.getBeforeId() == null) {
      // View definition created
      return;
    }
    if (event.getAfterId() == null) {
      // View definition could have been deleted - do we want to stop the process?
      return;
    }
    if (event.getBeforeId().getValue().equals(getViewDefinitionName())) {
      getViewComputationJob().dirtyViewDefinition();
    }
  }

  private String getViewDefinitionName() {
    return _viewDefinitionName;
  }

  private ViewComputationJob getViewComputationJob() {
    return _computationJob;
  }

}

Stop throwing when view definition is created


package me.nallar.patched.storage;

import me.nallar.tickthreading.patcher.Declare;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.chunk.storage.AnvilChunkLoaderPending;

/**
 * This patch class doesn't change anything, it's just here so the prepatcher will
 * make AnvilChunkLoaderPending public
 */
public abstract class PatchAnvilChunkLoaderPending extends AnvilChunkLoaderPending {
	@Declare
	public boolean unloading_;

	public PatchAnvilChunkLoaderPending(ChunkCoordIntPair par1ChunkCoordIntPair, NBTTagCompound par2NBTTagCompound) {
		super(par1ChunkCoordIntPair, par2NBTTagCompound);
	}
}

package me.nallar.patched.storage;

import me.nallar.tickthreading.patcher.Declare;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.chunk.storage.AnvilChunkLoaderPending;

public abstract class PatchAnvilChunkLoaderPending extends AnvilChunkLoaderPending {
	@Declare
	public boolean unloading_;

	public PatchAnvilChunkLoaderPending(ChunkCoordIntPair par1ChunkCoordIntPair, NBTTagCompound par2NBTTagCompound) {
		super(par1ChunkCoordIntPair, par2NBTTagCompound);
	}
}

Remove no longer valid comment for AnvilChunkLoaderPending

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


/*
 * Copyright (c) 2005-2010 Grameen Foundation USA
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * See also http://www.apache.org/licenses/LICENSE-2.0.html for an
 * explanation of the license and how it is applied.
 */
package org.mifos.ui.core.controller;

public class SectionForm {
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

/*
 * Copyright (c) 2005-2010 Grameen Foundation USA
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * See also http://www.apache.org/licenses/LICENSE-2.0.html for an
 * explanation of the license and how it is applied.
 */
package org.mifos.ui.core.controller;

import java.io.Serializable;

public class SectionForm implements Serializable {
    private static final long serialVersionUID = 4707282409987816335L;
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

Add sections to Question Group

[MIFOS-3150] Add sections to Question Group


package io.github.proxyprint.kitchen.controllers.printshops;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import io.github.proxyprint.kitchen.models.printshops.PrintShop;
import io.github.proxyprint.kitchen.models.printshops.pricetable.PaperTableItem;
import io.github.proxyprint.kitchen.models.repositories.PrintShopDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by daniel on 27-04-2016.
 */
@RestController
public class ManagerController {

    @Autowired
    private PrintShopDAO printshops;
    private final static Gson GSON = new GsonBuilder().setPrettyPrinting().create();

    @RequestMapping(value = "/printshops/{id}/pricetable/newpaperitem", method = RequestMethod.POST)
    public String registerRequest(@PathVariable(value = "id") long id, @RequestBody PaperTableItem pti) {
        PrintShop pshop = printshops.findOne(id);
        JsonObject response = new JsonObject();

        if(pshop!=null) {
            pshop.insertPaperItemsInPriceTable(pti);
            printshops.save(pshop);
            response.addProperty("success", true);
            return GSON.toJson(response);
        }
        else{
            response.addProperty("success", false);
            return GSON.toJson(response);
        }
    }
}

package io.github.proxyprint.kitchen.controllers.printshops;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import io.github.proxyprint.kitchen.models.printshops.PrintShop;
import io.github.proxyprint.kitchen.models.printshops.pricetable.PaperTableItem;
import io.github.proxyprint.kitchen.models.repositories.PrintShopDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by daniel on 27-04-2016.
 */
@RestController
public class ManagerController {

    @Autowired
    private PrintShopDAO printshops;
    private final static Gson GSON = new GsonBuilder().setPrettyPrinting().create();

    @RequestMapping(value = "/printshops/{id}/pricetable/newpaperitem", method = RequestMethod.POST)
    public String addNewPaperItem(@PathVariable(value = "id") long id, @RequestBody PaperTableItem pti) {
        PrintShop pshop = printshops.findOne(id);
        JsonObject response = new JsonObject();

        if(pshop!=null) {
            pshop.insertPaperItemsInPriceTable(pti);
            printshops.save(pshop);
            response.addProperty("success", true);
            return GSON.toJson(response);
        }
        else{
            response.addProperty("success", false);
            return GSON.toJson(response);
        }
    }
}

Add new entry in pricetable Print&Copy section.


// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision.security;

import java.security.cert.X509Certificate;
import java.util.List;

/**
 * Identifies Vespa nodes from the their X509 certificate.
 *
 * @author bjorncs
 */
public interface NodeIdentifier {

    NodeIdentity identifyNode(List<X509Certificate> peerCertificateChain);

}

// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision.security;

import java.security.cert.X509Certificate;
import java.util.List;

/**
 * Identifies Vespa nodes from the their X509 certificate.
 *
 * @author bjorncs
 */
public interface NodeIdentifier {

    NodeIdentity identifyNode(List<X509Certificate> peerCertificateChain) throws NodeIdentifierException;

}

Add throws definition to 'identityNode'

Add throws definition to 'identityNode'

This is backward compatible as NodeIdentifierException is an unchecked exception.


/******************************************************************
 * File:        MapSource.java
 * Created by:  Dave Reynolds
 * Created on:  13 Dec 2013
 *
 * (c) Copyright 2013, Epimorphics Limited
 *
 *****************************************************************/

package com.epimorphics.dclib.framework;

import org.apache.jena.riot.system.StreamRDF;

import com.hp.hpl.jena.graph.Node;

/**
 * Signature for utilities the support mapping of input values
 * to normalized RDF values (normally URIs).
 *
 * @author Dave Reynolds
 */
public interface MapSource {

    /**
     * Return the matching normalized RDF value or none if there no
     * match (or no unambiguous match)
     */
    public Node lookup(String key);

    /**
     * Return the name of this suorce, may be null
     */
    public String getName();

    /**
     * Enrich the RDF outstream from other properties of a matched node
     */
    public void enrich(StreamRDF stream, Node match);
}

/******************************************************************
 * File:        MapSource.java
 * Created by:  Dave Reynolds
 * Created on:  13 Dec 2013
 *
 * (c) Copyright 2013, Epimorphics Limited
 *
 *****************************************************************/

package com.epimorphics.dclib.framework;

import org.apache.jena.riot.system.StreamRDF;

import com.epimorphics.appbase.monitor.ConfigInstance;
import com.hp.hpl.jena.graph.Node;

/**
 * Signature for utilities the support mapping of input values
 * to normalized RDF values (normally URIs).
 *
 * @author Dave Reynolds
 */
public interface MapSource extends ConfigInstance {

    /**
     * Return the matching normalized RDF value or none if there no
     * match (or no unambiguous match)
     */
    public Node lookup(String key);

    /**
     * Return the name of this suorce, may be null
     */
    public String getName();

    /**
     * Enrich the RDF outstream from other properties of a matched node
     */
    public void enrich(StreamRDF stream, Node match);
}

Change signature so sources can be treated as configurable items


package models;

import java.util.List;
import java.util.UUID;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * The base class for all of the models used by GTFS Data Manager.
 * We don't use the Play model object because we're not saving things to a relational database.
 * @author mattwigway
 */
public abstract class Model {

    public Model () {
        this.id = UUID.randomUUID().toString();
    }

    public String id;

    /**
     * The ID of the user who owns this object.
     * For accountability, every object is owned by a user.
     */
    @JsonIgnore
    public String userId;

    /**
     * Notes on this object
     */
    public List<Note> notes;

    /**
     * Get the user who owns this object.
     * @return the User object
     */
    public User getUser () {
        return User.getUser(userId);
    }

    /**
     * Set the owner of this object
     */
    public void setUser (User user) {
        userId = user.id != null ? user.id : User.getUserId(user.username);
    }
}

package models;

import java.util.List;
import java.util.UUID;

import javax.persistence.MappedSuperclass;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * The base class for all of the models used by GTFS Data Manager.
 * We don't use the Play model object because we're not saving things to a relational database.
 * @author mattwigway
 */
@MappedSuperclass
public abstract class Model {

    public Model () {
        this.id = UUID.randomUUID().toString();
    }

    public String id;

    /**
     * The ID of the user who owns this object.
     * For accountability, every object is owned by a user.
     */
    @JsonIgnore
    public String userId;

    /**
     * Notes on this object
     */
    public List<Note> notes;

    /**
     * Get the user who owns this object.
     * @return the User object
     */
    public User getUser () {
        return User.getUser(userId);
    }

    /**
     * Set the owner of this object
     */
    public void setUser (User user) {
        userId = user.id != null ? user.id : User.getUserId(user.username);
    }
}

Add @MappedSuperclass so user information is serialized.


package org.realityforge.replicant.server.ee.rest;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.realityforge.replicant.shared.transport.ReplicantContext;
import org.realityforge.ssf.SessionManager;

/**
 * The token source is for generating the initial token.
 *
 * It is expected that this endpoint has already had security applied.
 */
@Path( ReplicantContext.TOKEN_URL_FRAGMENT )
@Produces( MediaType.TEXT_PLAIN )
public class TokenRestService
{
  @Inject
  private SessionManager _sessionManager;

  @GET
  public String generateToken()
  {
    return _sessionManager.createSession().getSessionID();
  }
}

package org.realityforge.replicant.server.ee.rest;

import javax.ejb.EJB;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.realityforge.replicant.shared.transport.ReplicantContext;
import org.realityforge.ssf.SessionManager;

/**
 * The token source is for generating the initial token.
 *
 * It is expected that this endpoint has already had security applied.
 */
@Path( ReplicantContext.TOKEN_URL_FRAGMENT )
@Produces( MediaType.TEXT_PLAIN )
public class TokenRestService
{
  @EJB
  private SessionManager _sessionManager;

  @GET
  public String generateToken()
  {
    return _sessionManager.createSession().getSessionID();
  }
}

Use an @EJB annotation to comply with Domgen generated code


package com.kilfat.web.model.deserializer;

import com.fasterxml.jackson.databind.JsonNode;
import com.kilfat.config.ServiceConstants;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DeserializerHelper {
    private static final SimpleDateFormat dateFormat = new SimpleDateFormat(ServiceConstants.DATE_FORMAT);

    public static JsonNode getFieldNode(JsonNode node, String field) {
        if (node.get(field) != null) {
            return node.get(field);
        }
        return null;
    }

    public static String getField(JsonNode node, String field) {
        if (node.get(field) != null) {
            return node.get(field).textValue();
        }
        return "";
    }

    public static Integer getIntegerField(JsonNode node, String field) {
        if (node.get(field) != null) {
            return node.get(field).intValue();
        }
        return null;
    }

    public static Long getLongField(JsonNode node, String field) {
        if (node.get(field) != null) {
            return node.get(field).longValue();
        }
        return null;
    }

    public static Date getDateField(JsonNode node, String field) {
        String dateAsString;
        if (node.get(field) == null) {
            return null;
        }
        dateAsString = node.get(field).textValue();
        try {
            return dateFormat.parse(dateAsString);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
}

package com.kilfat.web.model.deserializer;

import com.fasterxml.jackson.databind.JsonNode;
import com.kilfat.config.ServiceConstants;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DeserializerHelper {
    private static final SimpleDateFormat dateFormat = new SimpleDateFormat(ServiceConstants.DATE_FORMAT);

    public static JsonNode getFieldNode(JsonNode node, String field) {
        if (node.get(field) != null) {
            return node.get(field);
        }
        return null;
    }

    public static String getField(JsonNode node, String field) {
        if (node.get(field) != null) {
            return node.get(field).textValue();
        }
        return "";
    }

    public static Integer getIntegerField(JsonNode node, String field) {
        if (node.get(field) != null) {
            return node.get(field).intValue();
        }
        return null;
    }

    public static Long getLongField(JsonNode node, String field) {
        if (node.get(field) != null) {
            return node.get(field).longValue();
        }
        return null;
    }

    public static Date getDateField(JsonNode node, String field) {
        long date;
        if (node.get(field) == null || node.get(field).isLong() == false) {
            return null;
        }
        date = node.get(field).asLong();
        try {
            return dateFormat.parse(date*1000L);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
}

Change data parser, need to add unix timestamp support


package fape.core.planning.search.strategies.flaws;

import fape.core.planning.planner.Planner;
import fape.core.planning.search.flaws.flaws.Flaw;
import fape.core.planning.search.flaws.flaws.UnmotivatedAction;
import fape.core.planning.search.flaws.flaws.UnrefinedTask;
import fape.core.planning.states.State;

public class HierarchicalFirstComp implements FlawComparator {

    public final State st;
    public final Planner planner;

    public HierarchicalFirstComp(State st, Planner planner) {
        this.st = st;
        this.planner = planner;
    }

    @Override
    public String shortName() {
        return "hf";
    }

    private int priority(Flaw flaw) {
        if(flaw instanceof UnrefinedTask)
            return 3;
        else if(flaw instanceof UnmotivatedAction)
            return 4;
        else
            return 5;
    }

    @Override
    public int compare(Flaw o1, Flaw o2) {
        return priority(o1) - priority(o2);
    }
}

package fape.core.planning.search.strategies.flaws;

import fape.core.planning.planner.Planner;
import fape.core.planning.search.flaws.flaws.Flaw;
import fape.core.planning.search.flaws.flaws.Threat;
import fape.core.planning.search.flaws.flaws.UnmotivatedAction;
import fape.core.planning.search.flaws.flaws.UnrefinedTask;
import fape.core.planning.states.State;

public class HierarchicalFirstComp implements FlawComparator {

    public final State st;
    public final Planner planner;
    public final boolean threatsFirst;

    public HierarchicalFirstComp(State st, Planner planner) {
        this.st = st;
        this.planner = planner;
        threatsFirst = st.pb.allActionsAreMotivated();
    }

    @Override
    public String shortName() {
        return "hf";
    }

    private double priority(Flaw flaw) {
        if(threatsFirst && flaw instanceof Threat)
            return 0.;
        else if(flaw instanceof UnrefinedTask)
            return 1. + ((double) st.getEarliestStartTime(((UnrefinedTask) flaw).task.start())) / ((double) st.getEarliestStartTime(st.pb.end())+1);
        else if(flaw instanceof UnmotivatedAction)
            return 4.;
        else
            return 5.;
    }

    @Override
    public int compare(Flaw o1, Flaw o2) {
        return (int) Math.signum(priority(o1) - priority(o2));
    }
}

[planning] Update default flaw selection strategy on hierarchical domains: threats first, then unrefined tasks.


package com.example.spring.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.resource.VersionPathStrategy;

@Slf4j
public class MiddleVersionPathStrategy implements VersionPathStrategy {
    private final String prefix;
    private final String version;

    public MiddleVersionPathStrategy(String prefix, String version) {
        this.prefix = prefix;
        this.version = version;
    }

    @Override
    public String extractVersion(String requestPath) {
        if (requestPath.startsWith(this.prefix)) {
            String prefixRemoved = requestPath.substring(this.prefix.length());
            if (prefixRemoved.startsWith(this.version)) {
                return this.version;
            }
        }
        return null;
    }

    @Override
    public String removeVersion(String requestPath, String version) {
        return requestPath.substring(this.prefix.length()).substring(this.version.length());
    }

    @Override
    public String addVersion(String path, String version) {
        log.info("addVersion: {}", path);
        if (path.startsWith(".")) {
            return path;
        } else {
            return (path.startsWith("/") ? this.prefix + this.version + path : this.prefix + this.version + "/" + path);
        }
    }
}

package com.example.spring.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.resource.VersionPathStrategy;

@Slf4j
public class MiddleVersionPathStrategy implements VersionPathStrategy {
    private final String prefix;
    private final String version;

    public MiddleVersionPathStrategy(String prefix, String version) {
        this.prefix = prefix;
        this.version = version;
    }

    @Override
    public String extractVersion(String requestPath) {
        if (requestPath.startsWith(this.prefix)) {
            String prefixRemoved = requestPath.substring(this.prefix.length());
            if (prefixRemoved.startsWith(this.version)) {
                return this.version;
            }
        }
        return null;
    }

    @Override
    public String removeVersion(String requestPath, String version) {
        return this.prefix + requestPath.substring(this.prefix.length() + this.version.length());
    }

    @Override
    public String addVersion(String path, String version) {
        log.info("addVersion: {}", path);
        if (path.startsWith(".")) {
            return path;
        } else {
            String p = path;
            if (p.startsWith("/")) {
                p = p.substring(1);
            }
            if (p.startsWith(this.prefix)) {
                return this.prefix + this.version + "/" + p.substring(this.prefix.length());
            } else {
                return path;
            }
        }
    }
}

Fix fixed version example to handle prefix correctly


package com.futurice.rctaudiotoolkit;

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

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

public class AudioPackage implements ReactPackage {
    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();
        modules.add(new AudioRecorderModule(reactContext));
        modules.add(new AudioPlayerModule(reactContext));
        return modules;
    }

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

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

package com.futurice.rctaudiotoolkit;

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

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

public class AudioPackage implements ReactPackage {
    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();
        modules.add(new AudioRecorderModule(reactContext));
        modules.add(new AudioPlayerModule(reactContext));
        return modules;
    }

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

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

Allow compatibility with RN 0.47

Allow compatibility with RN 0.47


package org.apache.hadoop.hive.ql.io.parquet.timestamp;

import org.apache.hadoop.hive.common.type.Timestamp;

import static java.lang.Math.toIntExact;
import static java.util.concurrent.TimeUnit.SECONDS;

public final class NanoTimeUtils
{
    private NanoTimeUtils() {}

    private static final int JULIAN_EPOCH_OFFSET_DAYS = 2_440_588;

    public static NanoTime getNanoTime(Timestamp timestamp, @SuppressWarnings("unused") boolean ignored)
    {
        int epochDay = toIntExact(SECONDS.toDays(timestamp.toEpochSecond()));
        int julianDay = JULIAN_EPOCH_OFFSET_DAYS + epochDay;

        long timeOfDaySeconds = timestamp.toEpochSecond() % 86400;
        long timeOfDayNanos = SECONDS.toNanos(timeOfDaySeconds) + timestamp.getNanos();

        return new NanoTime(julianDay, timeOfDayNanos);
    }
}

package org.apache.hadoop.hive.ql.io.parquet.timestamp;

import org.apache.hadoop.hive.common.type.Timestamp;

import static java.lang.Math.floorDiv;
import static java.lang.Math.floorMod;
import static java.lang.Math.toIntExact;
import static java.util.concurrent.TimeUnit.SECONDS;

public final class NanoTimeUtils
{
    private NanoTimeUtils() {}

    private static final int JULIAN_EPOCH_OFFSET_DAYS = 2_440_588;
    private static final long SECONDS_PER_DAY = 86400L;

    public static NanoTime getNanoTime(Timestamp timestamp, @SuppressWarnings("unused") boolean ignored)
    {
        long epochSeconds = timestamp.toEpochSecond();
        int epochDay = toIntExact(floorDiv(epochSeconds, SECONDS_PER_DAY));
        int julianDay = JULIAN_EPOCH_OFFSET_DAYS + epochDay;

        long timeOfDaySeconds = floorMod(epochSeconds, SECONDS_PER_DAY);
        long timeOfDayNanos = SECONDS.toNanos(timeOfDaySeconds) + timestamp.getNanos();

        return new NanoTime(julianDay, timeOfDayNanos);
    }
}

Fix Parquet encoding for timestamps before epoch


package org.realityforge.replicant.shared.transport;

public class ReplicantContext
{
  /**
   * Key used to retrieve an opaque identifier for the session from the ReplicantContextHolder.
   * Used to pass data from the servlet to the EJB.
   */
  public static final String SESSION_ID_KEY = "SessionID";
  /**
   * Key used to retrieve an opaque identifier for the request from the ReplicantContextHolder.
   * Used to pass data from the servlet to the EJB.
   */
  public static final String REQUEST_ID_KEY = "RequestID";
  /**
   * Key used to retrieve a flag whether the request produced a changeset relevant for the initiating session..
   * Used to pass data from the EJB to the servlet.
   */
  public static final String REQUEST_COMPLETE_KEY = "RequestComplete";

  /**
   * HTTP request header to indicate the session id.
   */
  public static final String SESSION_ID_HEADER = "X-GWT-SessionID";
  /**
   * HTTP request header to indicate the request id.
   */
  public static final String REQUEST_ID_HEADER = "X-GWT-RequestID";
  /**
   * HTTP response header to indicate the whether the request is complete or a change set is expected.
   */
  public static final String REQUEST_COMPLETE_HEADER = "X-GWT-RequestComplete";
}

package org.realityforge.replicant.shared.transport;

public final class ReplicantContext
{
  /**
   * Key used to retrieve an opaque identifier for the session from the ReplicantContextHolder.
   * Used to pass data from the servlet to the EJB.
   */
  public static final String SESSION_ID_KEY = "SessionID";
  /**
   * Key used to retrieve an opaque identifier for the request from the ReplicantContextHolder.
   * Used to pass data from the servlet to the EJB.
   */
  public static final String REQUEST_ID_KEY = "RequestID";
  /**
   * Key used to retrieve a flag whether the request produced a changeset relevant for the initiating session..
   * Used to pass data from the EJB to the servlet.
   */
  public static final String REQUEST_COMPLETE_KEY = "RequestComplete";

  /**
   * HTTP request header to indicate the session id.
   */
  public static final String SESSION_ID_HEADER = "X-GWT-SessionID";
  /**
   * HTTP request header to indicate the request id.
   */
  public static final String REQUEST_ID_HEADER = "X-GWT-RequestID";
  /**
   * HTTP response header to indicate the whether the request is complete or a change set is expected.
   */
  public static final String REQUEST_COMPLETE_HEADER = "X-GWT-RequestComplete";

  private ReplicantContext()
  {
  }
}

Make sure you can not instantiate class

Make sure you can not instantiate class


package devopsdistilled.operp.server.data.service;

import java.io.Serializable;

import org.springframework.data.jpa.repository.JpaRepository;

public interface EntityService<T, ID extends Serializable> extends
		JpaRepository<T, ID>, Serializable {

}

package devopsdistilled.operp.server.data.service;

import java.io.Serializable;

import org.springframework.data.jpa.repository.JpaRepository;

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

public interface EntityService<E extends Entiti, ID extends Serializable> extends
		JpaRepository<E, ID>, Serializable {

}

Change argument type to "E extends Entiti" instead of "T"

OPEN - task 32: Add "Create Item" functionalities
http://github.com/DevOpsDistilled/OpERP/issues/issue/32


/*
 * Copyright 2017 Axway Software
 *
 * 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.axway.ats.log.autodb.events;

import org.apache.log4j.Logger;

import com.axway.ats.log.autodb.LifeCycleState;
import com.axway.ats.log.autodb.model.AbstractLoggingEvent;
import com.axway.ats.log.autodb.model.LoggingEventType;

@SuppressWarnings( "serial")
public class EndAfterClassEvent extends AbstractLoggingEvent {

    public EndAfterClassEvent( String loggerFQCN, Logger logger ) {
        super(loggerFQCN, logger, "End after class execution", LoggingEventType.END_AFTER_CLASS);
    }

    @Override
    protected LifeCycleState getExpectedLifeCycleState( LifeCycleState state ) {

        return LifeCycleState.ATLEAST_RUN_STARTED;
    }

}

/*
 * Copyright 2017 Axway Software
 *
 * 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.axway.ats.log.autodb.events;

import org.apache.log4j.Logger;

import com.axway.ats.log.autodb.LifeCycleState;
import com.axway.ats.log.autodb.model.AbstractLoggingEvent;
import com.axway.ats.log.autodb.model.LoggingEventType;

@SuppressWarnings( "serial")
public class EndAfterClassEvent extends AbstractLoggingEvent {

    public EndAfterClassEvent( String loggerFQCN, Logger logger ) {
        super(loggerFQCN, logger, "End after class execution", LoggingEventType.END_AFTER_CLASS);
    }

    @Override
    protected LifeCycleState getExpectedLifeCycleState( LifeCycleState state ) {
         /* This event is fired after a suite is already closed,
            since ATS (AtsTestngListener) could not be certain that @AfterClass will be available
         */
        return LifeCycleState.ATLEAST_RUN_STARTED;
    }

}

Add comment for event state

Add comment for event state


package edu.msudenver.cs3250.group6.msubanner.entities;

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

/**
 * Student class.
 */
public final class Student extends User {

    /** The student id. */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(unique = true)
    private String id;

    /**
     * Default constructor.
     */
    public Student() { }

    /**
     * Constructor.
     * @param firstName Student's first name
     * @param lastName Student's last name
     */
    public Student(final String firstName, final String lastName) {
        super(firstName, lastName);
    }

    @Override
    public boolean equals(final Object other) {
        return other instanceof Student && super.equals(other);
    }
}

Test coverage at 90% for student and professor


package org.bouncycastle.util.test;

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

public class UncloseableOutputStream extends FilterOutputStream
{
    public UncloseableOutputStream(OutputStream s)
    {
        super(s);
    }

    public void close()
    {
        throw new RuntimeException("close() called on UncloseableOutputStream");
    }

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

package org.bouncycastle.util.test;

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

/**
 * This is a testing utility class to check the property that an {@link OutputStream} is never
 * closed in some particular context - typically when wrapped by another {@link OutputStream} that
 * should not be forwarding its {@link OutputStream#close()} calls. Not needed in production code.
 */
public class UncloseableOutputStream extends FilterOutputStream
{
    public UncloseableOutputStream(OutputStream s)
    {
        super(s);
    }

    public void close()
    {
        throw new RuntimeException("close() called on UncloseableOutputStream");
    }

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

Add javadoc to make clear this is for testing only


package me.pagar;

import com.google.gson.annotations.SerializedName;

public enum BankAccountType {
    @SerializedName("conta_corrente")
    CONTA_CORRENTE,
    @SerializedName("conta_poupanca")
    CONTA_POUPANCA,
    @SerializedName("conta_corrente_conjunta")
    CONTA_CORRENTE_CONJUNTA,
    @SerializedName("conta_poupanca_conjunta")
    CONTA_POUPANCA_CONJUNTA
}

package me.pagar;

import com.google.gson.annotations.SerializedName;

public enum BankAccountType {
    @SerializedName("conta_corrente")
    CORRENTE,
    @SerializedName("conta_poupanca")
    POUPANCA,
    @SerializedName("conta_corrente_conjunta")
    CORRENTE_CONJUNTA,
    @SerializedName("conta_poupanca_conjunta")
    POUPANCA_CONJUNTA
}

Remove CONTA_ from BankAccountTyp enum values as requested


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

/**
 * Defines tools that can build things that run on the JVM.
 */
@org.gradle.api.Incubating
@NonNullApi
package org.gradle.jvm.toolchain;

import org.gradle.api.NonNullApi;

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

/**
 * Defines tools that can build things that run on the JVM.
 */
@NonNullApi
package org.gradle.jvm.toolchain;

import org.gradle.api.NonNullApi;

Remove Incubating annotation from toolchain package

Fixes #15812


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

package com.github.blindpirate.gogradle.task;

import org.gradle.api.DefaultTask;
import org.gradle.api.Task;

import javax.inject.Inject;

public class AbstractGolangTask extends DefaultTask {
    @Inject
    private GolangTaskContainer golangTaskContainer;

    protected <T extends Task> T getTask(Class<T> clazz) {
        return golangTaskContainer.get(clazz);
    }
}

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

package com.github.blindpirate.gogradle.task;

import org.gradle.api.DefaultTask;
import org.gradle.api.Task;

import javax.inject.Inject;

public class AbstractGolangTask extends DefaultTask {
    @Inject
    private GolangTaskContainer golangTaskContainer;

    public AbstractGolangTask() {
        setGroup("Gogradle");
    }

    protected <T extends Task> T getTask(Class<T> clazz) {
        return golangTaskContainer.get(clazz);
    }
}

Set group for go tasks

Set group for go tasks

Signed-off-by: Bo Zhang <384d347ab7eb84d725fe9c738f01a77b523e2fe5@gmail.com>


package com.adaptionsoft.games.uglytrivia;

import org.junit.Test;

import static org.junit.Assert.fail;

public class GameCorrectAnswerTest {

    @Test
    public void placeMeUnderTest(){
        fail("Place Game.correctAnswer under test");
    }
}

package com.adaptionsoft.games.uglytrivia;

import org.junit.Ignore;
import org.junit.Test;

import static org.mockito.Mockito.*;

public class GameCorrectAnswerTest {

    @Test
    public void correctAnswerShouldGetACoin() {
        Player player = mock(Player.class);
        Game game = createGameWithSinglePlayer(player);

        game.correctAnswer();

        verify(player, times(1)).answeredCorrect();
    }

    private Game createGameWithSinglePlayer(Player player) {
        Players players = new Players();
        players.add(player);
        return new Game(players, null);
    }
}

Test that correct answer gets a coin

Test that correct answer gets a coin


package com.janosgyerik.utils.objectstore.api;

import java.io.IOException;
import java.util.Optional;

/**
 * Store key-value pairs in some backend.
 *
 * @param <K> type of keys
 * @param <V> type of values
 */
public interface ObjectStore<K, V> {

    void write(K key, V value) throws StoreWriteException;

    Optional<V> read(K key) throws StoreReadException;
}

package com.janosgyerik.utils.objectstore.api;

import java.util.Optional;

/**
 * Store key-value pairs in some backend.
 *
 * @param <K> type of keys
 * @param <V> type of values
 */
public interface ObjectStore<K, V> {

    void write(K key, V value);

    Optional<V> read(K key);
}

Remove unnecessary throws and imports

Remove unnecessary throws and imports


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

package com.pushtechnology.diffusion.transform.messaging;

import com.pushtechnology.diffusion.client.features.Stream;

/**
 * A stream of values received as messages.
 *
 * @param <V> the type of values
 * @author Push Technology Limited
 */
public interface MessageStream<V> extends Stream {

    /**
     * Notified when a message is received.
     *
     * @param path the path to which the message was sent
     * @param message the message
     */
    void onMessageReceived(String path, V message);
}

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

package com.pushtechnology.diffusion.transform.messaging;

import com.pushtechnology.diffusion.client.callbacks.Stream;

/**
 * A stream of values received as messages.
 *
 * @param <V> the type of values
 * @author Push Technology Limited
 */
public interface MessageStream<V> extends Stream {

    /**
     * Notified when a message is received.
     *
     * @param path the path to which the message was sent
     * @param message the message
     */
    void onMessageReceived(String path, V message);
}

Use the latest Stream implementation.

Use the latest Stream implementation.


package cgeo.geocaching;

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

import cgeo.geocaching.connector.gc.GCConstants;
import cgeo.geocaching.maps.mapsforge.MapsforgeMapProvider;
import cgeo.geocaching.settings.Settings;

import android.annotation.TargetApi;
import android.test.ActivityInstrumentationTestCase2;

@TargetApi(8)
public class SettingsTest extends ActivityInstrumentationTestCase2<MainActivity> {

    public SettingsTest() {
        super(MainActivity.class);
    }

    /**
     * access settings.
     * this should work fine without an exception (once there was an exception because of the empty map file string)
     */
    public static void testSettingsException() {
        final String mapFile = Settings.getMapFile();
        // We just want to ensure that it does not throw any exception but we do not know anything about the result
        MapsforgeMapProvider.isValidMapFile(mapFile);
        assertThat(true).isTrue();
    }

    public static void testSettings() {
        // unfortunately, several other tests depend on being a premium member and will fail if run by a basic member
        assertThat(Settings.getGCMemberStatus()).isEqualTo(GCConstants.MEMBER_STATUS_PM);
    }

    public static void testDeviceHasNormalLogin() {
        // if the unit tests were interrupted in a previous run, the device might still have the "temporary" login data from the last tests
        assertThat("c:geo".equals(Settings.getUsername())).isFalse();
    }
}

package cgeo.geocaching;

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

import cgeo.geocaching.connector.gc.GCConstants;
import cgeo.geocaching.maps.mapsforge.MapsforgeMapProvider;
import cgeo.geocaching.settings.Settings;

import android.annotation.TargetApi;
import android.test.ActivityInstrumentationTestCase2;

@TargetApi(8)
public class SettingsTest extends ActivityInstrumentationTestCase2<MainActivity> {

    public SettingsTest() {
        super(MainActivity.class);
    }

    /**
     * access settings.
     * this should work fine without an exception (once there was an exception because of the empty map file string)
     */
    public static void testSettingsException() {
        // We just want to ensure that it does not throw any exception but we do not know anything about the result
        MapsforgeMapProvider.isValidMapFile(Settings.getMapFile());
    }

    public static void testSettings() {
        // unfortunately, several other tests depend on being a premium member and will fail if run by a basic member
        assertThat(Settings.getGCMemberStatus()).isEqualTo(GCConstants.MEMBER_STATUS_PM);
    }

    public static void testDeviceHasNormalLogin() {
        // if the unit tests were interrupted in a previous run, the device might still have the "temporary" login data from the last tests
        assertThat("c:geo".equals(Settings.getUsername())).isFalse();
    }
}

Remove useless assertion in test

Remove useless assertion in test