/**
 * Copyright 2005 The Apache Software Foundation
 *
 * 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.apache.hadoop.mapred;

/*******************************
 * Some handy constants
 *
 * @author Mike Cafarella
 *******************************/
interface MRConstants {
    //
    // Timeouts, constants
    //
    public static final long HEARTBEAT_INTERVAL = 3 * 1000;
    public static final long TASKTRACKER_EXPIRY_INTERVAL = 60 * 1000;

    //
    // Result codes
    //
    public static int SUCCESS = 0;
    public static int FILE_NOT_FOUND = -1;
}

/**
 * Copyright 2005 The Apache Software Foundation
 *
 * 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.apache.hadoop.mapred;

/*******************************
 * Some handy constants
 *
 * @author Mike Cafarella
 *******************************/
interface MRConstants {
    //
    // Timeouts, constants
    //
    public static final long HEARTBEAT_INTERVAL = 10 * 1000;
    public static final long TASKTRACKER_EXPIRY_INTERVAL = 10 * 60 * 1000;

    //
    // Result codes
    //
    public static int SUCCESS = 0;
    public static int FILE_NOT_FOUND = -1;
}

Increase some intervals to further reduce stress on the jobtracker.

git-svn-id: 4d48d1092ee340c9ada5711cdbe4355b138bc22b@383623 13f79535-47bb-0310-9956-ffa450edef68


package com.faforever.client.fx.contextmenu;

import com.faforever.client.domain.PlayerBean;
import com.faforever.client.i18n.I18n;
import com.faforever.client.player.PlayerInfoWindowController;
import com.faforever.client.player.SocialStatus;
import com.faforever.client.theme.UiService;
import com.faforever.client.util.Assert;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@RequiredArgsConstructor
public class ShowPlayerInfoMenuItem extends AbstractMenuItem<PlayerBean> {

  private final I18n i18n;
  private final UiService uiService;

  @Override
  protected void onClicked() {
    Assert.checkNullIllegalState(object, "no player has been set");
    PlayerInfoWindowController controller = uiService.loadFxml("theme/user_info_window.fxml");
    controller.setPlayer(object);
    controller.setOwnerWindow(getParentPopup().getOwnerWindow());
    controller.show();
  }

  @Override
  protected boolean isItemVisible() {
    return object != null && object.getSocialStatus() != SocialStatus.SELF;
  }

  @Override
  protected String getItemText() {
    return i18n.get("chat.userContext.userInfo");
  }
}

package com.faforever.client.fx.contextmenu;

import com.faforever.client.domain.PlayerBean;
import com.faforever.client.i18n.I18n;
import com.faforever.client.player.PlayerInfoWindowController;
import com.faforever.client.theme.UiService;
import com.faforever.client.util.Assert;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@RequiredArgsConstructor
public class ShowPlayerInfoMenuItem extends AbstractMenuItem<PlayerBean> {

  private final I18n i18n;
  private final UiService uiService;

  @Override
  protected void onClicked() {
    Assert.checkNullIllegalState(object, "no player has been set");
    PlayerInfoWindowController controller = uiService.loadFxml("theme/user_info_window.fxml");
    controller.setPlayer(object);
    controller.setOwnerWindow(getParentPopup().getOwnerWindow());
    controller.show();
  }

  @Override
  protected boolean isItemVisible() {
    return object != null;
  }

  @Override
  protected String getItemText() {
    return i18n.get("chat.userContext.userInfo");
  }
}

Allow players to see their own stats

Allow players to see their own stats


package top.quantic.sentry.discord.core;

import joptsimple.OptionSet;
import sx.blah.discord.handle.obj.IMessage;

public class CommandContext {

    private IMessage message;
    private String prefix;
    private Command command;
    private String[] args;
    private OptionSet optionSet;

    public IMessage getMessage() {
        return message;
    }

    public void setMessage(IMessage message) {
        this.message = message;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public Command getCommand() {
        return command;
    }

    public void setCommand(Command command) {
        this.command = command;
    }

    public String[] getArgs() {
        return args;
    }

    public void setArgs(String[] args) {
        this.args = args;
    }

    public OptionSet getOptionSet() {
        return optionSet;
    }

    public void setOptionSet(OptionSet optionSet) {
        this.optionSet = optionSet;
    }
}

package top.quantic.sentry.discord.core;

import joptsimple.OptionSet;
import sx.blah.discord.handle.obj.IMessage;

public class CommandContext {

    private IMessage message;
    private String prefix;
    private Command command;
    private String[] args;
    private OptionSet optionSet;

    public IMessage getMessage() {
        return message;
    }

    public void setMessage(IMessage message) {
        this.message = message;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public Command getCommand() {
        return command;
    }

    public void setCommand(Command command) {
        this.command = command;
    }

    public String[] getArgs() {
        return args;
    }

    public void setArgs(String[] args) {
        this.args = args;
    }

    public OptionSet getOptionSet() {
        return optionSet;
    }

    public void setOptionSet(OptionSet optionSet) {
        this.optionSet = optionSet;
    }

    public String getContentAfterPrefix() {
        if (message == null || prefix == null) {
            return null;
        }
        String content = message.getContent();
        if (!content.contains(prefix)) {
            return content;
        }
        return content.substring(prefix.length());
    }
}

Add method to get a command's content after the prefix


package revert.MainScene.notifications;

/**
 * Notification type of the game's scoring mechanics
 *
 * @author nhydock
 */
public class WorldNotification {

	private static final String SCORE_FMT = "$\n%d";
	private static final String TIME_FMT = "%02d";

	public final String score;
	public final String time;

	public WorldNotification(final int score, final int time)
	{
		this.score = String.format(SCORE_FMT, score);
		this.time = String.format(TIME_FMT, time);
	}

}

package revert.MainScene.notifications;

/**
 * Notification type of the game's scoring mechanics
 *
 * @author nhydock
 */
public class WorldNotification {

	private static final String SCORE_FMT = "$\n%d";
	private static final String TIME_FMT = "%02d";

	public final String score;
	public final String time;

	public WorldNotification(final int score, final int time)
	{
		this.score = String.format(SCORE_FMT, score);
		//make sure to convert time from ms to sec
		this.time = String.format(TIME_FMT, (int)(time/1000));
	}

}

Fix time display to be in seconds instead of ms


package net.minecraftforge.common;

import java.util.UUID;

import net.minecraft.src.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;
import net.minecraftforge.event.world.WorldEvent;

public class ForgeInternalHandler
{
    @ForgeSubscribe(priority = EventPriority.HIGHEST)
    public void onEntityJoinWorld(EntityJoinWorldEvent event)
    {
        if (!event.world.isRemote)
        {
            if (event.entity.getPersistentID() == null)
            {
                event.entity.generatePersistentID();
            }
            else
            {
                ForgeChunkManager.loadEntity(event.entity);
            }
        }
        Entity entity = event.entity;
        if (entity instanceof EntityItem)
        {
            ItemStack item = ((EntityItem)entity).item;
            if (item != null && item.getItem().hasCustomEntity(item))
            {
                Entity newEntity = item.getItem().createEntity(event.world, entity, item);
                if (newEntity != null)
                {
                    entity.setDead();
                    event.setCanceled(true);
                    event.world.spawnEntityInWorld(newEntity);
                }
            }
        }
    }

    @ForgeSubscribe(priority = EventPriority.HIGHEST)
    public void onDimensionLoad(WorldEvent.Load event)
    {
        ForgeChunkManager.loadWorld(event.world);
    }

    @ForgeSubscribe(priority = EventPriority.HIGHEST)
    public void onDimensionSave(WorldEvent.Save event)
    {
    	ForgeChunkManager.saveWorld(event.world);
    }
}

package net.minecraftforge.common;

import java.util.UUID;

import net.minecraft.src.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;
import net.minecraftforge.event.world.WorldEvent;

public class ForgeInternalHandler
{
    @ForgeSubscribe(priority = EventPriority.HIGHEST)
    public void onEntityJoinWorld(EntityJoinWorldEvent event)
    {
        if (!event.world.isRemote)
        {
            if (event.entity.getPersistentID() == null)
            {
                event.entity.generatePersistentID();
            }
            else
            {
                ForgeChunkManager.loadEntity(event.entity);
            }
        }
        Entity entity = event.entity;
        if (entity.getClass().equals(EntityItem.class))
        {
            ItemStack item = ((EntityItem)entity).item;
            if (item != null && item.getItem().hasCustomEntity(item))
            {
                Entity newEntity = item.getItem().createEntity(event.world, entity, item);
                if (newEntity != null)
                {
                    entity.setDead();
                    event.setCanceled(true);
                    event.world.spawnEntityInWorld(newEntity);
                }
            }
        }
    }

    @ForgeSubscribe(priority = EventPriority.HIGHEST)
    public void onDimensionLoad(WorldEvent.Load event)
    {
        ForgeChunkManager.loadWorld(event.world);
    }

    @ForgeSubscribe(priority = EventPriority.HIGHEST)
    public void onDimensionSave(WorldEvent.Save event)
    {
    	ForgeChunkManager.saveWorld(event.world);
    }
}

Make Item.createEntity only call when its specifically a EntityItem, not a subclass of it.


package io.induct.yle;

import com.google.inject.Guice;
import com.google.inject.Injector;
import io.induct.daniel.DanielModule;
import io.induct.yle.ioc.YleApiModule;
import org.junit.BeforeClass;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

/**
 * @since 2015-05-09
 */
public abstract class YleApiTestingBase {

    protected static Injector injector;

    @BeforeClass
    public static void preTestingSetUp() throws Exception {
        injector = Guice.createInjector(
                new DanielModule(),
                new YleApiModule());
    }

    protected InputStream asStream(String s) {
        return new ByteArrayInputStream(s.getBytes());
    }
}

package io.induct.yle;

import com.google.inject.Guice;
import com.google.inject.Injector;
import io.induct.daniel.DanielModule;
import io.induct.yle.ioc.YleApiModule;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import sun.net.www.http.HttpClient;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

/**
 * @since 2015-05-09
 */
public abstract class YleApiTestingBase {

    protected static Injector injector;

    @BeforeClass
    public static void preTestingSetUp() throws Exception {
        injector = Guice.createInjector(
                new DanielModule(),
                new YleApiModule());
    }

    @AfterClass
    public static void postTestingSetup() throws Exception {
        ((AutoCloseable) injector.getInstance(HttpClient.class)).close();
    }

    protected InputStream asStream(String s) {
        return new ByteArrayInputStream(s.getBytes());
    }
}

Clean up HttpClient after tests.

Clean up HttpClient after tests.


import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * Created by smurphy on 2/24/15.
 */
public class RampOptionsPanel extends OptionsPanel {
    JComboBox drop;
    RampSimulator rs;

    public RampOptionsPanel(RampSimulator rs){

        this.rs = rs;

        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

        JLabel title = new JLabel("Select a variable to graph:");
        title.setVisible(true);
        this.add(title);

        String[] sims = {"Kinetic Energy", "Potential Energy"};
        drop = new JComboBox<String>(sims);
        drop.setVisible(true);
        this.add(drop);

        JButton selected = new JButton("Submit");
        selected.setVisible(true);
        this.add(selected);

        selected.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                //Execute when button is pressed
                //System.out.println("You clicked the button");
                startSim();
            }
        });
    }

    private void startSim(){
        int k = drop.getSelectedIndex();
        System.out.println(k);
        //rs.startRecording(drop.get); To implement
    }
}

Test commit of the Ramp Options Panel

Test commit of the Ramp Options Panel


package com.jakewharton.trakt.entities;

import com.jakewharton.trakt.TraktEntity;

public class Response implements TraktEntity {
    private static final long serialVersionUID = 5921890886906816035L;

    public String status; //TODO: enum
    public String message;
    public String error;

    /** @deprecated Use {@link #status} */
    @Deprecated
    public String getStatus() {
        return this.status;
    }
    /** @deprecated Use {@link #message} */
    @Deprecated
    public String getMessage() {
        return this.message;
    }
    /** @deprecated Use {@link #error} */
    @Deprecated
    public String getError() {
        return this.error;
    }
}

package com.jakewharton.trakt.entities;

import com.jakewharton.trakt.TraktEntity;

public class Response implements TraktEntity {
    private static final long serialVersionUID = 5921890886906816035L;

    public String status; //TODO: enum
    public String message;
    public String error;
    public int wait;

    /** @deprecated Use {@link #status} */
    @Deprecated
    public String getStatus() {
        return this.status;
    }
    /** @deprecated Use {@link #message} */
    @Deprecated
    public String getMessage() {
        return this.message;
    }
    /** @deprecated Use {@link #error} */
    @Deprecated
    public String getError() {
        return this.error;
    }
}

Add wait field. This is used when checking in returns a failure. It specifies the time until the next possible check in.


package gwt.material.design.client.base.mixin;

/*
 * #%L
 * GwtBootstrap3
 * %%
 * Copyright (C) 2013 GwtBootstrap3
 * %%
 * 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.
 * #L%
 */

import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.user.client.ui.UIObject;

/**
 * @author Ben Dol
 */
public class TextMixin<T extends UIObject> extends AbstractMixin<T> {

    public TextMixin(final T uiObject) {
        super(uiObject);
    }

    public String getText() {
        return uiObject.getElement().getInnerText();
    }

    public void setText(final String text) {
        uiObject.getElement().setInnerText(text != null ? SafeHtmlUtils.htmlEscape(text) : "");
    }
}

package gwt.material.design.client.base.mixin;

/*
 * #%L
 * GwtBootstrap3
 * %%
 * Copyright (C) 2013 GwtBootstrap3
 * %%
 * 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.
 * #L%
 */

import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.user.client.ui.UIObject;

/**
 * @author Ben Dol
 */
public class TextMixin<T extends UIObject> extends AbstractMixin<T> {

    public TextMixin(final T uiObject) {
        super(uiObject);
    }

    public String getText() {
        return uiObject.getElement().getInnerText();
    }

    public void setText(final String text) {
        uiObject.getElement().setInnerText(text);
    }
}

Use setInnerText only which already solves XSS Attacks (Avoid duplication)


package specs;

import static com.greghaskins.spectrum.Spectrum.beforeEach;
import static com.greghaskins.spectrum.Spectrum.describe;
import static com.greghaskins.spectrum.Spectrum.it;
import static junit.framework.TestCase.assertNull;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import com.greghaskins.spectrum.Spectrum;
import com.greghaskins.spectrum.Variable;

import org.junit.runner.RunWith;

@RunWith(Spectrum.class)
public class VariableSpecs {
  {

    describe("The Variable convenience wrapper", () -> {

      final Variable<Integer> counter = new Variable<>();

      beforeEach(() -> {
        counter.set(0);
      });

      beforeEach(() -> {
        counter.set(counter.get() + 1);
      });

      it("lets you work around Java's requirement that closures only use `final` variables", () -> {
        counter.set(counter.get() + 1);
        assertThat(counter.get(), is(2));
      });

      it("can optionally have an initial value set", () -> {
        final Variable<String> name = new Variable<>("Alice");
        assertThat(name.get(), is("Alice"));
      });

      it("has a null value if not specified", () -> {
        final Variable<String> name = new Variable<>();
        assertNull(name.get());
      });

    });

  }
}

package specs;

import static com.greghaskins.spectrum.Spectrum.beforeAll;
import static com.greghaskins.spectrum.Spectrum.beforeEach;
import static com.greghaskins.spectrum.Spectrum.describe;
import static com.greghaskins.spectrum.Spectrum.it;
import static junit.framework.TestCase.assertNull;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import com.greghaskins.spectrum.Spectrum;
import com.greghaskins.spectrum.Variable;

import org.junit.runner.RunWith;

@RunWith(Spectrum.class)
public class VariableSpecs {
  {

    describe("The Variable convenience wrapper", () -> {

      final Variable<Integer> counter = new Variable<>();

      beforeAll(() -> {
        counter.set(0);
      });

      beforeEach(() -> {
        final int previousValue = counter.get();
        counter.set(previousValue + 1);
      });

      it("lets you work around Java's requirement that closures only use `final` variables", () -> {
        assertThat(counter.get(), is(1));
      });

      it("can share values across scopes, so use it carefully", () -> {
        assertThat(counter.get(), is(2));
      });

      it("can optionally have an initial value set", () -> {
        final Variable<String> name = new Variable<>("Alice");
        assertThat(name.get(), is("Alice"));
      });

      it("has a null value if not specified", () -> {
        final Variable<String> name = new Variable<>();
        assertNull(name.get());
      });

    });

  }
}

Clarify specs for Variable helper

Clarify specs for Variable helper


package rsc.publisher;

import java.util.Objects;

import org.reactivestreams.Subscriber;

import rsc.flow.Cancellation;
import rsc.scheduler.Scheduler;
import rsc.util.EmptySubscription;
import rsc.util.ExceptionHelper;

/**
 * Publisher indicating a scalar/empty source that subscribes on the specified scheduler.
 *
 * @param <T>
 */
final class PublisherSubscribeOnValue<T> extends Px<T> {

    final T value;

    final Scheduler scheduler;

    public PublisherSubscribeOnValue(T value,
            Scheduler scheduler) {
        this.value = value;
        this.scheduler = Objects.requireNonNull(scheduler, "scheduler");
    }

    @Override
    public void subscribe(Subscriber<? super T> s) {
        Scheduler.Worker worker;

        try {
            worker = scheduler.createWorker();
        } catch (Throwable e) {
            ExceptionHelper.throwIfFatal(e);
            EmptySubscription.error(s, e);
            return;
        }

        if (worker == null) {
            EmptySubscription.error(s, new NullPointerException("The scheduler returned a null Function"));
            return;
        }

        T v = value;
        if (v == null) {
            PublisherSubscribeOn.ScheduledEmpty parent = new PublisherSubscribeOn.ScheduledEmpty(s);
            s.onSubscribe(parent);
            Cancellation f = scheduler.schedule(parent);
            parent.setFuture(f);
        } else {
            s.onSubscribe(new PublisherSubscribeOn.ScheduledScalar<>(s, v, scheduler));
        }
    }
}

package rsc.publisher;

import java.util.Objects;

import org.reactivestreams.Subscriber;

import rsc.flow.Cancellation;
import rsc.scheduler.Scheduler;

/**
 * Publisher indicating a scalar/empty source that subscribes on the specified scheduler.
 *
 * @param <T>
 */
final class PublisherSubscribeOnValue<T> extends Px<T> {

    final T value;

    final Scheduler scheduler;

    public PublisherSubscribeOnValue(T value,
            Scheduler scheduler) {
        this.value = value;
        this.scheduler = Objects.requireNonNull(scheduler, "scheduler");
    }

    @Override
    public void subscribe(Subscriber<? super T> s) {
        T v = value;
        if (v == null) {
            PublisherSubscribeOn.ScheduledEmpty parent = new PublisherSubscribeOn.ScheduledEmpty(s);
            s.onSubscribe(parent);
            Cancellation f = scheduler.schedule(parent);
            parent.setFuture(f);
        } else {
            s.onSubscribe(new PublisherSubscribeOn.ScheduledScalar<>(s, v, scheduler));
        }
    }
}

Remove unused worker (and thus a worker leak)


package us.crast.mondochest.persist;

import org.bukkit.Location;
import org.bukkit.entity.Player;

public class PlayerState {
	private Location lastClickedMaster;
	private State state = State.NORMAL;
	public PlayerState(Player player) {}

	/* Getters/Setters */
	public Location getLastClickedMaster() {
		return lastClickedMaster;
	}
	public void setLastClickedMaster(Location lastClickedMaster) {
		this.lastClickedMaster = lastClickedMaster;
	}

	public boolean isManagingChest() {
	    return this.state == State.MANAGING_CHEST;
	}

	public void setManagingChest() {
	    this.state = State.MANAGING_CHEST;
	}

	public void setNormalMode() {
	    this.state = State.NORMAL;
	}

	enum State {
	    NORMAL,
	    MANAGING_CHEST;
	}
}

package us.crast.mondochest.persist;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;

public class PlayerState {
	private String lastClickedWorld;
	private Vector lastClickedVector;

	private State state = State.NORMAL;
	public PlayerState(Player player) {}

	/* Getters/Setters */
	public Location getLastClickedMaster() {
		return new Location(
		    Bukkit.getWorld(lastClickedWorld),
		    lastClickedVector.getX(),
		    lastClickedVector.getY(),
		    lastClickedVector.getZ()
		);
	}

	public void setLastClickedMaster(Location lastClickedMaster) {
		this.lastClickedWorld = lastClickedMaster.getWorld().toString();
		this.lastClickedVector = lastClickedMaster.toVector();
	}

	public boolean isManagingChest() {
	    return this.state == State.MANAGING_CHEST;
	}

	public void setManagingChest() {
	    this.state = State.MANAGING_CHEST;
	}

	public void setNormalMode() {
	    this.state = State.NORMAL;
	}

	enum State {
	    NORMAL,
	    MANAGING_CHEST;
	}
}

Clean up possible World memory leak in storing locations.


/*
 ** 2013 July 01
 **
 ** The author disclaims copyright to this source code.  In place of
 ** a legal notice, here is a blessing:
 **    May you do good and not evil.
 **    May you find forgiveness for yourself and forgive others.
 **    May you share freely, never taking more than you give.
 */
package info.ata4.unity.cli.extract;

import info.ata4.unity.serdes.UnityObject;
import java.io.IOException;

/**
 *
 * @author Nico Bergemann <barracuda415 at yahoo.de>
 */
public class TextAssetHandler extends AssetExtractHandler {

    public TextAssetHandler(String ext) {
        setOutputFileExtension(ext);
    }

    @Override
    public void extract(UnityObject obj) throws IOException {
        String name = obj.getValue("m_Name");
        String script = obj.getValue("m_Script");

        setOutputFileName(name);
        writeData(script.getBytes("UTF8"));
    }
}

/*
 ** 2013 July 01
 **
 ** The author disclaims copyright to this source code.  In place of
 ** a legal notice, here is a blessing:
 **    May you do good and not evil.
 **    May you find forgiveness for yourself and forgive others.
 **    May you share freely, never taking more than you give.
 */
package info.ata4.unity.cli.extract;

import info.ata4.unity.serdes.UnityObject;
import info.ata4.unity.serdes.UnityString;
import java.io.IOException;

/**
 *
 * @author Nico Bergemann <barracuda415 at yahoo.de>
 */
public class TextAssetHandler extends AssetExtractHandler {

    public TextAssetHandler(String ext) {
        setOutputFileExtension(ext);
    }

    @Override
    public void extract(UnityObject obj) throws IOException {
        String name = obj.getValue("m_Name");
        UnityString script = obj.getValue("m_Script", false);

        setOutputFileName(name);
        writeData(script.getRaw());
    }
}

Write strings directly and don't convert them to UTF-8


package sg.ncl.testbed_interface;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author Christopher Zhong
 */
@Configuration
@EnableJpaRepositories
@EnableTransactionManagement
public class JpaConfig {
}

package sg.ncl.testbed_interface;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author Christopher Zhong
 */
@Configuration
@EnableJpaRepositories
@EnableJpaAuditing
@EnableTransactionManagement
public class JpaConfig {
}

Enable auditing of entities (DEV-15)

Enable auditing of entities (DEV-15)


package org.realityforge.replicant.server.transport;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonTypeName;

@JsonAutoDetect( fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE, isGetterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE )
@JsonTypeName( "testFilter" )
public class TestFilter
{
  private int myField;

  public TestFilter()
  {
  }

  public TestFilter( final int myField )
  {
    this.myField = myField;
  }

  public int getMyField()
  {
    return myField;
  }
}

package org.realityforge.replicant.server.transport;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.Serializable;

@JsonAutoDetect( fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE, isGetterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE )
@JsonTypeName( "testFilter" )
public class TestFilter
  implements Serializable
{
  private int myField;

  public TestFilter()
  {
  }

  public TestFilter( final int myField )
  {
    this.myField = myField;
  }

  public int getMyField()
  {
    return myField;
  }
}

Make class serializable to make testing easier


package com.attehuhtakangas.navigationbar;

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 NavigationBarPackage implements ReactPackage {

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();
        modules.add(new NavigationBarModule(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.attehuhtakangas.navigationbar;

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 NavigationBarPackage implements ReactPackage {

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

        return modules;
    }

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

Fix react native support for v0.47 on the proper file


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

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

/**
 * Annotation that identifies a Class as a Plugin.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Plugin {
    /**
     * Value of the elementType when none is specified.
     */
    String EMPTY = "";

    String name();
    String category();
    String elementType() default EMPTY;
    boolean printObject() default false;
    boolean deferChildren() default false;
}

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

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

import org.apache.logging.log4j.util.Strings;

/**
 * Annotation that identifies a Class as a Plugin.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Plugin {

    /**
     * Value of the elementType when none is specified.
     */
    String EMPTY = Strings.EMPTY;

    String name();
    String category();
    String elementType() default EMPTY;
    boolean printObject() default false;
    boolean deferChildren() default false;
}

Refactor magic strings into a constant.

Refactor magic strings into a constant.

git-svn-id: de5ce936019686f47409c93bcc5e202a9739563b@1594249 13f79535-47bb-0310-9956-ffa450edef68


package com.alexstyl.specialdates.search;

import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.EditText;

public class BackKeyEditText extends EditText {
    public BackKeyEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    private OnBackKeyPressedListener listener;

    public void setOnBackKeyPressedListener(OnBackKeyPressedListener listener) {
        this.listener = listener;
    }

    @Override
    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && listener.onBackButtonPressed()) {
            return true;
        }
        return super.onKeyPreIme(keyCode, event);
    }
}

package com.alexstyl.specialdates.search;

import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.EditText;

public class BackKeyEditText extends android.support.v7.widget.AppCompatEditText {
    public BackKeyEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    private OnBackKeyPressedListener listener;

    public void setOnBackKeyPressedListener(OnBackKeyPressedListener listener) {
        this.listener = listener;
    }

    @Override
    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && listener.onBackButtonPressed()) {
            return true;
        }
        return super.onKeyPreIme(keyCode, event);
    }
}

Extend AppCompatEditText instead of system EditText


package com.kickstarter.libs;

import android.util.Pair;

import rx.Observable;

public class RxUtils {
  private RxUtils() {
    throw new AssertionError();
  }

  public static <F, S> Observable<Pair<F, S>> combineLatestPair(final Observable<F> ob1, final Observable<S> ob2) {
    return Observable.combineLatest(ob1, ob2, Pair::new);
  }

  public static <F, S> Observable<F> takeWhen(final Observable<F> ob1, final Observable<S> ob2) {
    return RxUtils.combineLatestPair(ob1, ob2).map(x -> x.first);
  }
}

package com.kickstarter.libs;

import android.util.Pair;

import rx.Observable;

public class RxUtils {
  private RxUtils() {
    throw new AssertionError();
  }

  public static <F, S> Observable<Pair<F, S>> combineLatestPair(final Observable<F> ob1, final Observable<S> ob2) {
    return Observable.combineLatest(ob1, ob2, Pair::new);
  }

  // Take values of ob1 when ob2 pings
  public static <F, S> Observable<F> takeWhen(final Observable<F> ob1, final Observable<S> ob2) {
    return RxUtils.combineLatestPair(ob1, ob2).map(x -> x.first);
  }
}

Add a lil comment explaining takeWhen

Add a lil comment explaining takeWhen


package edu.hm.hafner.analysis.registry;

import edu.hm.hafner.analysis.IssueParser;
import edu.hm.hafner.analysis.parser.CppLintParser;

/**
 * A descriptor for Cpplint.
 *
 * @author Lorenz Munsch
 */
class CppLintDescriptor extends ParserDescriptor {
    private static final String ID = "cpplint";
    private static final String NAME = "Cpplint";

    CppLintDescriptor() {
        super(ID, NAME);
    }

    @Override
    public IssueParser createParser(final Option... options) {
        return new CppLintParser();
    }
}

package edu.hm.hafner.analysis.registry;

import edu.hm.hafner.analysis.IssueParser;
import edu.hm.hafner.analysis.parser.CppLintParser;

/**
 * A descriptor for Cpplint.
 *
 * @author Lorenz Munsch
 */
class CppLintDescriptor extends ParserDescriptor {
    private static final String ID = "cpplint";
    private static final String NAME = "Cpplint";

    CppLintDescriptor() {
        super(ID, NAME);
    }

    @Override
    public IssueParser createParser(final Option... options) {
        return new CppLintParser();
    }

    @Override
    public String getHelp() {
        return "You need to use the Eclipse format with the option <code>--output=eclipse</code>";
    }
}

Add a help for cpplint.

Add a help for cpplint.


/*
 * Copyright 2005-2010 The Kuali Foundation
 *
 * Licensed under the Educational Community 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.opensource.org/licenses/ecl1.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.kra.iacuc.personnel;

import org.kuali.kra.protocol.personnel.ProtocolPerson;

public class IacucProtocolPerson extends ProtocolPerson {

    /**
     * Comment for serialVersionUID
     */
    private static final long serialVersionUID = 6676849646094141708L;

}

/*
 * Copyright 2005-2010 The Kuali Foundation
 *
 * Licensed under the Educational Community 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.opensource.org/licenses/ecl1.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.kra.iacuc.personnel;

import org.kuali.kra.iacuc.IacucProtocol;
import org.kuali.kra.protocol.personnel.ProtocolPerson;

public class IacucProtocolPerson extends ProtocolPerson {

    private static final long serialVersionUID = 6676849646094141708L;

    public IacucProtocol getIacucProtocol() {
        return (IacucProtocol) getProtocol();
    }

}

KCIAC-332: Implement COI event type of "IACUC Protocol"


package vg.civcraft.mc.civmodcore.chatDialog;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.TabCompleteEvent;

public class ChatListener implements Listener {

	@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
	public void tabComplete(TabCompleteEvent e) {
		if (!(e.getSender() instanceof Player)) {
			return;
		}
		Dialog dia = DialogManager.getDialog((Player) e.getSender());
		if (dia != null) {
			String[] split = e.getBuffer().split(" ");
			e.setCompletions(dia.onTabComplete(split.length > 0 ? split[split.length - 1] : "", split));
		}
	}

	@EventHandler
	public void logoff(PlayerQuitEvent e) {
		DialogManager.forceEndDialog(e.getPlayer());
	}

}

package vg.civcraft.mc.civmodcore.chatDialog;

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

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.TabCompleteEvent;

public class ChatListener implements Listener {

	@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
	public void tabComplete(TabCompleteEvent e) {
		if (!(e.getSender() instanceof Player)) {
			return;
		}
		Dialog dia = DialogManager.getDialog((Player) e.getSender());
		if (dia != null) {
			String[] split = e.getBuffer().split(" ");
			List <String> complet = dia.onTabComplete(split.length > 0 ? split[split.length - 1] : "", split);
			if (complet == null) {
				complet = Collections.emptyList();
			}
			e.setCompletions(complet);
		}
	}

	@EventHandler
	public void logoff(PlayerQuitEvent e) {
		DialogManager.forceEndDialog(e.getPlayer());
	}

}

FIx exception in dialog tab completion

FIx exception in dialog tab completion


package be.digitalia.fosdem.livedata;

import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;

import java.util.concurrent.TimeUnit;

public class LiveDataFactory {

	static final Handler handler = new Handler(Looper.getMainLooper());

	private LiveDataFactory() {
	}

	private static class IntervalLiveData extends LiveData<Long> implements Runnable {

		private final long periodInMillis;
		private long updateTime = 0L;
		private long version = 0L;

		IntervalLiveData(long periodInMillis) {
			this.periodInMillis = periodInMillis;
		}

		@Override
		protected void onActive() {
			if (version == 0L) {
				run();
			} else {
				final long now = SystemClock.elapsedRealtime();
				if (now >= updateTime) {
					handler.post(this);
				} else {
					handler.postDelayed(this, updateTime - now);
				}
			}
		}

		@Override
		protected void onInactive() {
			handler.removeCallbacks(this);
		}

		@Override
		public void run() {
			setValue(version++);
			updateTime = SystemClock.elapsedRealtime() + periodInMillis;
			handler.postDelayed(this, periodInMillis);
		}
	}

	public static LiveData<Long> interval(long period, @NonNull TimeUnit unit) {
		return new IntervalLiveData(unit.toMillis(period));
	}
}

package be.digitalia.fosdem.livedata;

import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;

import java.util.concurrent.TimeUnit;

public class LiveDataFactory {

	static final Handler handler = new Handler(Looper.getMainLooper());

	private LiveDataFactory() {
	}

	private static class IntervalLiveData extends LiveData<Long> implements Runnable {

		private final long periodInMillis;
		private long updateTime = 0L;
		private long version = 0L;

		IntervalLiveData(long periodInMillis) {
			this.periodInMillis = periodInMillis;
		}

		@Override
		protected void onActive() {
			final long now = SystemClock.elapsedRealtime();
			if (now >= updateTime) {
				update(now);
			} else {
				handler.postDelayed(this, updateTime - now);
			}
		}

		@Override
		protected void onInactive() {
			handler.removeCallbacks(this);
		}

		private void update(long now) {
			setValue(version++);
			updateTime = now + periodInMillis;
			handler.postDelayed(this, periodInMillis);
		}

		@Override
		public void run() {
			update(SystemClock.elapsedRealtime());
		}
	}

	public static LiveData<Long> interval(long period, @NonNull TimeUnit unit) {
		return new IntervalLiveData(unit.toMillis(period));
	}
}

Revert "Delay IntervalLiveData refresh to allow the previous result to be dispatched on active even when it's already expired"

This reverts commit 2f166836


package net.silentchaos512.lib.recipe;

import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.silentchaos512.lib.util.StackHelper;

public class RecipeBaseSL extends net.minecraftforge.registries.IForgeRegistryEntry.Impl<IRecipe> implements IRecipeSL {

  @Override
  public ItemStack getCraftingResult(InventoryCrafting inv) {

    return StackHelper.empty();
  }

  @Override
  public boolean canFit(int width, int height) {

    return true;
  }
}

package net.silentchaos512.lib.recipe;

import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.silentchaos512.lib.util.StackHelper;

public class RecipeBaseSL extends net.minecraftforge.registries.IForgeRegistryEntry.Impl<IRecipe> implements IRecipeSL {

  @Override
  public ItemStack getCraftingResult(InventoryCrafting inv) {

    return StackHelper.empty();
  }

  @Override
  public boolean canFit(int width, int height) {

    return true;
  }

  @Override
  public boolean isHidden() {

    return true;
  }
}

Hide custom recipes in recipe book

Hide custom recipes in recipe book


package gov.nih.nci.nbia.beans.basket;
import gov.nih.nci.nbia.zip.ZipManager;

import com.icesoft.faces.async.render.SessionRenderer;

/**
 * This listens to zip progress and tell ICEfaces to push a change
 * to the UI as progress increases.
 *
 * <p>This object is a result of switching to ICEfaces which
 * broke the old ajax progress bar.
 */
public class ZipManagerProgressManager implements ZipManager.ZipManagerListener {
	public ZipManagerProgressManager(/*BasketBean basketBean*/) {
		//this.basketBean = basketBean;
	}

	public void progressUpdate() {
        // Increase the finished percent, and render the page
       	SessionRenderer.render(ALL);
	}

	public void completed() {
		//let ui set this
        //basketBean.setDownloading(false);
		System.out.println("completed zipping!!!");
        SessionRenderer.render(ALL);
	}

	private static final String ALL = "all";
}

Change for fixing session ID fixation problem.


package gr.iti.mklab.simmo.core;

import org.mongodb.morphia.annotations.Embedded;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * An Annotatable abstract class implemented by objects that can be annotated
 *
 * @author kandreadou
 * @version 1.0.0
 * @since July 3, 2014
 */
public abstract class Annotatable implements Associated {

    @Embedded
    private List<Annotation> annotations = new ArrayList<Annotation>();

    public void addAnnotation(Annotation a) {
        annotations.add(a);
    }

    public void removeAnnotation(Annotation a) {
        annotations.remove(a);
    }

    public void setAnnotations(List<Annotation> annotations) {
        this.annotations = annotations;
    }

    public Annotation getAnnotation(int position) {
        return annotations.get(position);
    }

    public List<? extends Annotation> getAnnotationsByClass(Class clazz) {
        return annotations.stream().filter(t -> t.getClass() == clazz)
                .collect(Collectors.toList());
    }

}

package gr.iti.mklab.simmo.core;

import org.mongodb.morphia.annotations.Embedded;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * An Annotatable abstract class implemented by objects that can be annotated
 *
 * @author kandreadou
 * @version 1.0.0
 * @since July 3, 2014
 */
public abstract class Annotatable implements Associated {

    @Embedded
    private List<Annotation> annotations = new ArrayList<Annotation>();

    public void addAnnotation(Annotation a) {
        annotations.add(a);
    }

    public void removeAnnotation(Annotation a) {
        annotations.remove(a);
    }

    public void setAnnotations(List<Annotation> annotations) {
        this.annotations = annotations;
    }

    public Annotation getAnnotation(int position) {
        return annotations.get(position);
    }

    public List<Annotation> getAnnotations() {
        return annotations;
    }

    public List<? extends Annotation> getAnnotationsByClass(Class clazz) {
        return annotations.stream().filter(t -> t.getClass() == clazz)
                .collect(Collectors.toList());
    }

}

Add getter in annotable class

Add getter in annotable class


package org.ndexbio.model.object;

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

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)

public class NetworkSet extends NdexExternalObject {

	private String name;
	private String description;
	private UUID ownerId;
	private List<UUID> networks;

	public NetworkSet () {
		super();
		networks = new ArrayList<>(30);
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public UUID getOwnerId() {
		return ownerId;
	}
	public void setOwnerId(UUID ownerId) {
		this.ownerId = ownerId;
	}
	public List<UUID> getNetworks() {
		return networks;
	}
	public void setNetworks(List<UUID> networks) {
		this.networks = networks;
	}

}

package org.ndexbio.model.object;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)

public class NetworkSet extends NdexExternalObject {

	private String name;
	private String description;
	private UUID ownerId;
	private List<UUID> networks;
	private boolean showcased;

    private Map<String, Object> properties;

	public NetworkSet () {
		super();
		networks = new ArrayList<>(30);
		properties = new HashMap<>();
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public UUID getOwnerId() {
		return ownerId;
	}
	public void setOwnerId(UUID ownerId) {
		this.ownerId = ownerId;
	}
	public List<UUID> getNetworks() {
		return networks;
	}
	public void setNetworks(List<UUID> networks) {
		this.networks = networks;
	}

	public Map<String, Object> getProperties() {
		return properties;
	}

	public void setProperties(Map<String, Object> properties) {
		this.properties = properties;
	}

	public boolean isShowcased() {
		return showcased;
	}

	public void setShowcased(boolean showcased) {
		this.showcased = showcased;
	}

}

Add showcase flag in networkset.

Add showcase flag in networkset.


package remonsinnema.blog.fizzbuzz;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class FizzBuzzTest {

  private final FizzBuzz fizzbuzz = new FizzBuzz();

  @Test
  public void test() {
    assertFizzBuzz("1", 1);
    assertFizzBuzz("2", 2);
    assertFizzBuzz("Fizz", 3);
    assertFizzBuzz("4", 4);
    assertFizzBuzz("Buzz", 5);
  }

  private void assertFizzBuzz(String expected, int n) {
    assertEquals(Integer.toString(n), expected, fizzbuzz.get(n));
  }

}

package remonsinnema.blog.fizzbuzz;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class FizzBuzzTest {

  private final FizzBuzz fizzbuzz = new FizzBuzz();

  @Test
  public void test() {
    assertFizzBuzz("1", 1);
    assertFizzBuzz("2", 2);
    assertFizzBuzz("Fizz", 3);
    assertFizzBuzz("4", 4);
    assertFizzBuzz("Buzz", 5);
    assertFizzBuzz("Fizz", 6);
    assertFizzBuzz("7", 7);
    assertFizzBuzz("8", 8);
    assertFizzBuzz("Fizz", 9);
    assertFizzBuzz("Buzz", 10);
    assertFizzBuzz("11", 11);
    assertFizzBuzz("Fizz", 12);
    assertFizzBuzz("13", 13);
    assertFizzBuzz("14", 14);
    assertFizzBuzz("FizzBuzz", 15);
  }

  private void assertFizzBuzz(String expected, int n) {
    assertEquals(Integer.toString(n), expected, fizzbuzz.get(n));
  }

}

Add test for simultaneous Fizz and Buzz

Add test for simultaneous Fizz and Buzz


package com.huixinpn.dionysus.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.huixinpn.dionysus.domain.User;
import com.huixinpn.dionysus.service.UserService;

@Controller
public class LoginController {

	private UserService userService;

	@Autowired
	public LoginController(UserService service) {
		this.userService = service;
	}

	@RequestMapping(value = "/login", method = RequestMethod.POST)
	public void login(@RequestBody User user) {
		userService.sign(user.getUsername(),
				user.getPassword());
	}

	@RequestMapping(value = "/login/failure", method = RequestMethod.GET)
 	public String loginFailure() {
		String message = "Login Failure!";
		return "redirect:/login?message="+message;
	}

	@RequestMapping(value = "/logout", method = RequestMethod.GET)
	public String logout() {
		String message = "Logout Success!";
		return "redirect:/login?message="+message;
	}

	@RequestMapping(value = "/validate/users", method = RequestMethod.POST)
	public boolean validate(@RequestBody User user) {
		return userService.userValidation(
				user.getUsername(),
				user.getPassword());
	}
}

package com.huixinpn.dionysus.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.huixinpn.dionysus.domain.User;
import com.huixinpn.dionysus.service.UserService;

@Controller
public class LoginController {

	private UserService userService;

	@Autowired
	public LoginController(UserService service) {
		this.userService = service;
	}

	@RequestMapping(value = "/login", method = RequestMethod.POST)
	public void login(@RequestBody User user) {
		userService.sign(user.getUsername(),
				user.getPassword());
	}

	@RequestMapping(value = "/login/failure", method = RequestMethod.GET)
 	public String loginFailure() {
		String message = "Login Failure!";
		return "redirect:/login?message="+message;
	}

	@RequestMapping(value = "/logout", method = RequestMethod.GET)
	public String logout() {
		String message = "Logout Success!";
		return "redirect:/login?message="+message;
	}

	@RequestMapping(value = "/validate/users", method = RequestMethod.POST)
	public boolean validate(@RequestBody User user) {
		return userService.userValidation(
				user.getUsername(),
				user.getPassword());
	}

	@RequestMapping(value = "/register", method = RequestMethod.POST)
	public User register(@RequestBody User user) {
		return userService.register(user);
	}
}

Update login controller for register

Update login controller for register


/**
 * Copyright (c) 2017-present, Stanislav Doskalenko - doskalenko.s@gmail.com
 * All rights reserved.
 *
 * This source code is licensed under the MIT-style license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * Based on Asim Malik's android source code, copyright (c) 2015
 *
 **/

package com.reactnative.googlefit;

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

public class GoogleFitPackage implements ReactPackage {

    public static String PACKAGE_NAME;

    public GoogleFitPackage(String PACKAGE_NAME) {
        this.PACKAGE_NAME = PACKAGE_NAME;
    }

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();
        modules.add(new GoogleFitModule(reactContext));
        return modules;
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return new ArrayList<>();
    }
}

/**
 * Copyright (c) 2017-present, Stanislav Doskalenko - doskalenko.s@gmail.com
 * All rights reserved.
 *
 * This source code is licensed under the MIT-style license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * Based on Asim Malik's android source code, copyright (c) 2015
 *
 **/

package com.reactnative.googlefit;

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

public class GoogleFitPackage implements ReactPackage {

    public static String PACKAGE_NAME;

    public GoogleFitPackage(String PACKAGE_NAME) {
        this.PACKAGE_NAME = PACKAGE_NAME;
    }

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();
        modules.add(new GoogleFitModule(reactContext));
        return modules;
    }

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

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return new ArrayList<>();
    }
}

Fix backward compatibility for RN < 0.47


package ee.tuleva.onboarding.config;

import static org.digidoc4j.Configuration.Mode.PROD;
import static org.digidoc4j.Configuration.Mode.TEST;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

@Configuration
public class DigiDocConfiguration {

  @Bean
  @Profile("production")
  public org.digidoc4j.Configuration digiDocConfigProd() {
    return new org.digidoc4j.Configuration(PROD);
  }

  @Bean
  @ConditionalOnMissingBean(org.digidoc4j.Configuration.class)
  public org.digidoc4j.Configuration digiDocConfigDev() {
    // use PROD for testing signing
    return new org.digidoc4j.Configuration(TEST);
  }
}

package ee.tuleva.onboarding.config;

import static org.digidoc4j.Configuration.Mode.PROD;
import static org.digidoc4j.Configuration.Mode.TEST;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

@Configuration
public class DigiDocConfiguration {

  @Bean
  @Profile({"production", "staging"})
  public org.digidoc4j.Configuration digiDocConfigProd() {
    return new org.digidoc4j.Configuration(PROD);
  }

  @Bean
  @ConditionalOnMissingBean(org.digidoc4j.Configuration.class)
  public org.digidoc4j.Configuration digiDocConfigDev() {
    // use PROD for testing signing
    return new org.digidoc4j.Configuration(TEST);
  }
}

Add staging profile to digidoc

Add staging profile to digidoc


package io.bekti.anubis.server.kafka;

import org.eclipse.jetty.websocket.api.Session;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;

public class PingThread extends Thread {

    private static Logger log = LoggerFactory.getLogger(DispatcherThread.class);
    private AtomicBoolean running = new AtomicBoolean(false);

    private Session session;
    private KafkaWebSocketClient client;

    public PingThread(Session session, KafkaWebSocketClient client) {
        this.session = session;
        this.client = client;
    }

    @Override
    public void run() {
        running.set(true);

        JSONObject payload = new JSONObject();
        payload.put("event", "ping");

        while (running.get()) {
            try {
                if (session.isOpen()) {
                    session.getRemote().sendString(payload.toString());
                } else {
                    client.shutdown();
                }

                Thread.sleep(5000);
            } catch (IOException ioe) {
                client.shutdown();
            } catch (InterruptedException ignored) {

            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
        }
    }

    public boolean isRunning() {
        return running.get();
    }

    public void shutdown() {
        if (running.get()) {
            running.set(false);
            Thread.currentThread().interrupt();
        }
    }

}

package io.bekti.anubis.server.kafka;

import org.eclipse.jetty.websocket.api.Session;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;

public class PingThread extends Thread {

    private static Logger log = LoggerFactory.getLogger(DispatcherThread.class);
    private AtomicBoolean running = new AtomicBoolean(false);

    private Session session;
    private KafkaWebSocketClient client;

    public PingThread(Session session, KafkaWebSocketClient client) {
        this.session = session;
        this.client = client;
    }

    @Override
    public void run() {
        running.set(true);

        JSONObject payload = new JSONObject();
        payload.put("event", "ping");

        while (running.get()) {
            try {
                if (session.isOpen()) {
                    session.getRemote().sendString(payload.toString());
                } else {
                    client.shutdown();
                }

                Thread.sleep(25000);
            } catch (IOException ioe) {
                client.shutdown();
            } catch (InterruptedException ignored) {

            } catch (Exception e) {
                log.error(e.getMessage(), e);
            }
        }
    }

    public boolean isRunning() {
        return running.get();
    }

    public void shutdown() {
        if (running.get()) {
            running.set(false);
            Thread.currentThread().interrupt();
        }
    }

}

Change ping interval to 25 seconds.

Change ping interval to 25 seconds.


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

import org.gradle.api.Incubating;
import org.gradle.tooling.Failure;

import java.util.List;

/**
 * Provides information about the failed execution of an operation.
 *
 * @since 2.4
 */
@Incubating
public interface FailureOutcome extends Outcome {

    /**
     * Returns the exceptions that occurred while running the operation, if any.
     *
     * @return the exceptions, empty if the operation failed without any exceptions
     */
    List<Failure> getFailures();

}

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

import org.gradle.api.Incubating;
import org.gradle.tooling.Failure;

import java.util.List;

/**
 * Provides information about the failed execution of an operation.
 *
 * @since 2.4
 */
@Incubating
public interface FailureOutcome extends Outcome {

    /**
     * Returns the exceptions that occurred while running the operation, if any.
     *
     * @return the exceptions, empty if the operation failed without any exceptions
     */
    List<? extends Failure> getFailures();

}

Allow operation failures to be specialized.


/*
 * Copyright (c) 2017 Robert 'Bobby' Zenz
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.bonsaimind.arbitrarylines.lines;

import org.eclipse.swt.SWT;

public enum LineStyle {
	SOLID(SWT.LINE_SOLID), DASH(SWT.LINE_DASH), DOT(SWT.LINE_DOT), DASHDOT(SWT.LINE_DASHDOT), DASHDOTDOT(SWT.LINE_DASHDOTDOT);

	private static final String[] styleStrings = new String[DASHDOTDOT.ordinal() + 1];
	private final int swtStyle;

	static {
		for (LineStyle type : LineStyle.values()) {
			styleStrings[type.ordinal()] = type.toString();
		}
	}

	private LineStyle(int swtEquivalent) {
		swtStyle = swtEquivalent;
	}

	public static final String[] getStyleStrings() {
		return styleStrings;
	}

	public int getSwtStyle() {
		return swtStyle;
	}
}

/*
 * Copyright (c) 2017 Robert 'Bobby' Zenz
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.bonsaimind.arbitrarylines.lines;

import org.eclipse.swt.SWT;

public enum LineStyle {
	DASH(SWT.LINE_DASH), DASHDOT(SWT.LINE_DASHDOT), DASHDOTDOT(SWT.LINE_DASHDOTDOT), DOT(SWT.LINE_DOT), SOLID(SWT.LINE_SOLID);

	private static final String[] styleStrings = new String[] { SOLID.toString(), DASH.toString(), DOT.toString(), DASHDOT.toString(), DASHDOTDOT.toString() };
	private final int swtStyle;

	private LineStyle(int swtEquivalent) {
		swtStyle = swtEquivalent;
	}

	public static final String[] getStyleStrings() {
		return styleStrings;
	}

	public int getSwtStyle() {
		return swtStyle;
	}
}

Modify so that sort order of literals doesn't matter.


package com.antew.redditinpictures;

import com.antew.redditinpictures.library.RedditInPicturesApplication;
import com.antew.redditinpictures.ui.ImageDetailActivityFree;
import com.antew.redditinpictures.ui.ImageGridActivityFree;
import com.antew.redditinpictures.ui.ImageGridFragmentFree;
import com.antew.redditinpictures.ui.ImageListFragmentFree;
import com.antew.redditinpictures.ui.ImgurAlbumActivityFree;
import dagger.Module;

/**
 * Dagger module for setting up provides statements.
 * Register all of your entry points below.
 */
@Module
    (
        complete = false,
        overrides = true,
        injects = {
            ImageGridFragmentFree.class,
            ImageListFragmentFree.class,
            ImageGridActivityFree.class,
            ImageDetailActivityFree.class,
            ImgurAlbumActivityFree.class
        }, library = true
    )
public class ApplicationModuleFree {

}

package com.antew.redditinpictures;

import com.antew.redditinpictures.library.RedditInPicturesApplication;
import com.antew.redditinpictures.library.ui.ImageDetailFragment;
import com.antew.redditinpictures.ui.ImageDetailActivityFree;
import com.antew.redditinpictures.ui.ImageGridActivityFree;
import com.antew.redditinpictures.ui.ImageGridFragmentFree;
import com.antew.redditinpictures.ui.ImageListFragmentFree;
import com.antew.redditinpictures.ui.ImgurAlbumActivityFree;
import dagger.Module;

/**
 * Dagger module for setting up provides statements.
 * Register all of your entry points below.
 */
@Module
    (
        complete = false,
        overrides = true,
        injects = {
            ImageGridFragmentFree.class,
            ImageListFragmentFree.class,
            ImageGridActivityFree.class,
            ImageDetailActivityFree.class,
            ImageDetailFragment.class,
            ImgurAlbumActivityFree.class
        }, library = true
    )
public class ApplicationModuleFree {

}

Add missing ImageDetailFragment declaration for dependency injection.


/*
 * Copyright (c) 2015. Troels Liebe Bentsen <tlb@nversion.dk>
 * Licensed under the MIT license (LICENSE.txt)
 */

package dk.nversion.copybook.converters;

import dk.nversion.copybook.exceptions.TypeConverterException;

public class IntegerToBoolean extends IntegerToInteger {

    @Override
    public void validate(Class<?> type, int size, int decimals) {
        if(!(Boolean.class.equals(type) || Boolean.TYPE.equals(type))) {
            throw new TypeConverterException("Only supports converting to and from int or Integer");
        }
    }

    @Override
    public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) {
        return (int)super.to(bytes, offset, length, decimals, removePadding) != 0;
    }

    @Override
    public byte[] from(Object value, int length, int decimals, boolean addPadding) {
        return super.from((boolean)value ? 1 : 0, length, decimals, addPadding);
    }
}

/*
 * Copyright (c) 2015. Troels Liebe Bentsen <tlb@nversion.dk>
 * Licensed under the MIT license (LICENSE.txt)
 */

package dk.nversion.copybook.converters;

import dk.nversion.copybook.exceptions.TypeConverterException;

public class IntegerToBoolean extends IntegerToInteger {

    @Override
    public void validate(Class<?> type, int size, int decimals) {
        if(!(Boolean.class.equals(type) || Boolean.TYPE.equals(type))) {
            throw new TypeConverterException("Only supports converting to and from int or Integer");
        }
    }

    @Override
    public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) {
        return (int)super.to(bytes, offset, length, decimals, removePadding) != 0;
    }

    @Override
    public byte[] from(Object value, int length, int decimals, boolean addPadding) {
        return super.from(value != null ? ((boolean)value ? 1 : 0) : null, length, decimals, addPadding);
    }
}

Handle that we could use the object version of Boolean and it could be null


/*******************************************************************************
 * Copyright (c) 2011, 2017 Eurotech and/or its affiliates and others
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Red Hat
 *******************************************************************************/
package org.eclipse.kapua.commons.jpa;

/**
 * H2 Jdbc url connection resolver implementation
 *
 * @since 1.0
 */
public class H2JdbcConnectionUrlResolver implements JdbcConnectionUrlResolver {

    @Override
    public String connectionUrl() {
        return "jdbc:h2:mem:kapua;MODE=MySQL;INIT=create schema if not exists kapuadb";
    }

}

/*******************************************************************************
 * Copyright (c) 2011, 2017 Eurotech and/or its affiliates and others
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Red Hat
 *******************************************************************************/
package org.eclipse.kapua.commons.jpa;

/**
 * H2 Jdbc url connection resolver implementation
 *
 * @since 1.0
 */
public class H2JdbcConnectionUrlResolver implements JdbcConnectionUrlResolver {

    @Override
    public String connectionUrl() {
        return "jdbc:h2:mem:kapua;MODE=MySQL;INIT=create schema if not exists kapuadb\\;SET SCHEMA kapuadb";
    }

}

Use kapuadb schema by default

Use kapuadb schema by default

Signed-off-by: Elbert Evangelista <6a308fc4e2672d8df3711d12a762bf46d651708f@eurotech.com>


/*
 *  BSD License (http://lemurproject.org/galago-license)
 */
package org.lemurproject.galago.core.tools.apps;

import java.io.PrintStream;
import org.lemurproject.galago.core.index.IndexPartReader;
import org.lemurproject.galago.core.index.KeyIterator;
import org.lemurproject.galago.core.index.disk.DiskIndex;
import org.lemurproject.galago.core.retrieval.iterator.MovableCountIterator;
import org.lemurproject.galago.core.retrieval.processing.ScoringContext;
import org.lemurproject.galago.core.tools.AppFunction;
import org.lemurproject.galago.tupleflow.Parameters;

/**
 *
 * @author sjh
 */
public class DumpTermStatisticsFn extends AppFunction {

  @Override
  public String getName() {
    return "dump-term-stats";
  }

  @Override
  public String getHelpString() {
    return "galago dump-term-stats <index-part> \n\n"
            + "  Dumps <term> <frequency> <document count> statsistics from the"
            + " the specified index part.\n";
  }

  @Override
  public void run(String[] args, PrintStream output)
          throws Exception {
    ScoringContext sc = new ScoringContext();
    IndexPartReader reader = DiskIndex.openIndexPart(args[1]);
    KeyIterator iterator = reader.getIterator();
    while (!iterator.isDone()) {
      MovableCountIterator mci = (MovableCountIterator) iterator.getValueIterator();
      mci.setContext(sc);
      long frequency = 0;
      long documentCount = 0;
      while (!mci.isDone()) {
        sc.document = mci.currentCandidate();
        if (mci.hasMatch(mci.currentCandidate())) {
          frequency += mci.count();
          documentCount++;
        }
        mci.movePast(mci.currentCandidate());
      }
      output.printf("%s\t%d\t%d\n", iterator.getKeyString(), frequency, documentCount);
      iterator.nextKey();
    }
    reader.close();
  }

  @Override
  public void run(Parameters p, PrintStream output) throws Exception {
    String indexPath = p.getString("indexPath");
    run(new String[]{"", indexPath}, output);
  }
}

Put the foolish thing back.

Put the foolish thing back.

Stupid mercurial.


package voot.oauth;

import java.util.Collection;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.stream.Collectors;

import com.google.common.base.Preconditions;

import voot.oauth.valueobject.Group;

public class ExternalGroupsQuerier {

  private final List<GroupClient> groupClients;

  public ExternalGroupsQuerier(List<GroupClient> groupClients) {
    Preconditions.checkArgument(groupClients.size() > 0, "No clients configured");
    this.groupClients = groupClients;
  }

  public List<Group> getMyGroups(String uid, String schacHomeOrganization) {
    // we're I/O bound and groupClients.size() will be < 5
    ForkJoinPool forkJoinPool = new ForkJoinPool(groupClients.size());
    try {
      return forkJoinPool.submit(() -> this.groupClients.parallelStream()
        .filter(client -> client.isAuthorative(schacHomeOrganization))
        .map(client -> client.getMemberships(uid, schacHomeOrganization))
        .flatMap(Collection::stream)
        .collect(Collectors.toList())).get();
    } catch (InterruptedException | ExecutionException e) {
      throw new RuntimeException("Unable to schedule querying of external group providers.", e);
    }
  }
}

package voot.oauth;

import java.util.Collection;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.stream.Collectors;

import com.google.common.base.Preconditions;

import voot.oauth.valueobject.Group;

public class ExternalGroupsQuerier {

  private final List<GroupClient> groupClients;
  private final ForkJoinPool forkJoinPool;

  public ExternalGroupsQuerier(List<GroupClient> groupClients) {
    Preconditions.checkArgument(groupClients.size() > 0, "No clients configured");
    this.groupClients = groupClients;
    forkJoinPool = new ForkJoinPool(groupClients.size() * 20); // we're I/O bound.
  }

  public List<Group> getMyGroups(String uid, String schacHomeOrganization) {

    try {
      return forkJoinPool.submit(() -> this.groupClients.parallelStream()
        .filter(client -> client.isAuthorative(schacHomeOrganization))
        .map(client -> client.getMemberships(uid, schacHomeOrganization))
        .flatMap(Collection::stream)
        .collect(Collectors.toList())).get();
    } catch (InterruptedException | ExecutionException e) {
      throw new RuntimeException("Unable to schedule querying of external group providers.", e);
    }
  }
}

Set the fork-join pool globally to prevent DOS-vulnerability


package org.kepennar.aproc.complicatebusiness;

import static java.util.Comparator.naturalOrder;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;

import java.util.List;
import java.util.stream.Stream;

import javax.inject.Inject;

import org.kepennar.aproc.tasks.Task;
import org.kepennar.aproc.tasks.TaskRepository;
import org.springframework.stereotype.Service;

@Service
public class ComplicateBusinessService {

	private final TaskRepository taskRepository;

	@Inject
	public ComplicateBusinessService(TaskRepository taskRepository) {
		this.taskRepository = taskRepository;
	}

	public List<Task> getAllTransformedTasks() {
		return taskRepository.findAll().parallelStream()
			.map(t -> {
				return new Task(sort2(t.getName()), sort2(t.getDescription()));
			})
			.collect(toList());

	}
	private final static String sort2(String word) {
		return Stream.of(word.split(""))
				.sorted(naturalOrder())
				.collect(joining());

	}

}

package org.kepennar.aproc.complicatebusiness;

import static java.util.Comparator.naturalOrder;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;

import java.util.List;
import java.util.stream.Stream;

import javax.inject.Inject;

import org.kepennar.aproc.tasks.Task;
import org.kepennar.aproc.tasks.TaskRepository;
import org.springframework.stereotype.Service;

@Service
public class ComplicateBusinessService {

	private final TaskRepository taskRepository;

	@Inject
	public ComplicateBusinessService(TaskRepository taskRepository) {
		this.taskRepository = taskRepository;
	}

	public List<Task> getAllTransformedTasks() {
		return taskRepository.findAll().parallelStream()
			.map(t -> {
				return new Task(sort(t.getName()), sort(t.getDescription()));
			})
			.collect(toList());

	}
	private final static String sort(String word) {
		return Stream.of(word.split(""))
				.sorted(naturalOrder())
				.collect(joining());

	}

}

Use Stream instead of StringUtils

Use Stream instead of StringUtils


package wikipedia;

import org.junit.Test;
import org.xml.sax.InputSource;
import wikipedia.schemas.PageMetadata;
import wikipedia.schemas.RevisionContent;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertEquals;

/**
 * wikipedia.Wiki2AvroXmlParserTest
 */
public class Wiki2AvroXmlParserTest {
  @Test
  public void test1() throws Wiki2AvroException {
    String testFile = "/test1.xml";
    List<PageMetadata> pages = new ArrayList<>();
    List<RevisionContent> revisions = new ArrayList<>();
    runTest(testFile, pages, revisions);
    assertEquals(2, pages.size());
    assertEquals(6, revisions.size());
  }

  private void runTest(String testFile, List<PageMetadata> pages, List<RevisionContent> revisions)
      throws Wiki2AvroException {
    InputStream inputStream = this.getClass().getResourceAsStream(testFile);
    InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
    InputSource inputSource = new InputSource(inputStreamReader);
    Wiki2AvroOutputStream<PageMetadata> metadataOutputStream =
        new Wiki2AvroMockOutputStream<>(pages);
    Wiki2AvroOutputStream<RevisionContent> contentOutputStream =
        new Wiki2AvroMockOutputStream<>(revisions);
    Wiki2AvroXmlParser.parse(inputSource, metadataOutputStream, contentOutputStream);
  }
}

package wikipedia;

import org.junit.Test;
import org.xml.sax.InputSource;
import wikipedia.schemas.PageMetadata;
import wikipedia.schemas.RevisionContent;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.assertEquals;

/**
 * wikipedia.Wiki2AvroXmlParserTest
 */
public class Wiki2AvroXmlParserTest {
  @Test
  public void test1() throws Wiki2AvroException {
    String testFile = "/test1.xml";
    List<PageMetadata> pages = new ArrayList<>();
    List<RevisionContent> revisions = new ArrayList<>();
    runTest(testFile, pages, revisions);
    assertEquals(3, pages.size());
    assertEquals(7, revisions.size());
  }

  private void runTest(String testFile, List<PageMetadata> pages, List<RevisionContent> revisions)
      throws Wiki2AvroException {
    InputStream inputStream = this.getClass().getResourceAsStream(testFile);
    InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
    InputSource inputSource = new InputSource(inputStreamReader);
    Wiki2AvroOutputStream<PageMetadata> metadataOutputStream =
        new Wiki2AvroMockOutputStream<>(pages);
    Wiki2AvroOutputStream<RevisionContent> contentOutputStream =
        new Wiki2AvroMockOutputStream<>(revisions);
    Wiki2AvroXmlParser.parse(inputSource, metadataOutputStream, contentOutputStream);
  }
}

Revert page filtering by namespace.

Revert page filtering by namespace.


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

package scala.tools.partest.javaagent;

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

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

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

package scala.tools.partest.javaagent;

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

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

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

We do not need to retransform classes once they are loaded.
All instrumentation byte-code is pushed at loading time.

This fixes a problem with Java 7 that was failing to add
a transformer because we did not declare retransformation
capability in `MANIFEST.MF` file in Java agent jar.
Java 6 allowed to add transformer due to a bug.


package pingpong.x.cpp;

import hu.elte.txtuml.api.deployment.Configuration;
import hu.elte.txtuml.api.deployment.Group;
import hu.elte.txtuml.api.deployment.Runtime;
import hu.elte.txtuml.api.deployment.RuntimeType;
import pingpong.j.model.Game;
import pingpong.j.model.Player;
import pingpong.j.model.Racket;

@Group(contains = { Player.class, Game.class, Racket.class })
@Runtime(RuntimeType.SINGLE)
public class PingPongConfiguration extends Configuration {

}

package pingpong.x.cpp;

import hu.elte.txtuml.api.deployment.Configuration;
import hu.elte.txtuml.api.deployment.Group;
import hu.elte.txtuml.api.deployment.Runtime;
import hu.elte.txtuml.api.deployment.RuntimeType;
import pingpong.x.model.Game;
import pingpong.x.model.Player;
import pingpong.x.model.Racket;

@Group(contains = { Player.class, Game.class, Racket.class })
@Runtime(RuntimeType.SINGLE)
public class PingPongConfiguration extends Configuration {

}

Fix imports in pingpong demo

Fix imports in pingpong demo


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

package org.apache.jmeter.protocol.http.sampler;

import java.net.URL;

/**
 * Dummy HTTPSampler class for use by classes that need an HTTPSampler, but that
 * don't need an actual sampler, e.g. for Parsing testing.
 */
public final class HTTPNullSampler extends HTTPSamplerBase {

    private static final long serialVersionUID = 240L;

    /*
     * (non-Javadoc)
     *
     * @see org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase#sample(java.net.URL,
     *      java.lang.String, boolean, int)
     */
    @Override
    protected HTTPSampleResult sample(URL u, String s, boolean b, int i) {
        throw new UnsupportedOperationException("For test purposes only");
    }

}

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

package org.apache.jmeter.protocol.http.sampler;

import java.net.URL;

/**
 * Dummy HTTPSampler class for use by classes that need an HTTPSampler, but that
 * don't need an actual sampler, e.g. for Parsing testing.
 */
public final class HTTPNullSampler extends HTTPSamplerBase {

    private static final long serialVersionUID = 240L;

    /**
     * Returns a sample Result with the request fields filled in.
     *
     * {@inheritDoc}
     */
    @Override
    protected HTTPSampleResult sample(URL u, String method, boolean areFollowingRedirec, int depth) {
        HTTPSampleResult res = new HTTPSampleResult();
        res.sampleStart();
        res.setURL(u);
        res.sampleEnd();
        return res;
//        throw new UnsupportedOperationException("For test purposes only");
    }

}

Return a sample result, so can test methods that perform a sample

git-svn-id: https://svn.apache.org/repos/asf/jakarta/jmeter/trunk@907681 13f79535-47bb-0310-9956-ffa450edef68

Former-commit-id: d8d665d37c5505160ac98d296685f055e1255d8e


package moe.tristan.easyfxml.api;

import moe.tristan.easyfxml.util.Resources;
import moe.tristan.easyfxml.util.Stages;
import io.vavr.control.Try;

import javafx.stage.Stage;

import java.net.URI;
import java.net.URL;
import java.nio.file.Path;

/**
 * Represents a stylesheet a supplier of Path. What this means is that any protocol is acceptable. Whether it is local
 * file-based or remote URI-based.
 *
 * @see Stages#setStylesheet(Stage, FxmlStylesheet)
 */
public interface FxmlStylesheet {

    /**
     * @return the CSS file that composes the stylesheet as a {@link Path}. See {@link
     * Resources#getResourcePath(String)}
     */
    Path getPath();

    /**
     * This method is a sample implementation that should work in almost all general cases.
     *

     * An {@link java.io.IOException} can be thrown in very rare cases.
     *

     * If you encounter them, post an issue with system details.
     *
     * @return the CSS file in external form (i.e. with the file:/, http:/...) protocol info before it.
     * @see Resources#getResourceURL(String)
     * @see URL#toExternalForm()
     */
    default String getExternalForm() {
        return Try.of(this::getPath)
                  .map(Path::toUri)
                  .mapTry(URI::toURL)
                  .map(URL::toExternalForm)
                  .get();
    }

}

package moe.tristan.easyfxml.api;

import moe.tristan.easyfxml.util.Resources;
import moe.tristan.easyfxml.util.Stages;
import io.vavr.control.Try;

import javafx.stage.Stage;

import java.net.URI;
import java.net.URL;
import java.nio.file.Path;

/**
 * Represents a stylesheet a supplier of Path. What this means is that any protocol is acceptable. Whether it is local
 * file-based or remote URI-based.
 *
 * @see Stages#setStylesheet(Stage, FxmlStylesheet)
 */
public interface FxmlStylesheet {

    FxmlStylesheet DEFAULT_JAVAFX_STYLE = () -> null;

    /**
     * @return the CSS file that composes the stylesheet as a {@link Path}. See {@link
     * Resources#getResourcePath(String)}
     */
    Path getPath();

    /**
     * This method is a sample implementation that should work in almost all general cases.
     *

     * An {@link java.io.IOException} can be thrown in very rare cases.
     *

     * If you encounter them, post an issue with system details.
     *
     * @return the CSS file in external form (i.e. with the file:/, http:/...) protocol info before it.
     * @see Resources#getResourceURL(String)
     * @see URL#toExternalForm()
     */
    default String getExternalForm() {
        return Try.of(this::getPath)
                  .map(Path::toUri)
                  .mapTry(URI::toURL)
                  .map(URL::toExternalForm)
                  .get();
    }

}

Add a constant for default JavaFX style (Modena at this time) for FXMLStylesheet


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

package de.sormuras.bach.execution;

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

import de.sormuras.bach.api.Projects;
import org.junit.jupiter.api.Test;

class BuildTaskGeneratorTests {

  @Test
  void checkBuildTaskGenerationForMultiModuleProjectWithTests() {
    var project = Projects.newProjectWithAllBellsAndWhistles();
    var generator = new BuildTaskGenerator(project, true);
    assertSame(project, generator.project());
    assertTrue(generator.verbose());
    var root = generator.get();
    var program = Snippet.program(root);
    assertTrue(program.size() > 10);
    // program.forEach(System.out::println);
  }
}

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

package de.sormuras.bach.execution;

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

import de.sormuras.bach.api.Projects;
import org.junit.jupiter.api.Test;
import test.base.jdk.Compilation;

class BuildTaskGeneratorTests {

  @Test
  void checkBuildTaskGenerationForMultiModuleProjectWithTests() {
    var project = Projects.newProjectWithAllBellsAndWhistles();
    var generator = new BuildTaskGenerator(project, true);
    assertSame(project, generator.project());
    assertTrue(generator.verbose());
    var program = Snippet.program(generator.get());
    try {
      assertDoesNotThrow(() -> Compilation.compile(program));
    } catch (AssertionError e) {
      program.forEach(System.err::println);
      throw e;
    }
  }
}

Check generated build program is compilable


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

package org.springframework.security.web.csrf;

/**
 * Thrown when no expected {@link CsrfToken} is found but is required.
 *
 * @author Rob Winch
 * @since 3.2
 */
@SuppressWarnings("serial")
public class MissingCsrfTokenException extends CsrfException {

	public MissingCsrfTokenException(String actualToken) {
		super("Could not verify the provided CSRF token because your session was not found.");
	}

}

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

package org.springframework.security.web.csrf;

/**
 * Thrown when no expected {@link CsrfToken} is found but is required.
 *
 * @author Rob Winch
 * @since 3.2
 */
@SuppressWarnings("serial")
public class MissingCsrfTokenException extends CsrfException {

	public MissingCsrfTokenException(String actualToken) {
		super("Could not verify the provided CSRF token because no token was found to compare.");
	}

}

Improve log message when no CSRF token found

Closes gh-10436