package org.apache.lucene.util;

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

public class TestTimSorter extends BaseSortTestCase {

  public TestTimSorter() {
    super(true);
  }

  @Override
  public Sorter newSorter(Entry[] arr) {
    return new ArrayTimSorter<Entry>(arr, ArrayUtil.<Entry>naturalComparator(), random().nextInt(arr.length));
  }

}

package org.apache.lucene.util;

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

public class TestTimSorter extends BaseSortTestCase {

  public TestTimSorter() {
    super(true);
  }

  @Override
  public Sorter newSorter(Entry[] arr) {
    return new ArrayTimSorter<Entry>(arr, ArrayUtil.<Entry>naturalComparator(), _TestUtil.nextInt(random(), 0, arr.length));
  }

}

Fix test bug (merged from r1484180).


/*
 * Copyright (C) 2011, 2015 XStream Committers.
 * All rights reserved.
 *
 * The software in this package is published under the terms of the BSD
 * style license a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 *
 * Created on 30. September 2011 by Joerg Schaible
 */
package com.thoughtworks.xstream.io.xml;

import com.thoughtworks.xstream.XStreamException;
import com.thoughtworks.xstream.io.HierarchicalStreamDriver;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;

import java.io.StringReader;

public class BEAStaxReaderTest extends AbstractXMLReaderTest {

    private HierarchicalStreamDriver driver = new BEAStaxDriver();

    // factory method
    @Override
    protected HierarchicalStreamReader createReader(String xml) throws Exception {
        return driver.createReader(new StringReader(xml));
    }

    @Override
    public void testIsXXEVulnerable() throws Exception {
        // Implementation ignores XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES
        todoIsXXEVulnerable();
    }

    public void todoIsXXEVulnerable() throws Exception {
        try {
            super.testIsXXEVulnerable();
            fail("Thrown " + XStreamException.class.getName() + " expected");
        } catch (final XStreamException e) {
            final String message = e.getMessage();
            if (message.contains("Package")) {
                throw e;
            }
        }
    }

    // inherits tests from superclass
}

/*
 * Copyright (C) 2011, 2015 XStream Committers.
 * All rights reserved.
 *
 * The software in this package is published under the terms of the BSD
 * style license a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 *
 * Created on 30. September 2011 by Joerg Schaible
 */
package com.thoughtworks.xstream.io.xml;

import com.thoughtworks.xstream.XStreamException;
import com.thoughtworks.xstream.io.HierarchicalStreamDriver;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;

import java.io.StringReader;

public class BEAStaxReaderTest extends AbstractXMLReaderTest {

    private HierarchicalStreamDriver driver = new BEAStaxDriver();

    // factory method
    @Override
    protected HierarchicalStreamReader createReader(String xml) throws Exception {
        return driver.createReader(new StringReader(xml));
    }

    @Override
    public void testIsXXEVulnerable() throws Exception {
        // Implementation ignores XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES
    }

    public void todoIsXXEVulnerable() throws Exception {
        try {
            super.testIsXXEVulnerable();
            fail("Thrown " + XStreamException.class.getName() + " expected");
        } catch (final XStreamException e) {
            final String message = e.getMessage();
            if (message.contains("Package")) {
                throw e;
            }
        }
    }

    // inherits tests from superclass
}

Disable XXE vulnerability unit test for BEA StAX driver.


package com.jvms.i18neditor;

import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

import com.jvms.i18neditor.util.MessageBundle;

/**
 * This class represents a menu item for duplicating a translation key.
 *
 * @author Jacob
 */
public class DuplicateTranslationMenuItem extends JMenuItem {
	private static final long serialVersionUID = 5207946396515235714L;

	public DuplicateTranslationMenuItem(Editor editor, boolean enabled) {
        super(MessageBundle.get("menu.edit.duplicate.title"));
		setAccelerator(KeyStroke.getKeyStroke("ctrl D"));
		addActionListener(e -> editor.duplicateSelectedTranslation());
		setEnabled(enabled);
	}
}

package com.jvms.i18neditor;

import java.awt.Toolkit;

import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

import com.jvms.i18neditor.util.MessageBundle;

/**
 * This class represents a menu item for duplicating a translation key.
 *
 * @author Jacob
 */
public class DuplicateTranslationMenuItem extends JMenuItem {
	private static final long serialVersionUID = 5207946396515235714L;

	public DuplicateTranslationMenuItem(Editor editor, boolean enabled) {
        super(MessageBundle.get("menu.edit.duplicate.title"));
		setAccelerator(KeyStroke.getKeyStroke('D', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
		addActionListener(e -> editor.duplicateSelectedTranslation());
		setEnabled(enabled);
	}
}

Use toolkit to get modifier for duplicate shortcut.


package com.laytonsmith.abstraction.enums;

import com.laytonsmith.annotations.MEnum;

@MEnum("com.commandhelper.PatternShape")
public enum MCPatternShape {
	BASE,
	BORDER,
	BRICKS,
	CIRCLE_MIDDLE,
	CREEPER,
	CROSS,
	CURLY_BORDER,
	DIAGONAL_LEFT,
	DIAGONAL_LEFT_MIRROR,
	DIAGONAL_RIGHT,
	DIAGONAL_RIGHT_MIRROR,
	FLOWER,
	GRADIENT,
	GRADIENT_UP,
	HALF_HORIZONTAL,
	HALF_HORIZONTAL_MIRROR,
	HALF_VERTICAL,
	HALF_VERTICAL_MIRROR,
	MOJANG,
	RHOMBUS_MIDDLE,
	SKULL,
	SQUARE_BOTTOM_LEFT,
	SQUARE_BOTTOM_RIGHT,
	SQUARE_TOP_LEFT,
	SQUARE_TOP_RIGHT,
	STRAIGHT_CROSS,
	STRIPE_BOTTOM,
	STRIPE_CENTER,
	STRIPE_DOWNLEFT,
	STRIPE_DOWNRIGHT,
	STRIPE_LEFT,
	STRIPE_MIDDLE,
	STRIPE_RIGHT,
	STRIPE_SMALL,
	STRIPE_TOP,
	TRIANGLE_BOTTOM,
	TRIANGLE_TOP,
	TRIANGLES_BOTTOM,
	TRIANGLES_TOP
}

package com.laytonsmith.abstraction.enums;

import com.laytonsmith.annotations.MEnum;

@MEnum("com.commandhelper.PatternShape")
public enum MCPatternShape {
	BASE,
	BORDER,
	BRICKS,
	CIRCLE_MIDDLE,
	CREEPER,
	CROSS,
	CURLY_BORDER,
	DIAGONAL_LEFT,
	DIAGONAL_LEFT_MIRROR,
	DIAGONAL_RIGHT,
	DIAGONAL_RIGHT_MIRROR,
	FLOWER,
	GLOBE,
	GRADIENT,
	GRADIENT_UP,
	HALF_HORIZONTAL,
	HALF_HORIZONTAL_MIRROR,
	HALF_VERTICAL,
	HALF_VERTICAL_MIRROR,
	MOJANG,
	RHOMBUS_MIDDLE,
	SKULL,
	SQUARE_BOTTOM_LEFT,
	SQUARE_BOTTOM_RIGHT,
	SQUARE_TOP_LEFT,
	SQUARE_TOP_RIGHT,
	STRAIGHT_CROSS,
	STRIPE_BOTTOM,
	STRIPE_CENTER,
	STRIPE_DOWNLEFT,
	STRIPE_DOWNRIGHT,
	STRIPE_LEFT,
	STRIPE_MIDDLE,
	STRIPE_RIGHT,
	STRIPE_SMALL,
	STRIPE_TOP,
	TRIANGLE_BOTTOM,
	TRIANGLE_TOP,
	TRIANGLES_BOTTOM,
	TRIANGLES_TOP
}

Add new banner pattern: GLOBE


package com.cwainner.chris.recipecentral;

import android.os.Build;
import android.widget.TextView;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;

import static org.junit.Assert.*;

@Config(constants = BuildConfig.class, sdk = Build.VERSION_CODES.LOLLIPOP)
@RunWith(RobolectricGradleTestRunner.class)

public class MainActivityTest {
    private MainActivity activity;

    @Before
    public void setup(){
        activity = Robolectric.setupActivity(MainActivity.class);
    }

    @Test
    public void validateMainHeader(){
        TextView appNameTextView = (TextView) activity.findViewById(R.id.mainHeader);
        assertTrue("Welcome to Recipe Central!".equals(appNameTextView.getText().toString()));
    }
}

package com.cwainner.chris.recipecentral;

import android.content.Intent;
import android.os.Build;
import android.widget.TextView;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowActivity;

import static org.junit.Assert.*;

@Config(constants = BuildConfig.class, sdk = Build.VERSION_CODES.LOLLIPOP)
@RunWith(RobolectricGradleTestRunner.class)

public class MainActivityTest {
    private MainActivity activity;

    @Before
    public void setup(){
        activity = Robolectric.setupActivity(MainActivity.class);
    }

    @Test
    public void validateMainHeader(){
        TextView appNameTextView = (TextView) activity.findViewById(R.id.mainHeader);
        assertTrue("Welcome to Recipe Central!".equals(appNameTextView.getText().toString()));
    }

    @Test
    public void aboutActivityStarted(){
        activity.findViewById(R.id.aboutButton).performClick();
        Intent expectedIntent = new Intent(activity, AboutActivity.class);
        ShadowActivity shadowActivity = org.robolectric.Shadows.shadowOf(activity);
        Intent actualIntent = shadowActivity.getNextStartedActivity();
        assertTrue(actualIntent.filterEquals(expectedIntent));
    }

    @Test
    public void contactActivityStarted(){
        activity.findViewById(R.id.contactButton).performClick();
        Intent expectedIntent = new Intent(activity, ContactActivity.class);
        ShadowActivity shadowActivity = org.robolectric.Shadows.shadowOf(activity);
        Intent actualIntent = shadowActivity.getNextStartedActivity();
        assertTrue(actualIntent.filterEquals(expectedIntent));
    }
}

Add tests for main page about and contact buttons


package ir.ac.aut.ceit.aolab.jlamp.rpi.model;

import ir.ac.aut.ceit.aolab.lamp_notification;
import org.kaaproject.kaa.client.notification.NotificationListener;

/**
 * Created by root on 5/17/16.
 */
public class DefaultNotificationListener implements NotificationListener {
	@Override
	public void onNotification(long l, lamp_notification lamp_notification) {
		Lamp.getLampById(lamp_notification.getId()).sendLampCommand(1);
		try {
			Thread.sleep(lamp_notification.getInterval() * 1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

		Lamp.getLampById(lamp_notification.getId()).sendLampCommand(0);
	}
}

package ir.ac.aut.ceit.aolab.jlamp.rpi.model;

import ir.ac.aut.ceit.aolab.I1820.notification.I1820;

import org.kaaproject.kaa.client.notification.NotificationListener;

/**
 * Created by root on 5/17/16.
 */
public class DefaultNotificationListener implements NotificationListener {
    @Override
    public void onNotification(long l, I1820 i1820) {

    }
}

Improve default notification for supporting I1820 notifications.


package com.emc.ecs.serviceBroker.config;

import java.net.URL;

import org.cloudfoundry.community.servicebroker.model.BrokerApiVersion;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.emc.ecs.managementClient.Connection;
import com.emc.ecs.serviceBroker.repository.EcsRepositoryCredentials;

@Configuration
@ComponentScan(basePackages = "com.emc.ecs.serviceBroker")
public class BrokerConfig {

	@Bean
	public Connection ecsConnection() {
		URL certificate = getClass().getClassLoader().getResource("localhost.pem");
		return new Connection("https://104.197.239.202:4443", "root", "ChangeMe", certificate);
	}

	@Bean
	public BrokerApiVersion brokerApiVersion() {
		return new BrokerApiVersion("2.7");
	}

	@Bean
	public EcsRepositoryCredentials getRepositoryCredentials() {
		return new EcsRepositoryCredentials("ecs-cf-service-broker-repository", "ecs-cf-service-broker-repository",
				"ns1", "urn:storageos:ReplicationGroupInfo:f81a7335-cadf-48fb-8eda-4856b250e9de:global");
	}

}

package com.emc.ecs.serviceBroker.config;

import java.net.URL;

import org.cloudfoundry.community.servicebroker.model.BrokerApiVersion;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.emc.ecs.managementClient.Connection;
import com.emc.ecs.serviceBroker.repository.EcsRepositoryCredentials;

@Configuration
@ComponentScan(basePackages = "com.emc.ecs.serviceBroker")
public class BrokerConfig {

	@Value("${endpoint}")
	private String endpoint;

	@Value("${port}")
	private String port;

	@Value("${username}")
	private String username;

	@Value("${password}")
	private String password;

	@Value("${replicationGroup}")
	private String replicationGroup;

	@Value("${namespace}")
	private String namespace;

	@Bean
	public Connection ecsConnection() {
		URL certificate = getClass().getClassLoader().getResource("localhost.pem");
		return new Connection("https://" + endpoint + ":" + port, username, password, certificate);
	}

	@Bean
	public BrokerApiVersion brokerApiVersion() {
		return new BrokerApiVersion("2.7");
	}

	@Bean
	public EcsRepositoryCredentials getRepositoryCredentials() {
		return new EcsRepositoryCredentials(null, null, namespace, replicationGroup);
	}
}

Add connection details as environment variables


package org.pdxfinder.repositories;

import org.pdxfinder.dao.Specimen;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * Created by jmason on 08/06/2017.
 */
public interface SpecimenRepository extends Neo4jRepository<Specimen, Long> {

    Specimen findByExternalId(@Param("externalId") String externalId);

    @Query("MATCH (mod:ModelCreation) where mod.sourcePdxId = {modelId} with mod" +
            "  optional match (mod)-[io:INSTANCE_OF]-(pdxPass:PdxPassage)-[passfrm:PASSAGED_FROM]-(spec:Specimen)-[char:CHARACTERIZED_BY]-(molchar:MolecularCharacterization)-[assoc:ASSOCIATED_WITH]-(mAss:MarkerAssociation)-[aw:MARKER]-(m:Marker) " +
            "  return spec")
    List<Specimen> findVariationDataBySourcePdxId(@Param("modelId") String modelId);

}

package org.pdxfinder.repositories;

import org.pdxfinder.dao.Specimen;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * Created by jmason on 08/06/2017.
 */
public interface SpecimenRepository extends Neo4jRepository<Specimen, Long> {

    Specimen findByExternalId(@Param("externalId") String externalId);

    @Query("MATCH (mod:ModelCreation) where mod.sourcePdxId = {modelId} with mod" +
            "  optional match (mod)-[io:INSTANCE_OF]-(pdxPass:PdxPassage)-[passfrm:PASSAGED_FROM]-(spec:Specimen)-[char:CHARACTERIZED_BY]-(molchar:MolecularCharacterization)-[assoc:ASSOCIATED_WITH]-(mAss:MarkerAssociation)-[aw:MARKER]-(m:Marker) " +
            "  return spec")
    List<Specimen> findVariationDataBySourcePdxId(@Param("modelId") String modelId);

    @Query("MATCH (s:Sample)--(mod:ModelCreation)--(pass:PdxPassage)--(spec:Specimen) " +
            "WHERE s.dataSource = {dataSource} " +
            "AND mod.sourcePdxId = {modelId} " +
            "AND pass.passage = {passage} " +
            "AND spec.externalId = {specimenId} " +
            "RETURN spec")
    Specimen findByModelIdAndDataSourceAndSpecimenIdAndPassage(
            @Param("modelId") String modelId,
            @Param("dataSource") String dataSource,
            @Param("specimenId") String specimenId,
            @Param("passage") int passage);

}

Add model specific find method


package co.phoenixlab.discord.util.adapters;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;

import java.io.IOException;
import java.time.Instant;

public class InstantGsonTypeAdapter extends TypeAdapter<Instant> {

    @Override
    public void write(JsonWriter out, Instant value) throws IOException {
        if (value == null) {
            out.nullValue();
        } else {
            out.value(value.toEpochMilli());
        }
    }

    @Override
    public Instant read(JsonReader in) throws IOException {
        if (in.peek() == JsonToken.NULL) {
            return null;
        }
        long epoch = in.nextLong();
        return Instant.ofEpochMilli(epoch);
    }
}

package co.phoenixlab.discord.util.adapters;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;

import java.io.IOException;
import java.time.Instant;

public class InstantGsonTypeAdapter extends TypeAdapter<Instant> {

    @Override
    public void write(JsonWriter out, Instant value) throws IOException {
        if (value == null) {
            out.nullValue();
        } else {
            out.beginObject();
            out.name("sec").value(value.getEpochSecond());
            out.name("nanos").value(value.getNano());
            out.endObject();
        }
    }

    @Override
    public Instant read(JsonReader in) throws IOException {
        if (in.peek() == JsonToken.NULL) {
            return null;
        }
        long sec = 0L;
        int nanos = 0;
        in.beginObject();
        while (in.hasNext()) {
            switch (in.nextName()) {
                case "sec":
                    sec = in.nextLong();
                    break;
                case "nanos":
                    nanos = in.nextInt();
                    break;
            }
        }
        in.endObject();
        return Instant.ofEpochSecond(sec, nanos);
    }
}

Change format of Instant to allow full represent


package com.tinkerpop.frames.annotations;

import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Element;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.frames.ClassUtilities;
import com.tinkerpop.frames.FramedGraph;
import com.tinkerpop.frames.Property;

import java.lang.reflect.Method;

public class PropertyAnnotationHandler implements AnnotationHandler<Property> {

    @Override
    public Class<Property> getAnnotationType() {
        return Property.class;
    }

    @Override
    public Object processElement(final Property annotation, final Method method, final Object[] arguments, final FramedGraph framedGraph, final Element element, final Direction direction) {
        if (ClassUtilities.isGetMethod(method)) {
            return element.getProperty(annotation.value());
        } else if (ClassUtilities.isSetMethod(method)) {
            Object value = arguments[0];
            if (null == value) {
                element.removeProperty(annotation.value());
            } else {
                element.setProperty(annotation.value(), value);
            }
            return null;
        } else if (ClassUtilities.isRemoveMethod(method)) {
            element.removeProperty(annotation.value());
            return null;
        }

        return null;
    }

}

package com.tinkerpop.frames.annotations;

import java.lang.reflect.Method;

import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Element;
import com.tinkerpop.frames.ClassUtilities;
import com.tinkerpop.frames.FramedGraph;
import com.tinkerpop.frames.Property;

public class PropertyAnnotationHandler implements AnnotationHandler<Property> {

    @Override
    public Class<Property> getAnnotationType() {
        return Property.class;
    }

    @Override
    public Object processElement(final Property annotation, final Method method, final Object[] arguments, final FramedGraph framedGraph, final Element element, final Direction direction) {
        if (ClassUtilities.isGetMethod(method)) {
			Object value = element.getProperty(annotation.value());
			if (method.getReturnType().isEnum())
				return getValueAsEnum(method, value);
			else
				return value;
        } else if (ClassUtilities.isSetMethod(method)) {
            Object value = arguments[0];
            if (null == value) {
                element.removeProperty(annotation.value());
            } else {
				if (value.getClass().isEnum()) {
					element.setProperty(annotation.value(), ((Enum<?>) value).name());
				} else {
					element.setProperty(annotation.value(), value);
				}
			}
            return null;
        } else if (ClassUtilities.isRemoveMethod(method)) {
            element.removeProperty(annotation.value());
            return null;
        }

        return null;
    }

	private Enum getValueAsEnum(final Method method, final Object value) {
		Class<Enum> en = (Class<Enum>) method.getReturnType();
		return Enum.valueOf(en, value.toString());
	}
}

Support enum based properties type.


package hu.webarticum.treeprinter;

public abstract class AbstractTreeNode implements TreeNode {

    @Override
    public TreeNode getOriginalNode() {
        return this;
    }

    @Override
    public int[] getInsets() {
        return new int[] {0, 0, 0, 0};
    }

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

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

}

package hu.webarticum.treeprinter;

public abstract class AbstractTreeNode implements TreeNode {

    @Override
    public TreeNode getOriginalNode() {
        return this;
    }

    @Override
    public int[] getInsets() {
        return new int[] {0, 0, 0, 0};
    }

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

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

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof AbstractTreeNode)) {
            return false;
        }
        return this.getContent().equals(((AbstractTreeNode) obj).getContent());
    }

    @Override
    public int hashCode() {
        return getContent().hashCode();
    }

}

Fix NPE when using BorderTreeNodeDecorator


package com.hubspot.jinjava.lib.filter;

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

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

import com.hubspot.jinjava.Jinjava;
import com.hubspot.jinjava.interpret.InterpretException;
import com.hubspot.jinjava.interpret.JinjavaInterpreter;

public class RegexReplaceFilterTest {

    JinjavaInterpreter interpreter;
    RegexReplaceFilter filter;

    @Before
    public void setup() {
        interpreter = new Jinjava().newInterpreter();
        filter = new RegexReplaceFilter();
    }

    @Test(expected = InterpretException.class)
    public void expects2Args() {
        filter.filter("foo", interpreter);
    }

    public void noopOnNullExpr() {
        assertThat(filter.filter(null, interpreter, "foo", "bar")).isNull();
    }

    @Test
    public void replaceString() {
        assertThat(filter.filter("It costs $300", interpreter, "[^a-zA-Z]", "")).isEqualTo("Itcosts");
    }

}

package com.hubspot.jinjava.lib.filter;

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

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

import com.hubspot.jinjava.Jinjava;
import com.hubspot.jinjava.interpret.InterpretException;
import com.hubspot.jinjava.interpret.JinjavaInterpreter;

public class RegexReplaceFilterTest {

    JinjavaInterpreter interpreter;
    RegexReplaceFilter filter;

    @Before
    public void setup() {
        interpreter = new Jinjava().newInterpreter();
        filter = new RegexReplaceFilter();
    }

    @Test(expected = InterpretException.class)
    public void expects2Args() {
        filter.filter("foo", interpreter);
    }

    public void noopOnNullExpr() {
        assertThat(filter.filter(null, interpreter, "foo", "bar")).isNull();
    }

    @Test
    public void itMatchesRegexAndReplacesString() {
        assertThat(filter.filter("It costs $300", interpreter, "[^a-zA-Z]", "")).isEqualTo("Itcosts");
    }

    @Test(expected = InterpretException.class)
    public void isThrowsExceptionOnInvalidRegex() {
        filter.filter("It costs $300", interpreter, "[", "");
    }
}

Add test coverage for invalid regex


package protocolsupport.protocol.transformer.middlepacket.clientbound.play;

import java.io.IOException;

import net.minecraft.server.v1_9_R1.BlockPosition;
import protocolsupport.protocol.PacketDataSerializer;
import protocolsupport.protocol.transformer.middlepacket.ClientBoundMiddlePacket;

public abstract class MiddleSpawnPainting<T> extends ClientBoundMiddlePacket<T> {

	protected int entityId;
	protected String type;
	protected BlockPosition position;
	protected int direction;

	@Override
	public void readFromServerData(PacketDataSerializer serializer) throws IOException {
		entityId = serializer.readVarInt();
		type = serializer.readString(13);
		position = serializer.readPosition();
		direction = serializer.readByte();
	}

}

package protocolsupport.protocol.transformer.middlepacket.clientbound.play;

import java.io.IOException;
import java.util.UUID;

import net.minecraft.server.v1_9_R1.BlockPosition;
import protocolsupport.protocol.PacketDataSerializer;
import protocolsupport.protocol.transformer.middlepacket.ClientBoundMiddlePacket;

public abstract class MiddleSpawnPainting<T> extends ClientBoundMiddlePacket<T> {

	protected int entityId;
	protected UUID uuid;
	protected String type;
	protected BlockPosition position;
	protected int direction;

	@Override
	public void readFromServerData(PacketDataSerializer serializer) throws IOException {
		entityId = serializer.readVarInt();
		uuid = serializer.readUUID();
		type = serializer.readString(13);
		position = serializer.readPosition();
		direction = serializer.readUnsignedByte();
	}

}

Fix spawn painting packet reading


/*
 * Copyright (C) VSPLF Software Foundation (VSF), the origin 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.vsplf.i18n.helpers;

import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;

/**
 * Lightweight porting of ICU MessageFormat.
 *
 * @author hoatle (hoatlevan at gmail dot com)
 * @since Mar 23, 2012
 */
public final class MessageFormat extends Format {

  @Override
  public final StringBuffer format(final Object obj, final StringBuffer toAppendTo,
                                   final FieldPosition pos) {
    return null;  //To change body of implemented methods use File | Settings | File Templates.
  }

  @Override
  public final Object parseObject(final String source, final ParsePosition pos) {
    return null;  //To change body of implemented methods use File | Settings | File Templates.
  }
}

/*
 * Copyright (C) VSPLF Software Foundation (VSF), the origin 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.vsplf.i18n.helpers;

import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;

/**
 * Lightweight porting of ICU MessageFormat.
 *
 * @author hoatle (hoatlevan at gmail dot com)
 * @since Mar 23, 2012
 */
public final class MessageFormat extends Format {

  @Override
  public StringBuffer format(final Object obj, final StringBuffer toAppendTo,
                                   final FieldPosition pos) {
    return null;  //To change body of implemented methods use File | Settings | File Templates.
  }

  @Override
  public Object parseObject(final String source, final ParsePosition pos) {
    return null;  //To change body of implemented methods use File | Settings | File Templates.
  }
}

Fix violations checking: * Redundant 'final' modifier


package org.alien4cloud.tosca.utils;

import org.alien4cloud.tosca.model.definitions.ImplementationArtifact;
import org.alien4cloud.tosca.model.definitions.Interface;
import org.alien4cloud.tosca.model.definitions.Operation;

import java.util.Map;
import java.util.Optional;

import static alien4cloud.utils.AlienUtils.safe;

public final class InterfaceUtils {
    private InterfaceUtils() {
    }

    public static ImplementationArtifact getArtifact(Map<String, Interface> interfaceMap, String interfaceName, String operationName) {
        Optional.of(safe(interfaceMap).get(interfaceName)).map()
        Interface interfaz = safe(interfaceMap).get(interfaceName);
        if (interfaz == null) {
            return null;
        }
        Operation operation = safe(interfaz.getOperations()).get(operationName);
        if(operation )
    }

}

package org.alien4cloud.tosca.utils;

import static alien4cloud.utils.AlienUtils.safe;

import java.util.Map;
import java.util.Optional;

import org.alien4cloud.tosca.model.definitions.ImplementationArtifact;
import org.alien4cloud.tosca.model.definitions.Interface;
import org.alien4cloud.tosca.model.definitions.Operation;

public final class InterfaceUtils {
    private InterfaceUtils() {
    }

    public static ImplementationArtifact getArtifact(Map<String, Interface> interfaceMap, String interfaceName, String operationName) {
        Optional.of(safe(interfaceMap).get(interfaceName)).map()
        Interface interfaz = safe(interfaceMap).get(interfaceName);
        if (interfaz == null) {
            return null;
        }
        Operation operation = safe(interfaz.getOperations()).get(operationName);
        if(operation == null) {
            return null;
        }
        return operation.getImplementationArtifact();
    }
}

Allow specific handling of docker image artifact update in the editor, util fix.


package com.bbn.bue.common;

import com.google.common.annotations.Beta;

import org.immutables.value.Value;

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

/**
 * This is the text group's default style for immutable objects generated using
 * the "Immutables.org" library. Use this whenever you use {@link org.immutables.value.Value.Immutable}
 * unless you have a strong reason to do otherwise.
 */
@Beta
@Target({ElementType.PACKAGE, ElementType.TYPE})
@Retention(RetentionPolicy.CLASS)
@Value.Style(
    // use the stripped abstract type name as the immutable type name
    // rather than prefixing "Immutable" as the default would do.
    // This is so that if we have _FlexibleEventMention,
    // the generated implementation is FlexibleEventMention, not
    // ImmutableFlexibleEventMention
    typeImmutable = "*",
    // the template class must be prefixed with _
    typeAbstract = {"_*"},
    // make the class annotated with this package private,
    // so API users only see the generated implementation, not
    // the template
    visibility = Value.Style.ImplementationVisibility.PUBLIC)
public @interface TextGroupPublicImmutable {
}

package com.bbn.bue.common;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.annotations.Beta;

import org.immutables.value.Value;

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

/**
 * This is the text group's default style for immutable objects generated using
 * the "Immutables.org" library. Use this whenever you use {@link org.immutables.value.Value.Immutable}
 * for objects intended to be public unless you have a strong reason to do otherwise.
 */
@Beta
@Target({ElementType.PACKAGE, ElementType.TYPE})
@Retention(RetentionPolicy.CLASS)
@Value.Style(
    // use the stripped abstract type name as the immutable type name
    // rather than prefixing "Immutable" as the default would do.
    // This is so that if we have _FlexibleEventMention,
    // the generated implementation is FlexibleEventMention, not
    // ImmutableFlexibleEventMention
    typeImmutable = "*",
    // the template class must be prefixed with _
    typeAbstract = {"_*"},
    // make the class annotated with this package private,
    // so API users only see the generated implementation, not
    // the template
    visibility = Value.Style.ImplementationVisibility.PUBLIC)
@JsonSerialize
@JsonDeserialize
public @interface TextGroupPublicImmutable {
}

Make Immutables type Jackson-serializable by default


package won.protocol.jms;

import javax.jms.ConnectionFactory;

import org.apache.camel.component.jms.JmsConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * User: LEIH-NB
 * Date: 28.04.14
 */
public class WonJmsConfiguration extends JmsConfiguration
{
  private final Logger logger = LoggerFactory.getLogger(getClass());

  public WonJmsConfiguration(ConnectionFactory connectionFactory){
    super(connectionFactory);
    configureDefaultJmsConfiguration();

  }
  public void configureDefaultJmsConfiguration(){
    setTimeToLive(0);
    setDisableTimeToLive(true);
    setRequestTimeout(0);
    setAsyncConsumer(true);
    setDeliveryPersistent(false);
    setDisableReplyTo(true);
    setTimeToLive(5000);
    setTransacted(false);
    logger.info("default jms configuration setup done");
  }

  public void configureJmsConfigurationForQueues(){
    setConcurrentConsumers(5);
  }

  public void configureJmsConfigurationForTopics(){

  }

}

package won.protocol.jms;

import javax.jms.ConnectionFactory;

import org.apache.camel.component.jms.JmsConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * User: LEIH-NB
 * Date: 28.04.14
 */
public class WonJmsConfiguration extends JmsConfiguration
{
  private final Logger logger = LoggerFactory.getLogger(getClass());

  public WonJmsConfiguration(ConnectionFactory connectionFactory){
    super(connectionFactory);
    configureDefaultJmsConfiguration();

  }
  public void configureDefaultJmsConfiguration(){
    //setDisableTimeToLive(true);
    //setRequestTimeout(0);
    //setAsyncConsumer(true); //this may improve performance for most cases, but it bites us in the registration situation, when we actually want to get a result from the wonnode.
    setDeliveryPersistent(false);
    //setDisableReplyTo(true);
    setTimeToLive(5000);
    setTransacted(false);
    logger.info("default jms configuration setup done");
  }

  public void configureJmsConfigurationForQueues(){
    setConcurrentConsumers(5);
  }

  public void configureJmsConfigurationForTopics(){

  }

}

Disable async sending in Activmq


package com.davidbracewell.apollo.ml.sequence;

import com.davidbracewell.apollo.ml.Learner;
import com.davidbracewell.apollo.ml.data.Dataset;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;

/**
 * The type Sequence labeler learner.
 *
 * @author David B. Bracewell
 */
public abstract class SequenceLabelerLearner extends Learner<Sequence, SequenceLabeler> {
   private static final long serialVersionUID = 1L;
   @Getter
   @Setter
   protected Decoder decoder = new BeamDecoder(5);
   @Getter
   @Setter
   protected TransitionFeature transitionFeatures = TransitionFeature.FIRST_ORDER;
   @Getter
   @Setter
   protected SequenceValidator validator = SequenceValidator.ALWAYS_TRUE;

   @Override
   public SequenceLabeler train(@NonNull Dataset<Sequence> dataset) {
      dataset.encode();
      transitionFeatures.fit(dataset);
      dataset.getEncoderPair().freeze();
      SequenceLabeler model = trainImpl(dataset);
      model.finishTraining();
      model.getFeatureEncoder().freeze();
      return model;
   }

}// END OF SequenceLabelerLearner

package com.davidbracewell.apollo.ml.sequence;

import com.davidbracewell.apollo.ml.Learner;
import com.davidbracewell.apollo.ml.data.Dataset;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;

/**
 * The type Sequence labeler learner.
 *
 * @author David B. Bracewell
 */
public abstract class SequenceLabelerLearner extends Learner<Sequence, SequenceLabeler> {
   private static final long serialVersionUID = 1L;
   @Getter
   @Setter
   protected Decoder decoder = new BeamDecoder(5);
   @Getter
   @Setter
   protected TransitionFeature transitionFeatures = TransitionFeature.FIRST_ORDER;
   @Getter
   @Setter
   protected SequenceValidator validator = SequenceValidator.ALWAYS_TRUE;

   @Override
   public SequenceLabeler train(@NonNull Dataset<Sequence> dataset) {
      dataset.encode();
      update(dataset.getEncoderPair(), dataset.getPreprocessors());
      transitionFeatures.fit(dataset);
      dataset.getEncoderPair().freeze();
      SequenceLabeler model = trainImpl(dataset);
      model.finishTraining();
      model.getFeatureEncoder().freeze();
      return model;
   }

}// END OF SequenceLabelerLearner

Fix SequenceLabelLearner to ensure it sets the preprocessors


import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;

public class CallAggregator {

    private static class CallPart {
        private long ts;
        private boolean isStart;

        public CallPart(long ts, boolean isStart) {
            this.ts = ts;
            this.isStart = isStart;
        }
    }

    private static class CallPartComparator implements Comparator<CallPart> {
        @Override
        public int compare(CallPart o1, CallPart o2) {
            if (o1.ts == o2.ts) {
                return 0;
            }
            return o1.ts > o2.ts ? 1 : -1;
        }
    }

    public static int max(List<Call> calls) {
        assert (calls != null);

        final List<CallPart> startAndEnds = new LinkedList<>();
        calls.forEach(call -> {
            startAndEnds.add(new CallPart(call.getStartTs(), true));
            startAndEnds.add(new CallPart(call.getEndTs(), false));
        });

        startAndEnds.sort(new CallPartComparator());

        int max = 0;
        int currentNumberOfCall = 0;
        long lastTs = -1;
        for (CallPart callPart : startAndEnds) {
            if (lastTs != callPart.ts) {
                max = Math.max(max, currentNumberOfCall);
            }
            if (callPart.isStart) {
                currentNumberOfCall++;
            } else {
                currentNumberOfCall--;
            }
        }
        max = Math.max(max, currentNumberOfCall);

        return max;
    }
}

import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;

public class CallAggregator {

    private static class CallPart {
        private long ts;
        private boolean isStart;

        public CallPart(long ts, boolean isStart) {
            this.ts = ts;
            this.isStart = isStart;
        }
    }

    private static class CallPartComparator implements Comparator<CallPart> {
        @Override
        public int compare(CallPart o1, CallPart o2) {
            if (o1.ts == o2.ts) {
                return o1.isStart ? 1 : -1; // the ends are before the starts !!
            }
            return o1.ts > o2.ts ? 1 : -1;
        }
    }

    public static int max(List<Call> calls) {
        assert (calls != null);

        final List<CallPart> startAndEnds = new LinkedList<>();
        calls.forEach(call -> {
            startAndEnds.add(new CallPart(call.getStartTs(), true));
            startAndEnds.add(new CallPart(call.getEndTs(), false));
        });

        startAndEnds.sort(new CallPartComparator());

        int max = 0;
        int currentNumberOfCall = 0;
        for (CallPart callPart : startAndEnds) {
            if (callPart.isStart) {
                currentNumberOfCall++;
            } else {
                currentNumberOfCall--;
            }
            max = Math.max(max, currentNumberOfCall); // because ends are before starts
        }

        return max;
    }
}

Simplify the code: while sorting the ends are placed before the starts


package org.ethereum.solidity;

import org.ethereum.solidity.compiler.CompilationResult;
import org.ethereum.solidity.compiler.SolidityCompiler;
import org.junit.Ignore;
import org.junit.Test;

import java.io.IOException;

/**
 * Created by Anton Nashatyrev on 03.03.2016.
 */
public class CompilerTest {

    @Test
    public void simpleTest() throws IOException {
        String contract =
                "contract a {" +
                "  int i1;" +
                "  function i() returns (int) {" +
                "    return i1;" +
                "  }" +
                "}";
        SolidityCompiler.Result res = SolidityCompiler.compile(
                contract.getBytes(), true, SolidityCompiler.Options.ABI, SolidityCompiler.Options.BIN, SolidityCompiler.Options.INTERFACE);
        System.out.println(res.output);
        System.out.println(res.errors);
        CompilationResult result = CompilationResult.parse(res.output);
        System.out.println(result.contracts.get("a").bin);
    }

    public static void main(String[] args) throws Exception {
        new CompilerTest().simpleTest();
    }
}

package org.ethereum.solidity;

import org.ethereum.solidity.compiler.CompilationResult;
import org.ethereum.solidity.compiler.SolidityCompiler;
import org.junit.Ignore;
import org.junit.Test;

import java.io.IOException;

/**
 * Created by Anton Nashatyrev on 03.03.2016.
 */
public class CompilerTest {

    @Test
    public void simpleTest() throws IOException {
        String contract =
                "contract a {" +
                "  int i1;" +
                "  function i() returns (int) {" +
                "    return i1;" +
                "  }" +
                "}";
        SolidityCompiler.Result res = SolidityCompiler.compile(
                contract.getBytes(), true, SolidityCompiler.Options.ABI, SolidityCompiler.Options.BIN, SolidityCompiler.Options.INTERFACE);
        System.out.println("Out: '" + res.output + "'");
        System.out.println("Err: '" + res.errors + "'");
        CompilationResult result = CompilationResult.parse(res.output);
        System.out.println(result.contracts.get("a").bin);
    }

    public static void main(String[] args) throws Exception {
        new CompilerTest().simpleTest();
    }
}

Add bit more out in test


package org.jetbrains.debugger.memory.action;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.xdebugger.XDebugSession;
import com.sun.jdi.ReferenceType;
import org.jetbrains.debugger.memory.component.InstancesTracker;
import org.jetbrains.debugger.memory.utils.InstancesProvider;
import org.jetbrains.debugger.memory.view.ClassesTable;
import org.jetbrains.debugger.memory.view.InstancesWindow;

public class ShowNewInstancesAction extends ClassesActionBase {
  @Override
  protected boolean isEnabled(AnActionEvent e) {
    Project project = e.getProject();
    ReferenceType selectedClass = getSelectedClass(e);
    return super.isEnabled(e) && selectedClass != null &&
        project != null && InstancesTracker.getInstance(project).isTracked(selectedClass.name());
  }

  @Override
  protected void perform(AnActionEvent e) {
    XDebugSession session = getDebugSession(e);
    ReferenceType selectedClass = getSelectedClass(e);
    InstancesProvider provider = e.getData(ClassesTable.NEW_INSTANCES_PROVIDER_KEY);
    if(selectedClass != null && provider != null && session != null) {
      new InstancesWindow(session, provider, selectedClass.name()).show();
    }
  }
}

package org.jetbrains.debugger.memory.action;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.xdebugger.XDebugSession;
import com.sun.jdi.ReferenceType;
import org.jetbrains.debugger.memory.utils.InstancesProvider;
import org.jetbrains.debugger.memory.view.ClassesTable;
import org.jetbrains.debugger.memory.view.InstancesWindow;

public class ShowNewInstancesAction extends ClassesActionBase {
  @Override
  protected boolean isEnabled(AnActionEvent e) {
    XDebugSession session = getDebugSession(e);
    ReferenceType selectedClass = getSelectedClass(e);
    InstancesProvider provider = e.getData(ClassesTable.NEW_INSTANCES_PROVIDER_KEY);
    return super.isEnabled(e) && session != null && selectedClass != null && provider != null;
  }

  @Override
  protected void perform(AnActionEvent e) {
    XDebugSession session = getDebugSession(e);
    ReferenceType selectedClass = getSelectedClass(e);
    InstancesProvider provider = e.getData(ClassesTable.NEW_INSTANCES_PROVIDER_KEY);
    if(selectedClass != null && provider != null && session != null) {
      new InstancesWindow(session, provider, selectedClass.name()).show();
    }
  }
}

Fix bug when "Show New Instances" action is enabled, but tracker is not ready


/*
 * Copyright 2019 Google LLC
 *
 * 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 com.google.android.gnd.persistence.local.room;

import androidx.room.Insert;
import androidx.room.Update;
import io.reactivex.Completable;
import io.reactivex.Single;

/**
 * Base interface for DAOs that implement operations on a specific entity type.
 *
 * @param <E> the type of entity that is persisted by sub-interfaces.
 */
public interface BaseDao<E> {
  @Insert
  Completable insert(E entity);

  @Update
  Single<Integer> update(E entity);

  /**
   * Try to update the specified entity, and if it doesn't yet exist, create it.
   *
   * @param entity
   * @return Completes when the insert or update operation is complete.
   */
  default Completable insertOrUpdate(E entity) {
    return update(entity).filter(n -> n == 0).flatMapCompletable(__ -> insert(entity));
  }
}

/*
 * Copyright 2019 Google LLC
 *
 * 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 com.google.android.gnd.persistence.local.room;

import androidx.room.Insert;
import androidx.room.Update;
import io.reactivex.Completable;
import io.reactivex.Single;

/**
 * Base interface for DAOs that implement operations on a specific entity type.
 *
 * @param <E> the type of entity that is persisted by sub-interfaces.
 */
public interface BaseDao<E> {
  @Insert
  Completable insert(E entity);

  @Update
  Single<Integer> update(E entity);

  /**
   * Try to update the specified entity, and if it doesn't yet exist, create it.
   */
  default Completable insertOrUpdate(E entity) {
    return update(entity).filter(n -> n == 0).flatMapCompletable(__ -> insert(entity));
  }
}

Remove unused Javadoc block comment


// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// TODO: Remove this package on Vespa 7
@ExportPackage
package com.yahoo.vespaxmlparser;

import com.yahoo.osgi.annotation.ExportPackage;

// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// TODO: Remove this package on Vespa 8
@ExportPackage
package com.yahoo.vespaxmlparser;

import com.yahoo.osgi.annotation.ExportPackage;

Move TODO to Vespa 8


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

package com.google.cloud.pubsublite;

public final class Endpoints {
  public static String dataEndpoint(CloudRegion region) {
    return region + "-pubsublite.googleapis.com/v1/data";
  }

  public static String adminEndpoint(CloudRegion region) {
    return region + "-pubsublite.googleapis.com/v1/admin";
  }

  public static String cursorEndpoint(CloudRegion region) {
    return region + "-pubsublite.googleapis.com/v1/cursor";
  }

  private Endpoints() {}
}

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

package com.google.cloud.pubsublite;

public final class Endpoints {
  public static String dataEndpoint(CloudRegion region) {
    return region.value() + "-pubsublite.googleapis.com";
  }

  public static String adminEndpoint(CloudRegion region) {
    return region.value() + "-pubsublite.googleapis.com";
  }

  public static String cursorEndpoint(CloudRegion region) {
    return region.value() + "-pubsublite.googleapis.com";
  }

  private Endpoints() {}
}

Fix endpoints to reflect their correct per-region values.


/*
 * Copyright 2015 Jan Ouwens
 *
 * 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.
 */
/**
 * Applies Eclipse's NonNullByDefault annotation to the package.
 */
@NonNullByDefault
package nl.jqno.equalsverifier.integration.extra_features.nonnull.eclipse;

import nl.jqno.equalsverifier.testhelpers.annotations.org.eclipse.jdt.annotation.NonNullByDefault;

/*
 * Copyright 2015 Jan Ouwens
 *
 * 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.
 */
/**
 * Applies Eclipse's NonNullByDefault annotation to the package.
 *
 * Actual classes in this package reside in AnnotationNonnullTypeUseTest,
 * because they're Java 8 only and need to be compiled conditionally.
 */
@NonNullByDefault
package nl.jqno.equalsverifier.integration.extra_features.nonnull.eclipse;

import nl.jqno.equalsverifier.testhelpers.annotations.org.eclipse.jdt.annotation.NonNullByDefault;

Improve Javadoc for Eclipse nonnull annotation package


package memap.messages.planning;

import com.google.gson.Gson;

import akka.basicMessages.AnswerContent;
import memap.messages.extension.NetworkType;

public class StorageMessage implements AnswerContent {

	public String id;
	public String name;

	public double operationalCostEUR;
	public double operationalCostCO2;

	public double capacity;
	public double stateOfCharge;

	public double maxLoad;
	public double maxDischarge;

	public double efficiencyCharge;
	public double efficiencyDischarge;

	public double storageLosses; //Input-Unit, mostly given as [kWh/24h] at SOC=0.75

	public NetworkType networkType;

	public String toString() {
		Gson gson = new Gson();
		String result = "";
		result = gson.toJson(this);
		return result;
	}

}

package memap.messages.planning;

import com.google.gson.Gson;

import akka.basicMessages.AnswerContent;
import memap.messages.extension.NetworkType;

public class StorageMessage implements AnswerContent {

	public String id;
	public String name;

	public double operationalCostEUR;
	public double operationalCostCO2;

	public double capacity;
	public double stateOfCharge;

	public double maxLoad;
	public double maxDischarge;

	public double efficiencyCharge;
	public double efficiencyDischarge;

	public double storageLosses;

	public double alpha;
	public double beta_to;
	public double beta_fm;

	public NetworkType networkType;

	public String toString() {
		Gson gson = new Gson();
		String result = "";
		result = gson.toJson(this);
		return result;
	}

}

Revert "Removed alphas and betas, moved to MILPProblemWithConnections"


package org.postgresql;
public class DriverClass {
public static String connectClass="org.postgresql.jdbc2.Connection";
}

package org.postgresql;
public class DriverClass {
public static String connectClass="org.postgresql.jdbc1.Connection";
}

Add res clear to example


package com.cloudant.sync.datastore;

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

/**
 * Created by tomblench on 06/08/2014.
 */
public class MutableDocumentRevision implements DocumentRevision
{

    public String docId;

    // ctor with no source revision id: this revision hasn't been saved yet
    MutableDocumentRevision() {
        this.attachments = new HashMap<String, Attachment>();
        this.sourceRevisionId = null;
    }

    // ctor with revision id: this revision has been saved (eg mutable copy)
    protected MutableDocumentRevision(String sourceRevisionId) {
        this.attachments = new HashMap<String, Attachment>();
        this.sourceRevisionId = sourceRevisionId;
    }

    @Override
    public String getId() {
        return docId;
    }

    protected final String sourceRevisionId;

    @Override
    public String getRevision() {
        // hasn't been saved yet so doesn't have a rev id
        return null;
    }

    // NB the key is purely for the user's convenience and doesn't have to be the same as the attachment name
    public Map<String, Attachment> attachments;

    @Override
    public Map<String, Attachment> getAttachments() {
        return attachments;
    }

    public DocumentBody body;

    @Override
    public DocumentBody getBody() {
        return body;
    }

}

package com.cloudant.sync.datastore;

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

/**
 * Created by tomblench on 06/08/2014.
 */
public class MutableDocumentRevision implements DocumentRevision
{

    public String docId;

    // ctor with no source revision id: this revision hasn't been saved yet
    public MutableDocumentRevision() {
        this.attachments = new HashMap<String, Attachment>();
        this.sourceRevisionId = null;
    }

    // ctor with revision id: this revision has been saved (eg mutable copy)
    protected MutableDocumentRevision(String sourceRevisionId) {
        this.attachments = new HashMap<String, Attachment>();
        this.sourceRevisionId = sourceRevisionId;
    }

    @Override
    public String getId() {
        return docId;
    }

    protected final String sourceRevisionId;

    @Override
    public String getRevision() {
        // hasn't been saved yet so doesn't have a rev id
        return null;
    }

    // NB the key is purely for the user's convenience and doesn't have to be the same as the attachment name
    public Map<String, Attachment> attachments;

    @Override
    public Map<String, Attachment> getAttachments() {
        return attachments;
    }

    public DocumentBody body;

    @Override
    public DocumentBody getBody() {
        return body;
    }

}

Fix bug where default constructor wasn't public


package edu.northwestern.bioinformatics.studycalendar.testing;

import edu.nwu.bioinformatics.commons.testing.DbTestCase;

import org.springframework.context.ApplicationContext;

import javax.sql.DataSource;

/**
 * @author Rhett Sutphin
 */
public class DaoTestCase extends DbTestCase {
    private static ApplicationContext applicationContext = null;

    protected DataSource getDataSource() {
        return (DataSource) getApplicationContext().getBean("dataSource");
    }

    public ApplicationContext getApplicationContext() {
        synchronized (DaoTestCase.class) {
            if (applicationContext == null) {
                applicationContext = ContextTools.createDeployedApplicationContext();
            }
            return applicationContext;
        }
    }
}

package edu.northwestern.bioinformatics.studycalendar.testing;

import edu.nwu.bioinformatics.commons.testing.DbTestCase;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor;

import javax.sql.DataSource;

/**
 * @author Rhett Sutphin
 */
public class DaoTestCase extends DbTestCase {
    private static ApplicationContext applicationContext = null;
    protected final Log log = LogFactory.getLog(getClass());

    protected MockHttpServletRequest request = new MockHttpServletRequest();
    protected MockHttpServletResponse response = new MockHttpServletResponse();
    private boolean shouldFlush = true;

    protected void setUp() throws Exception {
        super.setUp();
        beginSession();
    }

    protected void tearDown() throws Exception {
        endSession();
        findOpenSessionInViewInterceptor().setFlushModeName("FLUSH_NEVER");
        super.tearDown();
    }

    public void runBare() throws Throwable {
        setUp();
        try {
            runTest();
        } catch (Throwable throwable) {
            shouldFlush = false;
            throw throwable;
        } finally {
            tearDown();
        }
    }

    private void beginSession() {
        log.info("-- beginning DaoTestCase interceptor session --");
        findOpenSessionInViewInterceptor().preHandle(request, response, null);
    }

    private void endSession() {
        log.info("--    ending DaoTestCase interceptor session --");
        OpenSessionInViewInterceptor interceptor = findOpenSessionInViewInterceptor();
        if (shouldFlush) {
            interceptor.postHandle(request, response, null, null);
        }
        interceptor.afterCompletion(request, response, null, null);
    }

    protected void interruptSession() {
        endSession();
        log.info("-- interrupted DaoTestCase session --");
        beginSession();
    }

    private OpenSessionInViewInterceptor findOpenSessionInViewInterceptor() {
        return (OpenSessionInViewInterceptor) getApplicationContext().getBean("openSessionInViewInterceptor");
    }

    protected DataSource getDataSource() {
        return (DataSource) getApplicationContext().getBean("dataSource");
    }

    public ApplicationContext getApplicationContext() {
        synchronized (DaoTestCase.class) {
            if (applicationContext == null) {
                applicationContext = ContextTools.createDeployedApplicationContext();
            }
            return applicationContext;
        }
    }
}

Add open session in view filter support to tests


package org.shipkit.internal.gradle.plugin;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.shipkit.gradle.plugin.PluginValidatorTask;
import org.shipkit.internal.gradle.util.JavaPluginUtil;
import org.shipkit.internal.gradle.util.TaskMaker;

/**
 * This plugin validates that every plugin has a corresponding .properties file.
 *
 * Adds tasks:
 *

 *
'validatePlugins' - of type {@link PluginValidatorTask}.
 *          Validates that every plugin has a corresponding .properties file.

 *

 */
public class PluginValidationPlugin implements Plugin<Project> {

    static final String VALIDATE_PLUGINS = "validatePlugins";

    @Override
    public void apply(final Project project) {
        project.getPlugins().withId("java", plugin -> TaskMaker.task(project, VALIDATE_PLUGINS, PluginValidatorTask.class, task -> {
            task.setDescription("Validates Gradle Plugins and their properties files");
            task.setSourceSet(JavaPluginUtil.getMainSourceSet(project));
        }));
    }
}

package org.shipkit.internal.gradle.plugin;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaBasePlugin;
import org.shipkit.gradle.plugin.PluginValidatorTask;
import org.shipkit.internal.gradle.util.JavaPluginUtil;
import org.shipkit.internal.gradle.util.TaskMaker;

/**
 * This plugin validates that every plugin has a corresponding .properties file.
 *
 *

 *
Adds 'validatePlugins' task of type {@link PluginValidatorTask}.
 *          Validates that every plugin has a corresponding .properties file.
 *          New task is configured as dependency of 'check' task so that when you run 'check', the plugins are validated
 *

 *

 */
public class PluginValidationPlugin implements Plugin<Project> {

    static final String VALIDATE_PLUGINS = "validatePlugins";

    @Override
    public void apply(final Project project) {
        project.getPlugins().withId("java", plugin -> {
            TaskMaker.task(project, VALIDATE_PLUGINS, PluginValidatorTask.class, task -> {
                task.setDescription("Validates Gradle Plugins and their properties files");
                task.setSourceSet(JavaPluginUtil.getMainSourceSet(project));

                project.getTasks().getByName(JavaBasePlugin.CHECK_TASK_NAME).dependsOn(task);
            });
        });
    }
}

Validate plugins with 'check' task


package io.quarkus.jaeger.runtime.graal;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

import io.jaegertracing.internal.JaegerSpan;
import io.jaegertracing.spi.Reporter;

@Substitute
@TargetClass(className = "io.jaegertracing.internal.reporters.LoggingReporter")
final public class Target_LoggingReporter implements Reporter {

    @Substitute
    public Target_LoggingReporter() {

    }

    @Substitute
    @Override
    public void report(JaegerSpan span) {
        System.err.println("--- not logging: " + span);
    }

    @Substitute
    @Override
    public void close() {

    }

}

package io.quarkus.jaeger.runtime.graal;

import org.jboss.logging.Logger;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

import io.jaegertracing.internal.JaegerSpan;
import io.jaegertracing.spi.Reporter;

@Substitute
@TargetClass(className = "io.jaegertracing.internal.reporters.LoggingReporter")
final public class Target_LoggingReporter implements Reporter {

    private static final Logger LOG = Logger.getLogger(Target_LoggingReporter.class);

    @Substitute
    public Target_LoggingReporter() {

    }

    @Substitute
    @Override
    public void report(JaegerSpan span) {
        LOG.infof("Span reported: %s", span);
    }

    @Substitute
    @Override
    public void close() {

    }

}

Update Jaeger reporter to use logger


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.fasam.projetoexemplo.entidades;

/**
 *
 * @author Aluno
 */
public class Categoria {
    String nome;
    String descrição;

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getDescrição() {
        return descrição;
    }

    public void setDescrição(String descrição) {
        this.descrição = descrição;
    }

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.fasam.projetoexemplo.entidades;

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

/**
 *
 * @author Aluno
 */
public class Categoria {
    String nome;
    String descrição;
    List<Artigo> artigos;
     public Artigo getArtigo(Integer i){
        return artigos.get(i);
    }
    public void addArtigo(Artigo artigo){
        if(this.artigos == null){
            this.artigos = new ArrayList<Artigo>();
        }
    }
    public void remArtigo(Artigo artigo){
        if(this.artigos != null){
            this.artigos.remove(artigo);
        }
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getDescrição() {
        return descrição;
    }

    public void setDescrição(String descrição) {
        this.descrição = descrição;
    }

}

Add get e set em categoria - Informatica


/*
 * Arthur Edelstein, UCSF, 2011
 */

package org.micromanager.clojureeditor;

import org.micromanager.api.MMPlugin;
import org.micromanager.api.ScriptInterface;

public class ClojureEditorPlugin implements MMPlugin {
   public static String menuName = "Clojure editor";

   public void dispose() {
      // do nothing
   }

   public void setApp(ScriptInterface app) {
      // do nothing.
   }

   public void show() {
      clooj.core.show();
   }

   public void configurationChanged() {
      throw new UnsupportedOperationException("Not supported yet.");
   }

   public String getDescription() {
      throw new UnsupportedOperationException("Not supported yet.");
   }

   public String getInfo() {
      throw new UnsupportedOperationException("Not supported yet.");
   }

   public String getVersion() {
      throw new UnsupportedOperationException("Not supported yet.");
   }

   public String getCopyright() {
      throw new UnsupportedOperationException("Not supported yet.");
   }

}

/*
 * Arthur Edelstein, UCSF, 2011
 */

package org.micromanager.clojureeditor;

import org.micromanager.api.MMPlugin;
import org.micromanager.api.ScriptInterface;

public class ClojureEditorPlugin implements MMPlugin {
   public static String menuName = "Clojure editor";

   public void dispose() {
      // do nothing
   }

   public void setApp(ScriptInterface app) {
      // do nothing.
   }

   public void show() {
      // this line does not compile:
      //clooj.core.show();
   }

   public void configurationChanged() {
      throw new UnsupportedOperationException("Not supported yet.");
   }

   public String getDescription() {
      throw new UnsupportedOperationException("Not supported yet.");
   }

   public String getInfo() {
      throw new UnsupportedOperationException("Not supported yet.");
   }

   public String getVersion() {
      throw new UnsupportedOperationException("Not supported yet.");
   }

   public String getCopyright() {
      throw new UnsupportedOperationException("Not supported yet.");
   }

}

Remove line that does not compile


package org.apache.karaf.webconsole.core.internal;

import org.apache.wicket.Page;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.util.ListModel;

public class SidebarPanel extends Panel {

    public SidebarPanel(String id, Class<? extends Page> basePage, ListModel<Class<? extends Page>> listModel) {
        super(id, listModel);

        add(new BookmarkablePageLink<Page>("masterPageLink", basePage).add(new Label("masterPageLabel", basePage.getName())));

        add(new ListView<Class<? extends Page>>("subPageLinks", listModel) {
            @Override
            protected void populateItem(ListItem<Class<? extends Page>> item) {
                BookmarkablePageLink<Page> link = new BookmarkablePageLink<Page>("subPageLink", item.getModelObject());
                link.add(new Label("subPageLabel", item.getModelObject().getName()));
                item.add(link);
            }
        });
    }

}

package org.apache.karaf.webconsole.core.internal;

import org.apache.wicket.Page;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.util.ListModel;

public class SidebarPanel extends Panel {

    public SidebarPanel(String id, Class<? extends Page> basePage, ListModel<Class<? extends Page>> listModel) {
        super(id, listModel);

        add(new BookmarkablePageLink<Page>("masterPageLink", basePage).add(new Label("masterPageLabel", basePage.getSimpleName())));

        add(new ListView<Class<? extends Page>>("subPageLinks", listModel) {
            @Override
            protected void populateItem(ListItem<Class<? extends Page>> item) {
                Class<? extends Page> page = item.getModelObject();
                BookmarkablePageLink<Page> link = new BookmarkablePageLink<Page>("subPageLink", page);
                link.add(new Label("subPageLabel", page.getSimpleName()));
                item.add(link);
            }
        });
    }

}

Improve sidebar a bit - remove long class names from navigation


/*
 * Mutability Detector
 *
 * Copyright 2009 Graham Allan
 *
 * 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.mutabilitydetector.asmoverride;

import org.mutabilitydetector.cli.URLFallbackClassLoader;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.analysis.SimpleVerifier;

public class CustomClassLoadingSimpleVerifier extends SimpleVerifier {

	@Override
	protected Class<?> getClass(Type t) {

		URLFallbackClassLoader classLoader = new URLFallbackClassLoader();
		String className;

		try {
			if (t.getSort() == Type.ARRAY) {
				className = t.getDescriptor().replace('/', '.');
			} else {
				className = t.getClassName();
			}
			return classLoader.getClass(className);
		} catch (ClassNotFoundException e) {
			throw new RuntimeException(e);
		}
	}
}

/*
 * Mutability Detector
 *
 * Copyright 2009 Graham Allan
 *
 * 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.mutabilitydetector.asmoverride;

import org.mutabilitydetector.cli.URLFallbackClassLoader;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.analysis.SimpleVerifier;

public class CustomClassLoadingSimpleVerifier extends SimpleVerifier {

	private URLFallbackClassLoader classLoader;

	public CustomClassLoadingSimpleVerifier() {
		classLoader = new URLFallbackClassLoader();
	}

	@Override
	protected Class<?> getClass(Type t) {
		String className;

		try {
			if (t.getSort() == Type.ARRAY) {
				className = t.getDescriptor().replace('/', '.');
			} else {
				className = t.getClassName();
			}
			return classLoader.getClass(className);
		} catch (ClassNotFoundException e) {
			throw new RuntimeException(e);
		}
	}
}

Improve performance of the URLFallbackClassLoader. Non-scientific stopwatch tests showed a >10% speed increase, translating to a whopping seven seconds off when analysing rt.jar.


package net.mcft.copy.betterstorage.api.crafting;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

public abstract class RecipeInputBase implements IRecipeInput {

	@Override
	public abstract int getAmount();

	@Override
	public abstract boolean matches(ItemStack stack);

	@Override
	public void craft(ItemStack input, ContainerInfo containerInfo) {
		if (input == null) return;
		input.stackSize -= getAmount();

		Item item = input.getItem();
		ItemStack containerItem = item.getContainerItemStack(input);
		boolean doesLeaveCrafting = item.doesContainerItemLeaveCraftingGrid(input);
		containerInfo.set(containerItem, doesLeaveCrafting);
	}

}

package net.mcft.copy.betterstorage.api.crafting;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

public abstract class RecipeInputBase implements IRecipeInput {

	@Override
	public abstract int getAmount();

	@Override
	public abstract boolean matches(ItemStack stack);

	@Override
	public void craft(ItemStack input, ContainerInfo containerInfo) {
		if (input == null) return;

		Item item = input.getItem();
		ItemStack containerItem = item.getContainerItemStack(input.copy());
		boolean doesLeaveCrafting = item.doesContainerItemLeaveCraftingGrid(input);
		containerInfo.set(containerItem, doesLeaveCrafting);

		input.stackSize -= getAmount();
	}

}

Fix container item crafting in crafting station


package com.sunny.grokkingalgorithms.fasttrack;

/**
 * Created by sundas on 6/17/2018.
 */
public class Poweroftwo {

  public static void main(String[] args) {

    int a = 3;
    while(a != 1){
      if(a %2 == 0){
        System.out.println("true");
        break;
      }
      a = a/2;
    }

  }
}

package com.sunny.grokkingalgorithms.fasttrack;

/**
 * Created by sundas on 6/17/2018.
 */
public class Poweroftwo {

  public static void main(String[] args) {

    int a = 3;
    while(a != 1){
      if(a %2 == 0){
        System.out.println("true");
        break;
      }
      a = a/2;
    }

    a = 4;
    int x = a&(a - 1);
    System.out.println(x == 0);
  }
}

Check if a number is power of 2


package io.github.silencio_app.silencio;

import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

public class SplashActivity extends AppCompatActivity {

    private static final int SPLASH_TIME = 3000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        TextView tx = (TextView)findViewById(R.id.textViewSilencio);
        Typeface custom_font = Typeface.createFromAsset(getAssets(), "fonts/Somatic-Rounded.otf");
        tx.setTypeface(custom_font);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent = new Intent(SplashActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
            }
        }, SPLASH_TIME);
    }

}

package io.github.silencio_app.silencio;

import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

public class SplashActivity extends AppCompatActivity {

    private static final int SPLASH_TIME = 1000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        TextView tx = (TextView)findViewById(R.id.textViewSilencio);
        Typeface custom_font = Typeface.createFromAsset(getAssets(), "fonts/Somatic-Rounded.otf");
        tx.setTypeface(custom_font);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent = new Intent(SplashActivity.this, LoginActivity.class);
                startActivity(intent);
                finish();
            }
        }, SPLASH_TIME);
    }

}

Fix spalsh time and start loginActivity


//
// 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 com.cloud.storage.template;

import static org.junit.Assert.fail;

import java.io.File;

import org.junit.Test;

public class LocalTemplateDownloaderTest {

    @Test
    public void localTemplateDownloaderTest() {
        String url =  "file://" + new File("pom.xml").getAbsolutePath();
        TemplateDownloader td = new LocalTemplateDownloader(null, url, "/tmp", TemplateDownloader.DEFAULT_MAX_TEMPLATE_SIZE_IN_BYTES, null);
        long bytes = td.download(true, null);
        if (!(bytes > 0)) {
            fail("Failed download");
        }
    }

}

//
// 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 com.cloud.storage.template;

import static org.junit.Assert.fail;

import java.io.File;

import org.junit.Test;

public class LocalTemplateDownloaderTest {

    @Test
    public void localTemplateDownloaderTest() {
        String url =  "file://" + new File("pom.xml").getAbsolutePath();
        TemplateDownloader td = new LocalTemplateDownloader(null, url, System.getProperty("java.io.tmpdir"), TemplateDownloader.DEFAULT_MAX_TEMPLATE_SIZE_IN_BYTES, null);
        long bytes = td.download(true, null);
        if (!(bytes > 0)) {
            fail("Failed download");
        }
    }

}

Use java.io.tmpdir instead of hardcoded /tmp


/**
 * Created by Yannick Lacaute on 17/05/17.
 * Copyright 2015-2016 the original author or authors.
 *

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *

 * http://www.apache.org/licenses/LICENSE-2.0
 *

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.thorpora.ezdashing.sonar;

import org.springframework.context.annotation.Configuration;

import java.time.format.DateTimeFormatter;

@Configuration
public class SonarConfig {

    public static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:MM");

}

/**
 * Created by Yannick Lacaute on 17/05/17.
 * Copyright 2015-2016 the original author or authors.
 *

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *

 * http://www.apache.org/licenses/LICENSE-2.0
 *

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.thorpora.ezdashing.sonar;

import org.springframework.context.annotation.Configuration;

import java.time.format.DateTimeFormatter;

@Configuration
public class SonarConfig {

    public static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("dd/MM HH:MM");

}

Fix bug on Sonar lastUpdate (remove year in format)


/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 2010(Year date of delivery) United States Government, as represented by the Secretary of Health and Human Services.  All rights reserved.
 *
 */
package gov.hhs.fha.nhinc.mpi.adapter.component;

import gov.hhs.fha.nhinc.mpilib.Patients;
import gov.hhs.fha.nhinc.patientdb.model.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author rayj
 */
public class CommonChecks {

    // MPI XML Checks

    public static boolean isSingleSearchResult(Patients patients) {
        return ((patients != null) && (patients.size() == 1));
    }

    public static boolean isMultipleSearchResult(Patients patients) {
        return ((patients != null) && (patients.size() > 1));
    }

    public static boolean isZeroSearchResult(Patients patients) {
        return ((patients == null) || (patients.size() == 0));
    }

    // MPI DB Checks

    public static boolean isSinglePerAASearchResult(List<Patient> patients) {
        boolean result = true;

        Map testMap = new HashMap();
        if (patients != null) {
            for (Patient patient : patients) {
                if (patient.getIdentifiers() != null &&
                        patient.getIdentifiers().size() > 0 &&
                        patient.getIdentifiers().get(0) != null) {
                    String orgId = patient.getIdentifiers().get(0).getOrganizationId();
                    if (testMap.containsKey(orgId)) {
                        result = false;
                        break;
                    }
                }
            }
        }

        return result;
    }

    public static boolean isZeroPerAASearchResult(List<Patient> patients) {
        return ((patients == null) || (patients.size() == 0));
    }

}

/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 2010(Year date of delivery) United States Government, as represented by the Secretary of Health and Human Services.  All rights reserved.
 *
 */
package gov.hhs.fha.nhinc.mpi.adapter.component;

import gov.hhs.fha.nhinc.mpilib.Patients;

/**
 *
 * @author rayj
 */
public class CommonChecks {

    public static boolean isSingleSearchResult(Patients patients) {
        return ((patients != null) && (patients.size() == 1));
    }

    public static boolean isMultipleSearchResult(Patients patients) {
        return ((patients != null) && (patients.size() > 1));
    }

    public static boolean isZeroSearchResult(Patients patients) {
        return ((patients == null) || (patients.size() == 0));
    }

}

CONNECT MPI Adapter - DB implementation - reverted: implemented MPI DB Checks; no longer needed


package com.speedment.common.codegen.internal.java.view.value;

import com.speedment.common.codegen.Generator;
import com.speedment.common.codegen.Transform;
import com.speedment.common.codegen.model.value.InvocationValue;

import java.util.Optional;

import static com.speedment.common.codegen.util.Formatting.nl;
import static com.speedment.common.codegen.util.Formatting.tab;
import static java.util.stream.Collectors.joining;

/**
 * Transforms from an {@link InvocationValue} to java code.
 *
 * @author Emil Forslund
 * @since  2.4.6
 */
public final class InvocationValueView
implements Transform<InvocationValue, String> {

    @Override
    public Optional<String> transform(Generator gen, InvocationValue model) {
        return Optional.of(
            (model.getType() == null ? "" :
                gen.on(model.getType()).get() + ".") +
            model.getValue() +
            (model.getValues().size() <= 3
                ? gen.onEach(model.getValues()).collect(joining(", ", "(", ")"))
                : gen.onEach(model.getValues()).collect(joining(
                    "," + nl() + tab(),
                    "(" + nl() + tab(),
                    nl() + ")"
                ))
            )
        );
    }
}

package com.speedment.common.codegen.internal.java.view.value;

import com.speedment.common.codegen.Generator;
import com.speedment.common.codegen.Transform;
import com.speedment.common.codegen.model.value.InvocationValue;

import java.util.Optional;

import static com.speedment.common.codegen.util.Formatting.indent;
import static com.speedment.common.codegen.util.Formatting.nl;
import static java.util.stream.Collectors.joining;

/**
 * Transforms from an {@link InvocationValue} to java code.
 *
 * @author Emil Forslund
 * @since  2.4.6
 */
public final class InvocationValueView
implements Transform<InvocationValue, String> {

    @Override
    public Optional<String> transform(Generator gen, InvocationValue model) {
        return Optional.of(
            (model.getType() == null ? "" :
                gen.on(model.getType()).get() + ".") +
            model.getValue() +
            (model.getValues().size() <= 3
                ? gen.onEach(model.getValues()).collect(joining(", ", "(", ")"))
                : ("(" + nl() + indent(gen.onEach(model.getValues())
                    .collect(joining("," + nl()))) + nl() + ")"
                )
            )
        );
    }
}

Fix minor formatting issues with new views


/*
 * Copyright (C) 2014 Red Hat, Inc.
 *
 * 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
 *
 * Authors : Dave Tucker, Flavio Fernandes
 */

package org.opendaylight.ovsdb.openstack.netvirt.api;

import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.util.Set;
import java.util.UUID;

/**
 * A MultiTenantForwardingProvider provides Multi-Tenant L3 Forwarding
 */
public interface MultiTenantRouterForwardingProvider {

  void addStaticArpEntry(UUID tenantId, String macAddress, InetAddress ipAddress);

  void addIpRewriteRule(UUID tenantId, InetAddress matchAddress, InetAddress rewriteAddress);

  void addRouterInterface(UUID tenantId, String macAddress, Set<InterfaceAddress> addresses);

  void addForwardingTableEntry(UUID tenantId, InetAddress ipAddress, String macAddress);

  void addDefaultRouteEntry(UUID tenantId, String macAddress, InetAddress nextHop);

}

/*
 * Copyright (C) 2014 Red Hat, Inc.
 *
 * 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
 *
 * Authors : Dave Tucker, Flavio Fernandes
 */

package org.opendaylight.ovsdb.openstack.netvirt.api;

import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.utils.Status;
import org.opendaylight.ovsdb.openstack.netvirt.AbstractEvent;

import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.util.Set;

/**
 * A MultiTenantForwardingProvider provides Multi-Tenant L3 Forwarding
 */
public interface MultiTenantRouterForwardingProvider {

    Status programStaticArpEntry(Node node, Long dpid, String segmentationId,
                                 String macAddress, InetAddress ipAddress, AbstractEvent.Action action);

    Status programIpRewriteRule(Node node, Long dpid, String segmentationId, InetAddress matchAddress,
                                InetAddress rewriteAddress, AbstractEvent.Action action);

    Status programIpRewriteExclusion(Node node, Long dpid, String segmentationId,
                                     InterfaceAddress excludedAddress, AbstractEvent.Action action);

    Status programRouterInterface(Node node, Long dpid, String segmentationId, String macAddress,
                                  Set<InterfaceAddress> addresses, AbstractEvent.Action action);

    Status programForwardingTableEntry(Node node, Long dpid, String segmentationId, InetAddress ipAddress,
                                       String macAddress, AbstractEvent.Action action);

    Status programDefaultRouteEntry(Node node, Long dpid, String segmentationId, String macAddress,
                                    InetAddress nextHop, AbstractEvent.Action action);

}

Add node and dpid information to L3 Forwarding API


package jenkins.advancedqueue;

import hudson.model.Job;
import hudson.model.Queue;
import jenkins.advancedqueue.sorter.ItemInfo;
import jenkins.advancedqueue.sorter.QueueItemCache;
import jenkins.model.Jenkins;
import org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution;

class PriorityConfigurationPlaceholderTaskHelper {

    private static boolean placeholderTaskUsed = Jenkins.getInstance().getPlugin("workflow-durable-task-step") != null;

    boolean isPlaceholderTask(Queue.Task task) {
        return placeholderTaskUsed && task instanceof  ExecutorStepExecution.PlaceholderTask;
    }

    PriorityConfigurationCallback getPriority(ExecutorStepExecution.PlaceholderTask task, PriorityConfigurationCallback priorityCallback) {
        Job<?, ?> job = (Job<?, ?>) task.getOwnerTask();
        ItemInfo itemInfo = QueueItemCache.get().getItem(job.getName());
        itemInfo.getPriority();
        priorityCallback.setPrioritySelection(itemInfo.getPriority());
        return priorityCallback;
    }

    static boolean isPlaceholderTaskUsed() {
        return placeholderTaskUsed;
    }

}

package jenkins.advancedqueue;

import hudson.model.Job;
import hudson.model.Queue;
import jenkins.advancedqueue.sorter.ItemInfo;
import jenkins.advancedqueue.sorter.QueueItemCache;
import jenkins.model.Jenkins;
import org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution;

class PriorityConfigurationPlaceholderTaskHelper {

    boolean isPlaceholderTask(Queue.Task task) {
        return isPlaceholderTaskUsed() && task instanceof  ExecutorStepExecution.PlaceholderTask;
    }

    PriorityConfigurationCallback getPriority(ExecutorStepExecution.PlaceholderTask task, PriorityConfigurationCallback priorityCallback) {
        Job<?, ?> job = (Job<?, ?>) task.getOwnerTask();
        ItemInfo itemInfo = QueueItemCache.get().getItem(job.getName());
        itemInfo.getPriority();
        priorityCallback.setPrioritySelection(itemInfo.getPriority());
        return priorityCallback;
    }

    static boolean isPlaceholderTaskUsed() {
        return Jenkins.getInstance().getPlugin("workflow-durable-task-step") != null;
    }

}

Fix inability dynamically install Pipeline


package com.avairebot.orion.scheduler;

import com.avairebot.orion.Orion;
import com.avairebot.orion.contracts.scheduler.Job;
import net.dv8tion.jda.core.entities.Game;

public class ChangeGameJob extends Job {

    private int index = 0;

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

    @Override
    public void run() {
        if (orion.config.getPlaying().size() <= index) {
            index = 0;
        }

        orion.getJDA().getPresence().setGame(
                Game.of(orion.config.getPlaying().get(index++))
        );
    }
}

package com.avairebot.orion.scheduler;

import com.avairebot.orion.Orion;
import com.avairebot.orion.contracts.scheduler.Job;
import net.dv8tion.jda.core.entities.Game;

public class ChangeGameJob extends Job {

    private int index = 0;

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

    @Override
    public void run() {
        if (orion.config.getPlaying().size() <= index) {
            index = 0;
        }

        orion.getJDA().getPresence().setGame(
                Game.of(formatGame(orion.config.getPlaying().get(index++)))
        );
    }

    private String formatGame(String game) {
        game = game.replaceAll("%users%", "" + orion.getJDA().getUsers().size());
        game = game.replaceAll("%guilds%", "" + orion.getJDA().getGuilds().size());

        if (orion.getJDA().getShardInfo() != null) {
            game = game.replaceAll("%shard-id%", "" + orion.getJDA().getShardInfo().getShardId());
            game = game.replaceAll("%shard-total%", "" + orion.getJDA().getShardInfo().getShardTotal());
        }

        return game;
    }
}

Add user variables to bot game playing status


package com.elmakers.mine.bukkit.api.block;

import java.util.List;

import com.elmakers.mine.bukkit.api.entity.EntityData;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;

import com.elmakers.mine.bukkit.api.magic.Mage;

public interface UndoList extends BlockList, Comparable<UndoList> {
    public void commit();
    public void undo();
    public void undo(boolean undoEntityChanges);

    public void setScheduleUndo(int ttl);
    public int getScheduledUndo();
    public boolean bypass();
    public long getCreatedTime();
    public long getModifiedTime();
    public long getScheduledTime();
    public boolean isScheduled();

    public void prune();

    public void add(Entity entity);
    public void remove(Entity entity);
    public EntityData modify(Entity entity);
    public void add(Runnable runnable);

    public void convert(Entity entity, Block block);
    public void fall(Entity entity, Block block);
    public void explode(Entity entity, List<Block> explodedBlocks);
    public void cancelExplosion(Entity entity);

    public boolean contains(Location location, int threshold);

    public String getName();
    public Mage getOwner();
}

package com.elmakers.mine.bukkit.api.block;

import java.util.List;

import com.elmakers.mine.bukkit.api.entity.EntityData;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;

import com.elmakers.mine.bukkit.api.magic.Mage;

public interface UndoList extends BlockList, Comparable<UndoList> {
    public void commit();
    public void undo();

    public void setEntityUndo(boolean undoEntityEffects);

    public void setScheduleUndo(int ttl);
    public int getScheduledUndo();
    public boolean bypass();
    public long getCreatedTime();
    public long getModifiedTime();
    public long getScheduledTime();
    public boolean isScheduled();

    public void prune();

    public void add(Entity entity);
    public void remove(Entity entity);
    public EntityData modify(Entity entity);
    public void add(Runnable runnable);

    public void convert(Entity entity, Block block);
    public void fall(Entity entity, Block block);
    public void explode(Entity entity, List<Block> explodedBlocks);
    public void cancelExplosion(Entity entity);

    public boolean contains(Location location, int threshold);

    public String getName();
    public Mage getOwner();
}

Refactor entity effect undo control