/*
 * Copyright 2008-2010 Xebia and 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 fr.xebia.management.config;

import org.springframework.beans.factory.xml.NamespaceHandlerSupport;

/**
 * {@link org.springframework.beans.factory.xml.NamespaceHandler} for the '
 * management' namespace.
 */
public class ManagementNamespaceHandler extends NamespaceHandlerSupport {

    public void init() {
        registerBeanDefinitionParser("servlet-context-aware-mbean-server", new ServletContextAwareMBeanServerDefinitionParser());
        registerBeanDefinitionParser("profile-aspect", new ProfileAspectDefinitionParser());
        registerBeanDefinitionParser("application-version-mbean", new WebApplicationMavenInformationDefinitionParser());
        registerBeanDefinitionParser("jms-connection-factory-wrapper", new SpringManagedConnectionFactoryDefinitionParser());
        registerBeanDefinitionParser("eh-cache-management-service", new EhCacheManagementServiceDefinitionParser());

    }

}

/*
 * Copyright 2008-2010 Xebia and 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 fr.xebia.management.config;

import org.springframework.beans.factory.xml.NamespaceHandlerSupport;

/**
 * {@link org.springframework.beans.factory.xml.NamespaceHandler} for the '
 * management' namespace.
 */
public class ManagementNamespaceHandler extends NamespaceHandlerSupport {

    public void init() {
        registerBeanDefinitionParser("servlet-context-aware-mbean-server", new ServletContextAwareMBeanServerDefinitionParser());
        registerBeanDefinitionParser("profile-aspect", new ProfileAspectDefinitionParser());
        registerBeanDefinitionParser("application-version-mbean", new WebApplicationMavenInformationDefinitionParser());
        registerBeanDefinitionParser("jms-connection-factory-wrapper", new SpringManagedConnectionFactoryDefinitionParser());
        registerBeanDefinitionParser("jms-caching-connection-factory", new ManagedCachingConnectionFactoryDefinitionParser());
        registerBeanDefinitionParser("eh-cache-management-service", new EhCacheManagementServiceDefinitionParser());

    }

}

Fix forgotten registration of BeanDefinitionParser for <management:jms-caching-connection-factory>


package org.uva.sea.ql.gui.widget;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComponent;
import javax.swing.JTextField;

import org.uva.sea.ql.ast.Identifier;
import org.uva.sea.ql.evaluate.StringValue;
import org.uva.sea.ql.evaluate.Value;
import org.uva.sea.ql.gui.questionaire.State;

public class StringWidget extends Control{

	private JTextField textfield;

	public StringWidget(Identifier identifier, State state) {
		super(identifier, state);
		textfield = new JTextField();
		textfield.setText("empty");
		textfield.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent e){
					setValue(textToStringValue());
			}

		});

	}

	@Override
	public JComponent UIElement() {
		return textfield;
	}

	@Override
	public void setEnabled(boolean isEnabled) {
		textfield.setEnabled(isEnabled);
	}

	public Value textToStringValue(){
		return new StringValue(textfield.getText());
	}
	@Override
	public void setValue(Value value) {
		textfield.setText(((StringValue) value).getValue());
		setChanged();
		getState().putVariable(getIdentifier(), value);
		getState().notify(getIdentifier());

	}

}

package org.uva.sea.ql.gui.widget;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComponent;
import javax.swing.JTextField;

import org.uva.sea.ql.ast.Identifier;
import org.uva.sea.ql.evaluate.StringValue;
import org.uva.sea.ql.evaluate.Value;
import org.uva.sea.ql.gui.questionaire.State;

public class StringWidget extends Control{

	private JTextField textfield;

	public StringWidget(Identifier identifier, State state) {
		super(identifier, state);
		textfield = new JTextField();
		textfield.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent e){
					setValue(textToStringValue());
			}

		});
		setValue(new StringValue("empty"));

	}

	@Override
	public JComponent UIElement() {
		return textfield;
	}

	@Override
	public void setEnabled(boolean isEnabled) {
		textfield.setEnabled(isEnabled);
	}

	public Value textToStringValue(){
		return new StringValue(textfield.getText());
	}
	@Override
	public void setValue(Value value) {
		textfield.setText(((StringValue) value).getValue());
		setChanged();
		getState().putVariable(getIdentifier(), value);
		getState().notify(getIdentifier());
	}

}

Remove money, bugfixing, added typecheckertests


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

import io.airlift.compress.Decompressor;
import io.airlift.compress.MalformedInputException;

import java.nio.ByteBuffer;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;

public class JdkInflateDecompressor
        implements Decompressor
{
    @Override
    public int decompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength)
            throws MalformedInputException
    {
        try {
            Inflater inflater = new Inflater();
            inflater.setInput(input, inputOffset, inputLength);
            int resultLength = inflater.inflate(output, outputOffset, maxOutputLength);
            inflater.end();
            return resultLength;
        }
        catch (DataFormatException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public void decompress(ByteBuffer input, ByteBuffer output)
            throws MalformedInputException
    {
        throw new UnsupportedOperationException("not yet implemented");
    }
}

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

import io.airlift.compress.Decompressor;
import io.airlift.compress.MalformedInputException;

import java.nio.ByteBuffer;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;

public class JdkInflateDecompressor
        implements Decompressor
{
    @Override
    public int decompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength)
            throws MalformedInputException
    {
        try {
            Inflater inflater = new Inflater(true);
            inflater.setInput(input, inputOffset, inputLength);
            int resultLength = inflater.inflate(output, outputOffset, maxOutputLength);
            inflater.end();
            return resultLength;
        }
        catch (DataFormatException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public void decompress(ByteBuffer input, ByteBuffer output)
            throws MalformedInputException
    {
        throw new UnsupportedOperationException("not yet implemented");
    }
}

Fix round trip for testing JdkInflate / JdkDeflate


package org.bitbucket.openkilda.atdd;

import cucumber.api.PendingException;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;

public class TopologyDiscoveryBasicTest {

	public TopologyDiscoveryBasicTest() {
	}

	@Given("^a new controller$")
	public void a_new_controller() throws Throwable {
	    // Write code here that turns the phrase above into concrete actions
	    throw new PendingException();
	}

	@Given("^a random linear topology of (\\d+)$")
	public void a_random_linear_topology_of(int arg1) throws Throwable {
	    // Write code here that turns the phrase above into concrete actions
	    throw new PendingException();
	}

	@When("^the controller learns the topology$")
	public void the_controller_learns_the_topology() throws Throwable {
	    // Write code here that turns the phrase above into concrete actions
	    throw new PendingException();
	}

	@Then("^the controller should converge within (\\d+) milliseconds$")
	public void the_controller_should_converge_within_milliseconds(int arg1) throws Throwable {
	    // Write code here that turns the phrase above into concrete actions
	    throw new PendingException();
	}

	@Given("^a random full-mesh topology of (\\d+)$")
	public void a_random_full_mesh_topology_of(int arg1) throws Throwable {
	    // Write code here that turns the phrase above into concrete actions
	    throw new PendingException();
	}

}

package org.bitbucket.openkilda.atdd;

import cucumber.api.PendingException;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;

public class TopologyDiscoveryBasicTest {

	public TopologyDiscoveryBasicTest() {
	}

	@Given("^a new controller$")
	public void a_new_controller() throws Throwable {
	    // Write code here that turns the phrase above into concrete actions
	    throw new PendingException();
	}

	@Given("^a random linear topology of (\\d+)$")
	public void a_random_linear_topology_of(int arg1) throws Throwable {
	    // Write code here that turns the phrase above into concrete actions
			// TODO: Will need to send the IP address of the controller.
	    throw new PendingException();
	}

	@When("^the controller learns the topology$")
	public void the_controller_learns_the_topology() throws Throwable {
	    // Write code here that turns the phrase above into concrete actions
	    throw new PendingException();
	}

	@Then("^the controller should converge within (\\d+) milliseconds$")
	public void the_controller_should_converge_within_milliseconds(int arg1) throws Throwable {
	    // Write code here that turns the phrase above into concrete actions
	    throw new PendingException();
	}

	@Given("^a random full-mesh topology of (\\d+)$")
	public void a_random_full_mesh_topology_of(int arg1) throws Throwable {
	    // Write code here that turns the phrase above into concrete actions
	    throw new PendingException();
	}

}

Add comment re: send IP of controller for test.


package org.concord.datagraph.analysis;

import java.awt.Component;
import java.util.ArrayList;

import org.concord.data.state.OTDataStore;
import org.concord.datagraph.analysis.rubric.GraphRubric;
import org.concord.datagraph.analysis.rubric.ResultSet;
import org.concord.datagraph.state.OTDataCollector;
import org.concord.framework.otrunk.OTObjectList;
import org.concord.graph.util.state.OTHideableAnnotation;

public interface GraphAnalyzer {
    public Graph getSegments(OTDataStore dataStore, int xChannel, int yChannel, double tolerance) throws IndexOutOfBoundsException;
    public GraphRubric buildRubric(OTObjectList rubric);
    public ResultSet compareGraphs(GraphRubric expected, Graph received);
    public String getHtmlReasons(ResultSet results);
    public void displayHtmlReasonsPopup(Component parent, ResultSet results);
    public ArrayList<OTHideableAnnotation> annotateResults(OTDataCollector studentObject, ResultSet scoreResults);
}

package org.concord.datagraph.analysis;

import java.awt.Component;
import java.util.ArrayList;

import org.concord.data.state.OTDataStore;
import org.concord.datagraph.analysis.rubric.GraphRubric;
import org.concord.datagraph.analysis.rubric.ResultSet;
import org.concord.datagraph.state.OTDataCollector;
import org.concord.datagraph.state.OTDataGraphable;
import org.concord.framework.otrunk.OTObjectList;
import org.concord.graph.util.state.OTHideableAnnotation;

public interface GraphAnalyzer {
    public Graph getSegments(OTDataStore dataStore, int xChannel, int yChannel, double tolerance) throws IndexOutOfBoundsException;
    public GraphRubric buildRubric(OTObjectList rubric);
    public ResultSet compareGraphs(GraphRubric expected, Graph received);
    public String getHtmlReasons(ResultSet results);
    public void displayHtmlReasonsPopup(Component parent, ResultSet results);
    public ArrayList<OTHideableAnnotation> annotateResults(OTDataCollector dataCollector, ResultSet scoreResults);
    public OTDataGraphable drawSegmentResults(OTDataCollector dataCollector, Graph graph);
}

Add support for drawing the interpreted segments into a data collector.


package com.fedorvlasov.lazylist;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class LazyAdapter extends BaseAdapter {

    private Activity activity;
    private String[] data;
    private static LayoutInflater inflater=null;
    public ImageLoader imageLoader;

    public LazyAdapter(Activity a, String[] d) {
        activity = a;
        data=d;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        imageLoader=new ImageLoader(activity.getApplicationContext());
    }

    public int getCount() {
        return data.length;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.item, null);

        TextView text=(TextView)vi.findViewById(R.id.text);;
        ImageView image=(ImageView)vi.findViewById(R.id.image);
        text.setText("item "+position);
        imageLoader.DisplayImage(data[position], image);
        return vi;
    }
}

package com.fedorvlasov.lazylist;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class LazyAdapter extends BaseAdapter {

    private Activity activity;
    private String[] data;
    private static LayoutInflater inflater=null;
    public ImageLoader imageLoader;

    public LazyAdapter(Activity a, String[] d) {
        activity = a;
        data=d;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        imageLoader=new ImageLoader(activity);
    }

    public int getCount() {
        return data.length;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.item, null);

        TextView text=(TextView)vi.findViewById(R.id.text);;
        ImageView image=(ImageView)vi.findViewById(R.id.image);
        text.setText("item "+position);
        imageLoader.DisplayImage(data[position], image);
        return vi;
    }
}

Use activity context not application context


package roart.common.filesystem;

import java.util.Map;

import roart.common.inmemory.model.InmemoryMessage;
import roart.common.model.FileObject;

public class FileSystemMessageResult {
    public Map<FileObject, InmemoryMessage> message;
}

package roart.common.filesystem;

import java.util.Map;

import roart.common.inmemory.model.InmemoryMessage;
import roart.common.model.FileObject;

public class FileSystemMessageResult extends FileSystemResult {
    public Map<FileObject, InmemoryMessage> message;
}

Read file batch transfer (I38).


/*
 * Copyright 2008-2010 Brookhaven National Laboratory
 * All rights reserved. Use is subject to license terms.
 */

package org.epics.pvmanager;

import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.*;
import static org.epics.pvmanager.ExpressionLanguage.*;
import static org.epics.pvmanager.data.ExpressionLanguage.*;

/**
 *
 * @author carcassi
 */
public class WriteSyntaxTest {

    @Test
    public void simpleWriter() {
        String channelName = "test";
        ChannelExpression<Object> chExpr = toChannel(channelName);
        assertThat(chExpr.getDefaultName(), equalTo(channelName));
        assertThat(((WriteCache<Object>) chExpr.getWriteFunction()).getValue(), nullValue());
        assertThat(((WriteCache<Object>) chExpr.getWriteFunction()).getPrecedingChannels().isEmpty(), equalTo(true));
        WriteExpression<Object> expr = toChannel(channelName).after("a", "b");
        assertThat(expr.getDefaultName(), equalTo(channelName));
        assertThat(((WriteCache<Object>) expr.getWriteFunction()).getValue(), nullValue());
        assertThat(((WriteCache<Object>) expr.getWriteFunction()).getPrecedingChannels(), hasSize(2));
        assertThat(((WriteCache<Object>) expr.getWriteFunction()).getPrecedingChannels(), contains("a", "b"));

        PVWriter<Object> writer = PVManager.write(toChannel(channelName)).sync();
        writer.write(10);
    }

}

/*
 * Copyright 2008-2010 Brookhaven National Laboratory
 * All rights reserved. Use is subject to license terms.
 */

package org.epics.pvmanager;

import org.epics.pvmanager.loc.LocalDataSource;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.*;
import static org.epics.pvmanager.ExpressionLanguage.*;
import static org.epics.pvmanager.data.ExpressionLanguage.*;

/**
 *
 * @author carcassi
 */
public class WriteSyntaxTest {

    @Test
    public void simpleWriter() {
        String channelName = "test";
        ChannelExpression<Object> chExpr = toChannel(channelName);
        assertThat(chExpr.getDefaultName(), equalTo(channelName));
        assertThat(((WriteCache<Object>) chExpr.getWriteFunction()).getValue(), nullValue());
        assertThat(((WriteCache<Object>) chExpr.getWriteFunction()).getPrecedingChannels().isEmpty(), equalTo(true));
        WriteExpression<Object> expr = toChannel(channelName).after("a", "b");
        assertThat(expr.getDefaultName(), equalTo(channelName));
        assertThat(((WriteCache<Object>) expr.getWriteFunction()).getValue(), nullValue());
        assertThat(((WriteCache<Object>) expr.getWriteFunction()).getPrecedingChannels(), hasSize(2));
        assertThat(((WriteCache<Object>) expr.getWriteFunction()).getPrecedingChannels(), contains("a", "b"));

        PVWriter<Object> writer = PVManager.write(toChannel(channelName)).from(new LocalDataSource()).sync();
        writer.write(10);
    }

}

Write syntax test on LocalDataSource which supports writes.


/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */

package cx2x.xcodeml.xelement;

import cx2x.xcodeml.exception.IllegalTransformationException;
import cx2x.xcodeml.helper.XelementHelper;
import helper.XmlHelper;
import org.junit.Test;

import static junit.framework.TestCase.fail;
import static org.junit.Assert.assertNotNull;

/**
 * Test methods of the XelementHelper class
 *
 * @author clementval
 */
public class XelementHelperTest {

  @Test
  public void createBinaryExprTest(){
    try {
      XcodeProgram xcodeml = XmlHelper.getDummyXcodeProgram();
      XbinaryExpr expr =
          XelementHelper.createEmpty(XelementName.LOG_EQ_EXPR, xcodeml);
      assertNotNull(expr);
    } catch (IllegalTransformationException ex){
      fail();
    }
  }
}

/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */

package cx2x.xcodeml.xelement;

import cx2x.xcodeml.exception.IllegalTransformationException;
import cx2x.xcodeml.helper.XelementHelper;
import helper.XmlHelper;
import org.junit.Test;

import java.io.File;
import java.util.Arrays;
import java.util.List;

import static junit.framework.TestCase.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

/**
 * Test methods of the XelementHelper class
 *
 * @author clementval
 */
public class XelementHelperTest {

  @Test
  public void createBinaryExprTest(){
    try {
      XcodeProgram xcodeml = XmlHelper.getDummyXcodeProgram();
      XbinaryExpr expr =
          XelementHelper.createEmpty(XelementName.LOG_EQ_EXPR, xcodeml);
      assertNotNull(expr);
    } catch (IllegalTransformationException ex){
      fail();
    }
  }

  @Test
  public void xpathIntersectTest(){
    File f = new File(XmlHelper.TEST_PROGRAM);
    assertTrue(f.exists());
    XcodeProgram xcodeml =  XcodeProgram.createFromFile(XmlHelper.TEST_PROGRAM);
    assertNotNull(xcodeml);

    List<Xpragma> pragmas = XelementHelper.findAllPragmas(xcodeml);
    assertEquals(4, pragmas.size());

    Xpragma loopHoistStart = pragmas.get(1);
    assertNotNull(loopHoistStart);
    assertTrue(loopHoistStart.getValue().contains("loop-hoist"));
    Xpragma loopHoistEnd = pragmas.get(2);
    assertNotNull(loopHoistEnd);
    assertTrue(loopHoistEnd.getValue().contains("end loop-hoist"));

    List<XdoStatement> stmts =
        XelementHelper.findDoStatement(loopHoistStart, loopHoistEnd,
        Arrays.asList("j", "i"));

    assertEquals(3, stmts.size());

  }
}

Test findDoStatement method for loop-hoisting


package edu.colorado.csdms.bmi;

/**
 * Get variables from a model.
 *

 * See the BMI documentation for
 * detailed information about each function.
 */
public interface BmiGetter {

  public void getValue(String varName, double[] dest);
  public void getValue(String varName, int[] dest);
  public void getValue(String varName, String[] dest);

  public <T> T getValueRef(String varName);

  public void getValueAtIndices(String varName, double[] dest, int[] indices);
  public void getValueAtIndices(String varName, int[] dest, int[] indices);
  public void getValueAtIndices(String varName, String[] dest, int[] indices);
}

package edu.colorado.csdms.bmi;

/**
 * Get variables from a model.
 *

 * See the BMI documentation for
 * detailed information about each function.
 */
public interface BmiGetter {

  public void getValue(String varName, double[] dest);
  public void getValue(String varName, int[] dest);
  public void getValue(String varName, String[] dest);

  public <T> T getValuePtr(String varName);

  public void getValueAtIndices(String varName, double[] dest, int[] indices);
  public void getValueAtIndices(String varName, int[] dest, int[] indices);
  public void getValueAtIndices(String varName, String[] dest, int[] indices);
}

Use correct name for get_value_ptr


package com.aayaffe.sailingracecoursemanager.communication;

import java.io.Serializable;

/**
 * Created by aayaffe on 30/09/2015.
 */
public enum ObjectTypes {
    WorkerBoat,
    FlagBuoy,
    TomatoBuoy,
    TriangleBuoy,
    StartLine,
    FinishLine,
    StartFinishLine,

    RaceManager,  //from here, the relevant ObjectTypes:
    Buoy,
    Gate,
    Satellite,
    ReferencePoint,
    Other
}

package com.aayaffe.sailingracecoursemanager.communication;

import java.io.Serializable;

/**
 * Created by aayaffe on 30/09/2015.
 */
public enum ObjectTypes {
    RaceManager(0),
    WorkerBoat(1),
    Buoy(2),
    FlagBuoy(3),
    TomatoBuoy(4),
    TriangleBuoy(5),
    StartLine(6),
    FinishLine(7),
    StartFinishLine(8),
    Gate(9),
    ReferencePoint(10),
    Other(11);

    private int value;

    ObjectTypes(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }
}

Revert "Revert "Updated object types in Dev""


package biz.aQute.resolve;

import junit.framework.*;

public class ResolverLoggerTest extends TestCase {

	public void testSimple() throws Exception {
		ResolverLogger rl = new ResolverLogger();

		rl.log(ResolverLogger.LOG_ERROR, "test", null);
		assertEquals("ERROR: test\n", rl.getLog());

		for ( int i=0; i < 100000; i++) {
			rl.log(ResolverLogger.LOG_ERROR, "test " + i, null);
		}

		String s = rl.getLog();
		assertTrue( s.endsWith("test 99999\n"));
	}
}

package biz.aQute.resolve;

import junit.framework.*;

public class ResolverLoggerTest extends TestCase {

	public void testSimple() throws Exception {
		ResolverLogger rl = new ResolverLogger();

		rl.log(ResolverLogger.LOG_ERROR, "test", null);
		assertEquals(String.format("ERROR: test%n"), rl.getLog());

		for ( int i=0; i < 100000; i++) {
			rl.log(ResolverLogger.LOG_ERROR, "test " + i, null);
		}

		String s = rl.getLog();
		assertTrue( s.endsWith("test 99999\n"));
	}
}

Fix logger test for windows


package no.ssb.vtl.script.expressions;

import no.ssb.vtl.model.VTLObject;

import javax.script.Bindings;

public class MembershipExpression extends VariableExpression {

    private String dataset;

    public MembershipExpression(Class<?> type, String dataset, String right) {
        super(type, right);
    }

    public String getDatasetIdentifier() {
        return dataset;
    }

    @Override
    public VTLObject resolve(Bindings bindings) {
        return super.resolve((Bindings) bindings.get(dataset));
    }
}

package no.ssb.vtl.script.expressions;

import no.ssb.vtl.model.VTLObject;

import javax.script.Bindings;

import static com.google.common.base.Preconditions.checkNotNull;

public class MembershipExpression extends VariableExpression {

    private String dataset;

    public MembershipExpression(Class<?> type, String dataset, String right) {
        super(type, right);
        this.dataset = checkNotNull(dataset);
    }

    public String getDatasetIdentifier() {
        return dataset;
    }

    @Override
    public VTLObject resolve(Bindings bindings) {
        return super.resolve((Bindings) bindings.get(dataset));
    }
}

Set dataset id in membership


/*
 * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
 *
 * Licensed under the BSD-3 License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://opensource.org/licenses/BSD-3-Clause
 *
 * 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.palantir.atlasdb.ete;

import java.util.List;

import org.junit.ClassRule;
import org.junit.rules.RuleChain;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import com.google.common.collect.ImmutableList;

@RunWith(Suite.class)
@Suite.SuiteClasses({
        TodoEteTest.class,
        TimestampManagementEteTest.class
    })
public class DbKvsTestSuite extends EteSetup {
    private static final List<String> CLIENTS = ImmutableList.of("ete1", "ete2", "ete3");

    @ClassRule
    public static final RuleChain COMPOSITION_SETUP = EteSetup.setupComposition(
            DbKvsTestSuite.class,
            "docker-compose.dbkvs.yml",
            CLIENTS);
}

Fix indentation in test suite


package uk.ac.ebi.atlas.widget;

import org.springframework.dao.RecoverableDataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;
import uk.ac.ebi.atlas.web.controllers.ResourceNotFoundException;

public abstract class HeatmapWidgetErrorHandler {

    @ExceptionHandler(value = {ResourceNotFoundException.class})
    @ResponseStatus(value = HttpStatus.NOT_FOUND)
    public ModelAndView widgetSpecific404(Exception e) {
        ModelAndView mav = new ModelAndView("widget-error");
        mav.addObject("errorMessage", e.getMessage());

        return mav;
    }

    @ExceptionHandler(value = {RecoverableDataAccessException.class})
    @ResponseStatus(value = HttpStatus.NOT_FOUND)
    public ModelAndView blah(Exception e) {
        ModelAndView mav = new ModelAndView("widget-error");
        mav.addObject("errorMessage", e.getMessage());

        return mav;
    }
}

package uk.ac.ebi.atlas.widget;

import org.springframework.dao.RecoverableDataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;
import uk.ac.ebi.atlas.web.controllers.ResourceNotFoundException;

public abstract class HeatmapWidgetErrorHandler {

    @ExceptionHandler(value = {ResourceNotFoundException.class})
    @ResponseStatus(value = HttpStatus.NOT_FOUND)
    public ModelAndView widgetSpecific404(Exception e) {
        ModelAndView mav = new ModelAndView("widget-error");
        mav.addObject("exceptionMessage", e.getMessage());

        return mav;
    }

    @ExceptionHandler(value = {RecoverableDataAccessException.class})
    @ResponseStatus(value = HttpStatus.NOT_FOUND)
    public ModelAndView blah(Exception e) {
        ModelAndView mav = new ModelAndView("widget-error");
        mav.addObject("exceptionMessage", e.getMessage());

        return mav;
    }
}

Use exceptionMessage for the widget error page as all other error pages


package org.gbif.occurrence.ws.client.mock;

import org.gbif.api.model.occurrence.Occurrence;
import org.gbif.api.vocabulary.BasisOfRecord;
import org.gbif.dwc.terms.DwcTerm;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class OccurrencePersistenceMockServiceTest {

  @Test
  public void testGenerator() {
    OccurrencePersistenceMockService srv = new OccurrencePersistenceMockService();
    Occurrence occ = srv.get(112);
    assertEquals((Integer) 112, occ.getKey());
    assertEquals(OccurrencePersistenceMockService.DATASETS.get(2), occ.getDatasetKey());
    assertEquals("cat-112", occ.getVerbatimField(DwcTerm.catalogNumber));
    assertEquals("Chromista", occ.getKingdom());
    assertEquals((Integer) 4, occ.getKingdomKey());
    assertEquals(BasisOfRecord.PRESERVED_SPECIMEN, occ.getBasisOfRecord());
    assertEquals((Integer) 1912, occ.getYear());
    assertEquals((Integer) 5, occ.getMonth());
    assertEquals((Integer) 112, occ.getElevation());
  }
}

package org.gbif.occurrence.ws.client.mock;

import org.gbif.api.model.occurrence.Occurrence;
import org.gbif.api.vocabulary.BasisOfRecord;
import org.gbif.dwc.terms.DwcTerm;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class OccurrencePersistenceMockServiceTest {

  @Test
  public void testGenerator() {
    OccurrencePersistenceMockService srv = new OccurrencePersistenceMockService();
    Occurrence occ = srv.get(112);
    assertEquals((Integer) 112, occ.getKey());
    assertEquals(OccurrencePersistenceMockService.DATASETS.get(2), occ.getDatasetKey());
    assertEquals("cat-112", occ.getVerbatimField(DwcTerm.catalogNumber));
    assertEquals("Chromista", occ.getKingdom());
    assertEquals((Integer) 4, occ.getKingdomKey());
    assertEquals(BasisOfRecord.PRESERVED_SPECIMEN, occ.getBasisOfRecord());
    assertEquals((Integer) 1912, occ.getYear());
    assertEquals((Integer) 5, occ.getMonth());
    assertEquals( (Double) 112d, occ.getElevation());
  }
}

Fix yet another double/int broken elevation test


/*******************************************************************************
 * Copyright (c) 2010 David Green and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     David Green - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.internal.wikitext.confluence.core.token;

import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElement;
import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElementProcessor;

/**
 * @author David Green
 */
public class EscapedCharacterReplacementToken extends PatternBasedElement {

	@Override
	protected String getPattern(int groupOffset) {
		// currently we only escape curly braces, however
		// it's possible there may be others.  The documentation only shows escaping these.
		return "\\\\(\\{|\\}|\\[|\\])"; //$NON-NLS-1$
	}

	@Override
	protected int getPatternGroupCount() {
		return 1;
	}

	@Override
	protected PatternBasedElementProcessor newProcessor() {
		return new EscapedCharacterReplacementTokenProcessor();
	}

	private static class EscapedCharacterReplacementTokenProcessor extends PatternBasedElementProcessor {
		@Override
		public void emit() {
			String character = group(1);
			getBuilder().characters(character);
		}

	}
}

/*******************************************************************************
 * Copyright (c) 2010 David Green and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     David Green - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.internal.wikitext.confluence.core.token;

import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElement;
import org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElementProcessor;

/**
 * @author David Green
 */
public class EscapedCharacterReplacementToken extends PatternBasedElement {

	@Override
	protected String getPattern(int groupOffset) {
		// currently we only escape curly braces, however
		// it's possible there may be others.  The documentation only shows escaping these.
		return "\\\\(\\{|\\}|\\[|\\]|\\||\\!)"; //$NON-NLS-1$
	}

	@Override
	protected int getPatternGroupCount() {
		return 1;
	}

	@Override
	protected PatternBasedElementProcessor newProcessor() {
		return new EscapedCharacterReplacementTokenProcessor();
	}

	private static class EscapedCharacterReplacementTokenProcessor extends PatternBasedElementProcessor {
		@Override
		public void emit() {
			String character = group(1);
			getBuilder().characters(character);
		}

	}
}

Fix some missing escape replacements


package me.footlights.core.data.store;

import java.nio.ByteBuffer;
import java.util.*;

/** A block store in memory. */
public class MemoryStore extends LocalStore
{
	public MemoryStore()
	{
		super(null);
		blocks = new HashMap<String,ByteBuffer>();
	}

	@Override
	public AbstractCollection<String> list()
	{
		return (AbstractSet<String>) blocks.keySet();
	}

	@Override
	public void put(String name, ByteBuffer bytes)
	{
		blocks.put(name, bytes);
	}

	@Override
	public ByteBuffer get(String name)
	{
		return blocks.get(name).asReadOnlyBuffer();
	}

	@Override
	public void flush() { /* do nothing; this class always blocks */ }

	/** That actual block store */
	private Map<String,ByteBuffer> blocks;
}

package me.footlights.core.data.store;

import java.nio.ByteBuffer;
import java.util.*;

import me.footlights.core.data.NoSuchBlockException;

/** A block store in memory. */
public class MemoryStore extends LocalStore
{
	public MemoryStore()
	{
		super(null);
		blocks = new HashMap<String,ByteBuffer>();
	}

	@Override
	public AbstractCollection<String> list()
	{
		return (AbstractSet<String>) blocks.keySet();
	}

	@Override
	public void put(String name, ByteBuffer bytes)
	{
		if (name == null) throw new NullPointerException();
		blocks.put(name, bytes);
	}

	@Override public ByteBuffer get(String name) throws NoSuchBlockException
	{
		ByteBuffer buffer = blocks.get(name);

		if (buffer == null) throw new NoSuchBlockException(this, name);
		else return buffer.asReadOnlyBuffer();
	}

	@Override
	public void flush() { /* do nothing; this class always blocks */ }

	/** That actual block store */
	private Map<String,ByteBuffer> blocks;
}

Throw exception rather than return null.


package com.todoist.mediaparser.mediaparser;

import com.todoist.mediaparser.util.MediaType;

import java.util.regex.Pattern;

public class FlickrParser extends BaseOEmbedMediaParserWithContent {
	private static Pattern sMatchingPattern;

	FlickrParser(String url) {
		super(url);
	}

	@Override
	public MediaType getContentMediaType() {
		return MediaType.OTHER;
	}

	@Override
	protected Pattern getMatchingPattern() {
		if(sMatchingPattern == null) {
			sMatchingPattern = Pattern.compile(
					"https?://(?:www\\.)?(?:flic\\.kr/p|flickr.com/photos)/\\w+/?",
					Pattern.CASE_INSENSITIVE
			);
		}
		return sMatchingPattern;
	}

	@Override
	protected String getOEmbedUrlTemplate() {
		return "http://www.flickr.com/services/oembed?url=%s&format=json";
	}

	@Override
	protected String getOEmbedContentUrlName() {
		return "url";
	}

	@Override
	protected String getOEmbedThumbnailUrlName() {
		return "thumbnail_url";
	}
}

package com.todoist.mediaparser.mediaparser;

import com.todoist.mediaparser.util.MediaType;

import java.util.regex.Pattern;

public class FlickrParser extends BaseOEmbedMediaParserWithContent {
	private static Pattern sMatchingPattern;

	FlickrParser(String url) {
		super(url);
	}

	@Override
	public MediaType getContentMediaType() {
		return MediaType.OTHER;
	}

	@Override
	protected Pattern getMatchingPattern() {
		if(sMatchingPattern == null) {
			sMatchingPattern = Pattern.compile(
					"https?://(?:www\\.)?(?:flic\\.kr/p|flickr.com/photos)/\\w+/?",
					Pattern.CASE_INSENSITIVE
			);
		}
		return sMatchingPattern;
	}

	@Override
	protected String createThumbnailUrl(int smallestSide) {
		// Flickr thumbnails are tiny. If available, use content url.
		String contentUrl = super.getContentUrl();
		if(!mUrl.equals(contentUrl))
			return contentUrl;
		else
			return super.createThumbnailUrl(smallestSide);
	}

	@Override
	protected String getOEmbedUrlTemplate() {
		return "http://www.flickr.com/services/oembed?url=%s&format=json";
	}

	@Override
	protected String getOEmbedContentUrlName() {
		return "url";
	}

	@Override
	protected String getOEmbedThumbnailUrlName() {
		return "thumbnail_url";
	}
}

Use flickr's full image for the thumbnail, if available


package io.scalecube.gateway.benchmarks;

import io.scalecube.services.api.ServiceMessage;
import java.util.concurrent.Callable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;

public class BenchmarksServiceImpl implements BenchmarksService {

  @Override
  public Mono<ServiceMessage> one(ServiceMessage message) {
    Callable<ServiceMessage> callable =
        () -> {
          long value = System.currentTimeMillis();
          return ServiceMessage.from(message)
              .header(SERVICE_RECV_TIME, value)
              .header(SERVICE_SEND_TIME, value)
              .data("hello")
              .build();
        };
    return Mono.fromCallable(callable).subscribeOn(Schedulers.parallel());
  }

  @Override
  public Mono<ServiceMessage> failure(ServiceMessage message) {
    return Mono.defer(() -> Mono.error(new RuntimeException("General failure")));
  }

  @Override
  public Flux<ServiceMessage> infiniteStream(ServiceMessage message) {
    return Flux.defer(
        () -> {
          Callable<ServiceMessage> callable =
              () ->
                  ServiceMessage.builder()
                      .qualifier(message.qualifier())
                      .header(SERVICE_SEND_TIME, Long.toString(System.currentTimeMillis()))
                      .build();
          return Mono.fromCallable(callable).subscribeOn(Schedulers.parallel()).repeat();
        });
  }
}

package io.scalecube.gateway.benchmarks;

import io.scalecube.services.api.ServiceMessage;
import java.util.concurrent.Callable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;

public class BenchmarksServiceImpl implements BenchmarksService {

  @Override
  public Mono<ServiceMessage> one(ServiceMessage message) {
    Callable<ServiceMessage> callable =
        () -> {
          long value = System.currentTimeMillis();
          return ServiceMessage.from(message)
              .header(SERVICE_RECV_TIME, value)
              .header(SERVICE_SEND_TIME, value)
              .data("hello")
              .build();
        };
    return Mono.fromCallable(callable).subscribeOn(Schedulers.parallel());
  }

  @Override
  public Mono<ServiceMessage> failure(ServiceMessage message) {
    return Mono.defer(() -> Mono.error(new RuntimeException("General failure")));
  }

  @Override
  public Flux<ServiceMessage> infiniteStream(ServiceMessage message) {
    Callable<ServiceMessage> callable =
        () ->
            ServiceMessage.from(message)
                .header(SERVICE_SEND_TIME, System.currentTimeMillis())
                .build();
    return Mono.fromCallable(callable)
        .subscribeOn(Schedulers.parallel())
        .repeat()
        .onBackpressureDrop();
  }
}

Set stream scenario be in sync with stream scenario from services


/*******************************************************************************
 * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package org.eclipse.egit.ui.internal.actions;

/**
 * Action for displaying fetch wizard - allowing selection of specifications for
 * fetch, and fetching objects/refs from another repository.
 */
public class MergeToolAction extends RepositoryAction {
	/**
	 *
	 */
	public MergeToolAction() {
		super(ActionCommands.MERGE_TOOL_ACTION, new MergeToolActionHandler());
	}
}

/*******************************************************************************
 * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package org.eclipse.egit.ui.internal.actions;

/**
 * Action for invoking a merge editor for resources with merge conflicts
 */
public class MergeToolAction extends RepositoryAction {
	/**
	 *
	 */
	public MergeToolAction() {
		super(ActionCommands.MERGE_TOOL_ACTION, new MergeToolActionHandler());
	}
}

Fix a misleading javadoc comment.


package com.jcalvopinam.api;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class PrototypeApiApplicationTests {

    @Test
    public void contextLoads() {
    }

}

package com.jcalvopinam.api;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class PrototypeApiApplicationTests {

    @Test
    public void contextLoads() {
    }

    @Test
    public void applicationContextTest() {
        PrototypeApiApplication.main(new String[]{});
    }

}

Add unit test for main class of spring-boot application


/*
 * Copyright 2018-2022 Asynchronous Game Query Library
 *
 * 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.ibasco.agql.core.exceptions;

public class InvalidPacketException extends ResponseProcessingException {
    public InvalidPacketException() {
        super();
    }

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

    public InvalidPacketException(String message, Throwable cause) {
        super(message, cause);
    }

    public InvalidPacketException(Throwable cause) {
        super(cause);
    }

    public InvalidPacketException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
}

/*
 * Copyright (c) 2022 Asynchronous Game Query Library
 *
 * 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.ibasco.agql.core.exceptions;

public class InvalidPacketException extends ResponseProcessingException {

    private final byte[] data;

    public InvalidPacketException(String message, byte[] data) {
        super(message);
        this.data = data;
    }

    public byte[] getData() {
        return data;
    }
}

Include payload data in exception


/*
 * This file is part of Bitsquare.
 *
 * Bitsquare is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 *
 * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
 */

package io.bitsquare.locale;

import java.io.Serializable;

public class CurrencyTuple implements Serializable {
    // That object is used for serializing to a Json file.

    public final String code;
    public final String name;

    public CurrencyTuple(String code, String name) {
        this.code = code;
        this.name = name;
    }
}

/*
 * This file is part of Bitsquare.
 *
 * Bitsquare is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 *
 * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
 */

package io.bitsquare.locale;

import java.io.Serializable;

public class CurrencyTuple implements Serializable {
    // That object is used for serializing to a Json file.

    public final String code;
    public final String name;
    public final int precision; // precision 4 is 1/10000 -> 0.0001 is smallest unit

    public CurrencyTuple(String code, String name) {
        // We use Fiat class and there precision is 4
        // In future we might add custom precision per currency
        this(code, name, 4);
    }

    public CurrencyTuple(String code, String name, int precision) {
        this.code = code;
        this.name = name;
        this.precision = precision;
    }
}

Add precision to currency json


package org.zalando.nakadi.annotations.validation;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({
        ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE,
        ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@NotEmpty(message = "Key cannot be empty")
@Pattern(regexp = "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[^/]*$",
        message = "Key name should be an optional lowercase domain name with path")
@Pattern(regexp = "^([-.a-z0-9]{0,253}/)?[^/]*$",
        message = "Key prefix cannot be more than 253 characters.")
@Pattern(regexp = "^([-.a-z0-9]+/)?[^/]{0,63}$",
        message = "Key name cannot be more than 63 characters.")
@Pattern(regexp = "^([^/]+/)?[a-zA-Z0-9]([a-zA-Z0-9_.-]*[a-zA-Z0-9])?$",
        message = "Key name should start with letter or digit and end with letter")
@Constraint(validatedBy = {})
public @interface LabelKey {
    String message() default "{org.zalando.nakadi.annotations.validation.LabelKey.message}}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}

package org.zalando.nakadi.annotations.validation;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({
        ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE,
        ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@AnnotationKey
@Constraint(validatedBy = {})
public @interface LabelKey {
    String message() default "{org.zalando.nakadi.annotations.validation.LabelKey.message}}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}

Reduce the amount of lines


package io.car.server.rest.encoding.rdf.linker;

import com.google.inject.Provider;
import com.hp.hpl.jena.rdf.model.Model;
import io.car.server.core.entities.Group;
import io.car.server.core.entities.Measurement;
import io.car.server.rest.encoding.rdf.RDFLinker;
import static io.car.server.rest.encoding.rdf.linker.MeasurementDCTermsLinker.ODBL_URL;
import io.car.server.rest.resources.GroupsResource;
import io.car.server.rest.resources.MeasurementsResource;
import io.car.server.rest.resources.RootResource;
import io.car.server.rest.rights.AccessRights;
import javax.ws.rs.core.UriBuilder;

/**
 *
 * @author Jan Wirwahn
 */
public class GroupDCTermsLinker implements RDFLinker<Group> {

    public static final String ODBL_URL = "http://opendatacommons.org/licenses/odbl/";

    @Override
    public void link(Model m, Group t, AccessRights rights, Provider<UriBuilder> uriBuilder) {
        String uri = uriBuilder.get()
                .path(RootResource.class)
                .path(RootResource.GROUPS)
                .path(GroupsResource.GROUP)
                .build(t.getName()).toASCIIString();

        m.createResource(uri).addProperty(DCTerms.rights, ODBL_URL);
    }
}

package io.car.server.rest.encoding.rdf.linker;

import com.google.inject.Provider;
import com.hp.hpl.jena.rdf.model.Model;
import io.car.server.core.entities.Group;
import io.car.server.rest.encoding.rdf.RDFLinker;
import io.car.server.rest.resources.GroupsResource;
import io.car.server.rest.resources.RootResource;
import io.car.server.rest.rights.AccessRights;
import javax.ws.rs.core.UriBuilder;

/**
 *
 * @author Jan Wirwahn
 */
public class GroupDCTermsLinker implements RDFLinker<Group> {

    public static final String ODBL_URL = "http://opendatacommons.org/licenses/odbl/";

    @Override
    public void link(Model m, Group t, AccessRights rights, Provider<UriBuilder> uriBuilder) {
        String uri = uriBuilder.get()
                .path(RootResource.class)
                .path(RootResource.GROUPS)
                .path(GroupsResource.GROUP)
                .build(t.getName()).toASCIIString();

        m.createResource(uri).addProperty(DCTerms.rights, ODBL_URL);
    }
}

Fix in group DC licence


/*******************************************************************************
 * Copyright (c) 2006 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.chart.ui.swt.wizard.format.popup.series;

import org.eclipse.birt.chart.model.component.Scale;
import org.eclipse.birt.chart.model.type.DialSeries;
import org.eclipse.birt.chart.ui.swt.composites.TextEditorComposite;
import org.eclipse.birt.chart.ui.swt.wizard.ChartWizardContext;
import org.eclipse.birt.chart.ui.swt.wizard.format.popup.AbstractScaleSheet;

/**
 *
 */

public class DialScaleSheet extends AbstractScaleSheet
{

	private DialSeries series;

	public DialScaleSheet( String title, ChartWizardContext context,
			DialSeries series )
	{
		super( title, context );
		this.series = series;
	}

	protected Scale getScale( )
	{
		return series.getDial( ).getScale( );
	}

	protected int getValueType( )
	{
		return TextEditorComposite.TYPE_NUMBERIC;
	}

}

/*******************************************************************************
 * Copyright (c) 2006 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.chart.ui.swt.wizard.format.popup.series;

import org.eclipse.birt.chart.model.component.Scale;
import org.eclipse.birt.chart.model.type.DialSeries;
import org.eclipse.birt.chart.ui.swt.composites.TextEditorComposite;
import org.eclipse.birt.chart.ui.swt.wizard.ChartWizardContext;
import org.eclipse.birt.chart.ui.swt.wizard.format.popup.AbstractScaleSheet;

/**
 *
 */

public class DialScaleSheet extends AbstractScaleSheet
{

	private DialSeries series;

	public DialScaleSheet( String title, ChartWizardContext context,
			DialSeries series )
	{
		super( title, context );
		this.series = series;
	}

	protected Scale getScale( )
	{
		return series.getDial( ).getScale( );
	}

	protected int getValueType( )
	{
		return TextEditorComposite.TYPE_NUMBERIC;
	}

	protected void setState( )
	{
		super.setState( );
		// Hide invalid attributes.
		btnShowOutside.setVisible( false );
	}

}

Remove UI of ShowOutside for Dial scale


package com.codenvy.ide.ext.datasource.client.sqllauncher;

import com.codenvy.ide.api.editor.EditorPartPresenter;
import com.codenvy.ide.api.editor.EditorProvider;
import com.codenvy.ide.api.notification.NotificationManager;
import com.codenvy.ide.api.preferences.PreferencesManager;
import com.codenvy.ide.dto.DtoFactory;
import com.codenvy.ide.ext.datasource.client.DatasourceClientService;
import com.codenvy.ide.ext.datasource.client.DatasourceManager;
import com.codenvy.ide.ext.datasource.client.sqleditor.SqlEditorProvider;
import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;

public class SqlLauncherEditorProvider implements EditorProvider {

    private final NotificationManager   notificationManager;

    private final SqlEditorProvider     sqlEditorProvider;

    private SqlRequestLauncherConstants constants;

    private PreferencesManager          preferencesManager;

    private DatasourceManager           datasourceManager;

    private EventBus                    eventBus;

    private DatasourceClientService     service;

    private DtoFactory                  dtoFactory;

    private SqlRequestLauncherFactory   sqlRequestLauncherFactory;

    @Inject
    public SqlLauncherEditorProvider(final NotificationManager notificationManager,
                                     final SqlEditorProvider sqlEditorProvider,
                                     final SqlRequestLauncherConstants constants,
                                     final PreferencesManager preferencesManager,
                                     final DatasourceManager datasourceManager,
                                     final EventBus eventBus,
                                     final DatasourceClientService service,
                                     final DtoFactory dtoFactory,
                                     final SqlRequestLauncherFactory sqlRequestLauncherFactory) {
        this.notificationManager = notificationManager;
        this.sqlEditorProvider = sqlEditorProvider;
        this.constants = constants;
        this.preferencesManager = preferencesManager;
        this.datasourceManager = datasourceManager;
        this.eventBus = eventBus;
        this.service = service;
        this.dtoFactory = dtoFactory;
        this.sqlRequestLauncherFactory = sqlRequestLauncherFactory;
    }

    @Override
    public EditorPartPresenter getEditor() {
        return new SqlRequestLauncherAdapter(sqlRequestLauncherFactory.createSqlRequestLauncherView(),
                                             constants,
                                             preferencesManager,
                                             sqlEditorProvider,
                                             service,
                                             notificationManager,
                                             datasourceManager,
                                             eventBus,
                                             dtoFactory);

    }
}

package com.codenvy.ide.ext.datasource.client.sqllauncher;

import com.codenvy.ide.api.editor.EditorPartPresenter;
import com.codenvy.ide.api.editor.EditorProvider;
import com.codenvy.ide.util.loging.Log;
import com.google.inject.Inject;

public class SqlLauncherEditorProvider implements EditorProvider {

    private SqlRequestLauncherFactory sqlRequestLauncherFactory;

    @Inject
    public SqlLauncherEditorProvider(final SqlRequestLauncherFactory sqlRequestLauncherFactory) {
        this.sqlRequestLauncherFactory = sqlRequestLauncherFactory;
    }

    @Override
    public EditorPartPresenter getEditor() {
        Log.info(SqlLauncherEditorProvider.class, "New instance of SQL launcher editor requested.");
        return sqlRequestLauncherFactory.createSqlRequestLauncherPresenter();
    }
}

Simplify the SQL launcher editor provider


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

import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;

@Command(scope = "cluster", name = "group-create", description = "Create a cluster group.")
public class GroupCreateCommand extends GroupSupport {

    @Argument(index = 0, name = "group", description = "The cluster group name.", required = false, multiValued = false)
    String group;

    @Override
    protected Object doExecute() throws Exception {
        return groupManager.createGroup(group);
    }

}

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

import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;

@Command(scope = "cluster", name = "group-create", description = "Create a cluster group.")
public class GroupCreateCommand extends GroupSupport {

    @Argument(index = 0, name = "group", description = "The cluster group name.", required = true, multiValued = false)
    String group;

    @Override
    protected Object doExecute() throws Exception {
        return groupManager.createGroup(group);
    }

}

Set group argument as required in cluster:group-create command


package org.techern.infinitewater.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

/**
 * A {@link Block} for infinitely spreading water
 *
 * @since 1.0.0
 */
public class BlockInfinitelySpreadingWater extends Block {

    /**
     * Creates a new {@link BlockInfinitelySpreadingWater}
     *
     * @since 1.0.0
     */
    public BlockInfinitelySpreadingWater() {
        super(Material.WATER);

        this.setUnlocalizedName("infinitely_spreading_water");
        this.setRegistryName("infinitely_spreading_water");
        this.setBlockUnbreakable();
    }
}

package org.techern.infinitewater.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;

/**
 * A {@link Block} for infinitely spreading water
 *
 * @since 1.0.0
 */
public class BlockInfinitelySpreadingWater extends Block {

    /**
     * Creates a new {@link BlockInfinitelySpreadingWater}
     *
     * @since 1.0.0
     */
    public BlockInfinitelySpreadingWater() {
        super(Material.WATER);

        this.setCreativeTab(CreativeTabs.MISC);
        this.setUnlocalizedName("infinitely_spreading_water");
        this.setRegistryName("infinitely_spreading_water");
        this.setBlockUnbreakable();
    }
}

Add to Misc creative tab


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

package com.yahoo.prelude.fastsearch;

import com.yahoo.data.access.Inspector;
import com.yahoo.data.access.Type;
import com.yahoo.prelude.hitfield.XMLString;
import com.yahoo.search.result.PositionsData;

/**
 * Class converting data (historically XML-encoded) from a document summary field.
 * This has only been used to represent geographical positions.
 * @author Steinar Knutsen
 */
public class XMLField extends DocsumField {

    public XMLField(String name) {
        super(name);
    }

    private Object convert(String value) {
        return new XMLString(value);
    }

    @Override
    public String toString() {
        return "field " + getName() + " type XMLString";
    }

    @Override
    public Object convert(Inspector value) {
        /* In Vespa 6 the backend will send an XML-formatted string to represent
         * positions data.  This will change in next version to sending an object
         * or an array of objects instead, suitable for the PositionsData class.
         */
        if (value.type() == Type.OBJECT || value.type() == Type.ARRAY) {
            return new PositionsData(value);
        }
        return convert(value.asString(""));
    }

}

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

package com.yahoo.prelude.fastsearch;

import com.yahoo.data.access.Inspector;
import com.yahoo.data.access.Type;
import com.yahoo.prelude.hitfield.XMLString;
import com.yahoo.search.result.PositionsData;

/**
 * Class converting data (historically XML-encoded) from a document summary field.
 * This has only been used to represent geographical positions.
 * @author Steinar Knutsen
 */
public class XMLField extends DocsumField {

    public XMLField(String name) {
        super(name);
    }

    private Object convert(String value) {
        return new XMLString(value);
    }

    @Override
    public String toString() {
        return "field " + getName() + " type XMLString";
    }

    @Override
    public Object convert(Inspector value) {
        if (value.type() == Type.OBJECT || value.type() == Type.ARRAY) {
            return new PositionsData(value);
        }
        return convert(value.asString(""));
    }

}

Remove comment looking forward to Vespa 6.


// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container.component;

/**
 * A {@link BindingPattern} which is implicitly constructed by the model, e.g for built-in handlers and filter chains.
 *
 * @author bjorncs
 */
public class SystemBindingPattern extends BindingPattern {

    private SystemBindingPattern(String scheme, String host, String port, String path) { super(scheme, host, port, path); }
    private SystemBindingPattern(String binding) { super(binding); }

    public static SystemBindingPattern fromHttpPath(String path) { return new SystemBindingPattern("http", "*", null, path);}
    public static SystemBindingPattern fromPattern(String binding) { return new SystemBindingPattern(binding);}

    @Override
    public String toString() {
        return "SystemBindingPattern{" +
                "scheme='" + scheme() + '\'' +
                ", host='" + host() + '\'' +
                ", port='" + port().orElse(null) + '\'' +
                ", path='" + path() + '\'' +
                '}';
    }
}

// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container.component;

/**
 * A {@link BindingPattern} which is implicitly constructed by the model, e.g for built-in handlers and filter chains.
 *
 * @author bjorncs
 */
public class SystemBindingPattern extends BindingPattern {

    private SystemBindingPattern(String scheme, String host, String port, String path) { super(scheme, host, port, path); }
    private SystemBindingPattern(String binding) { super(binding); }

    public static SystemBindingPattern fromHttpPath(String path) { return new SystemBindingPattern("http", "*", null, path);}
    public static SystemBindingPattern fromPattern(String binding) { return new SystemBindingPattern(binding);}
    public static SystemBindingPattern fromPortAndPath(String port, String path) { return new SystemBindingPattern("http", "*", port, path); }

    @Override
    public String toString() {
        return "SystemBindingPattern{" +
                "scheme='" + scheme() + '\'' +
                ", host='" + host() + '\'' +
                ", port='" + port().orElse(null) + '\'' +
                ", path='" + path() + '\'' +
                '}';
    }
}

Add static builder taking port and path


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

import org.apache.commons.vfs2.provider.FileNameParser;
import org.apache.commons.vfs2.provider.URLFileNameParser;

/**
 * Implementation for sftp. set default port to 22.
 */
public class SftpFileNameParser extends URLFileNameParser
{
    private static final SftpFileNameParser INSTANCE = new SftpFileNameParser();

    public SftpFileNameParser()
    {
        super(22);
    }

    public static FileNameParser getInstance()
    {
        return INSTANCE;
    }
}

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

import org.apache.commons.vfs2.provider.FileNameParser;
import org.apache.commons.vfs2.provider.URLFileNameParser;

/**
 * Implementation for sftp. set default port to 22.
 */
public class SftpFileNameParser extends URLFileNameParser
{
    private static final int DEFAULT_PORT = 22;

    private static final SftpFileNameParser INSTANCE = new SftpFileNameParser();

    public SftpFileNameParser()
    {
        super(DEFAULT_PORT);
    }

    public static FileNameParser getInstance()
    {
        return INSTANCE;
    }
}

Refactor magic port number into constant.


/*
 * 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.
 */
@Version("3.1.0")
package org.apache.jackrabbit.oak.spi.mount;

import org.osgi.annotation.versioning.Version;

/*
 * 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.
 */
@Version("3.2.0")
package org.apache.jackrabbit.oak.spi.mount;

import org.osgi.annotation.versioning.Version;

Make the MountInfo constructor public


/*
 * Copyright 2014-2021 Real Logic Limited.
 *
 * 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 io.aeron.log;

import io.aeron.test.Tests;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

/**
 * JUnit extension to start and reset the CollectingEventLogReaderAgent.
 */
public class EventLogExtension implements BeforeEachCallback, AfterEachCallback
{
    /**
     * {@inheritDoc}
     */
    public void beforeEach(final ExtensionContext context)
    {
        final String className = context.getTestClass().map(Class::getSimpleName).orElse("<UNKNOWN>");
        final String methodName = context.getTestClass().map(Class::getSimpleName).orElse(context.getDisplayName());
        Tests.startLogCollecting("TEST: " + className + "." + methodName);
    }

    /**
     * {@inheritDoc}
     */
    public void afterEach(final ExtensionContext context)
    {
        Tests.resetLogCollecting();
    }
}

/*
 * Copyright 2014-2021 Real Logic Limited.
 *
 * 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 io.aeron.log;

import io.aeron.test.Tests;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

import java.lang.reflect.Method;

/**
 * JUnit extension to start and reset the CollectingEventLogReaderAgent.
 */
public class EventLogExtension implements BeforeEachCallback, AfterEachCallback
{
    /**
     * {@inheritDoc}
     */
    public void beforeEach(final ExtensionContext context)
    {
        final String className = context.getTestClass().map(Class::getSimpleName).orElse("<UNKNOWN>");
        final String methodName = context.getTestMethod().map(Method::getName).orElse(context.getDisplayName());
        Tests.startLogCollecting("TEST: " + className + "." + methodName);
    }

    /**
     * {@inheritDoc}
     */
    public void afterEach(final ExtensionContext context)
    {
        Tests.resetLogCollecting();
    }
}

Fix name recorded in test event log.


package io.fluxcapacitor.javaclient.common;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.fluxcapacitor.common.MessageType;
import io.fluxcapacitor.common.api.Metadata;
import lombok.AllArgsConstructor;
import lombok.Value;
import lombok.experimental.Wither;

@Value
@AllArgsConstructor
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
public class Message {
    public static IdentityProvider identityProvider = new UuidFactory();

    @Wither
    Object payload;
    Metadata metadata;
    MessageType messageType;
    String messageId;

    public Message(Object payload, MessageType messageType) {
        this(payload, Metadata.empty(), messageType, identityProvider.nextId());
    }

    public Message(Object payload, Metadata metadata, MessageType messageType) {
        this(payload, metadata, messageType, identityProvider.nextId());
    }

    @SuppressWarnings("unchecked")
    public <R> R getPayload() {
        return (R) payload;
    }
}

package io.fluxcapacitor.javaclient.common;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.fluxcapacitor.common.MessageType;
import io.fluxcapacitor.common.api.Metadata;
import lombok.AllArgsConstructor;
import lombok.Value;
import lombok.experimental.Wither;

@Value
@AllArgsConstructor
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
public class Message {
    public static IdentityProvider identityProvider = new UuidFactory();

    @Wither
    @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
    Object payload;
    Metadata metadata;
    MessageType messageType;
    String messageId;

    public Message(Object payload, MessageType messageType) {
        this(payload, Metadata.empty(), messageType, identityProvider.nextId());
    }

    public Message(Object payload, Metadata metadata, MessageType messageType) {
        this(payload, metadata, messageType, identityProvider.nextId());
    }

    @SuppressWarnings("unchecked")
    public <R> R getPayload() {
        return (R) payload;
    }
}

Add Jackson type information to message payload


package org.spoofax.modelware.emf;

/**
 * @author Oskar van Rest
 */
import java.util.ArrayList;
import java.util.Collection;

public class LanguageRegistry {

	private static LanguageRegistry instance = new LanguageRegistry();

	private Collection<Language> languages = new ArrayList<Language>();

	private LanguageRegistry() {
	}

	public static LanguageRegistry getInstance() {
		return instance;
	}

	public void add(Language language) {
		languages.add(language);
	}

	public Language get(String fileExtension) {
		for (Language language : languages) {
			if (language.getTextFileExtension().equals(fileExtension) || language.getDiagramFileExtension().equals(fileExtension)) {
				return language;
			}
		}

		// fallback: some user may choose a file extension like .fml.diagram, in which case the language can be obtained using extensions .fml.diagram and .diagram (the actual file extension).
		for (Language language : languages) {
			if (language.getTextFileExtension().endsWith(fileExtension) || language.getDiagramFileExtension().endsWith(fileExtension)) {
				return language;
			}
		}
		return null;
	}
}

package org.spoofax.modelware.emf;

/**
 * @author Oskar van Rest
 */
import java.util.ArrayList;
import java.util.Collection;

public class LanguageRegistry {

	private static LanguageRegistry instance = new LanguageRegistry();

	private Collection<Language> languages = new ArrayList<Language>();

	private LanguageRegistry() {
	}

	public static LanguageRegistry getInstance() {
		return instance;
	}

	public void add(Language language) {
		languages.add(language);
	}

	public Language get(String fileExtension) {
		for (Language language : languages) {
			if (language.getTextFileExtension().equals(fileExtension) || language.getDiagramFileExtension().equals(fileExtension)) {
				return language;
			}
		}
		return null;
	}
}

Revert "support for file extensions with dots (.) in them"


package com.yatatsu.autobundle;

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

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.SOURCE)
public @interface AutoBundleField {
    boolean required() default true;
    String key() default "";
    Class<? extends AutoBundleConverter> converter() default DefaultAutoBundleConverter.class;
}

package com.yatatsu.autobundle;

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

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.CLASS)
public @interface AutoBundleField {
    boolean required() default true;
    String key() default "";
    Class<? extends AutoBundleConverter> converter() default DefaultAutoBundleConverter.class;
}

Change retention policy of annotation


package de.idrinth.waraddonclient.model;

import java.util.ArrayList;
import java.util.HashMap;

public class CaseInsensitiveHashMap<T> extends HashMap<String, T> {

    private ArrayList<String> keys = new ArrayList<>();

    @Override
    public T put(String key, T value) {
        for (String k : keys) {
            if (k.equalsIgnoreCase(key)) {
                return super.put(k, value);
            }
        }
        keys.add(key);
        return super.put(key, value);
    }
    public T get(String key) {
        for (String k : keys) {
            if (k.equalsIgnoreCase(key)) {
                return super.get(k);
            }
        }
        return super.get(key);
    }
    public boolean containsKey(String key) {
        for (String k : keys) {
            if (k.equalsIgnoreCase(key)) {
                return true;
            }
        }
        return false;
    }
}

package de.idrinth.waraddonclient.model;

import java.util.ArrayList;
import java.util.HashMap;

public class CaseInsensitiveHashMap<T> extends HashMap<String, T> {

    private final ArrayList<String> keys = new ArrayList<>();

    @Override
    public T put(String key, T value) {
        for (String k : keys) {
            if (k.equalsIgnoreCase(key)) {
                return super.put(k, value);
            }
        }
        keys.add(key);
        return super.put(key, value);
    }
    public T get(String key) {
        for (String k : keys) {
            if (k.equalsIgnoreCase(key)) {
                return super.get(k);
            }
        }
        return super.get(key);
    }
    public boolean containsKey(String key) {
        for (String k : keys) {
            if (k.equalsIgnoreCase(key)) {
                return true;
            }
        }
        return false;
    }
}

Add final modifier to field


package org.synyx.urlaubsverwaltung.application;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties("uv.application")
public class ApplicationProperties {

    /**
     * Checks remind date about waiting applications by default every day at 07:00 am
     */
    private String reminderNotificationCron = "0 0 7 * * *";

    public String getReminderNotificationCron() {
        return reminderNotificationCron;
    }

    public void setReminderNotificationCron(String reminderNotificationCron) {
        this.reminderNotificationCron = reminderNotificationCron;
    }
}

package org.synyx.urlaubsverwaltung.application;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotEmpty;

@Component
@ConfigurationProperties("uv.application")
@Validated
public class ApplicationProperties {

    /**
     * Checks remind date about waiting applications by default every day at 07:00 am
     */
    @NotEmpty
    private String reminderNotificationCron = "0 0 7 * * *";

    public String getReminderNotificationCron() {
        return reminderNotificationCron;
    }

    public void setReminderNotificationCron(String reminderNotificationCron) {
        this.reminderNotificationCron = reminderNotificationCron;
    }
}

Add bean validation for uv.application.reminderNotificationCron


package org.gbif.registry.cli.doiupdater;

import org.gbif.common.messaging.MessageListener;
import org.gbif.registry.cli.common.CommonBuilder;
import org.gbif.registry.persistence.guice.RegistryMyBatisModule;
import org.gbif.registry.persistence.mapper.DoiMapper;

import com.google.common.util.concurrent.AbstractIdleService;
import com.google.inject.Guice;
import com.google.inject.Injector;

/**
 * A CLI service that starts and stops a listener of DoiUpdate messages. Must always be only one thread - multiple
 * will introduce a possible race (e.g. delete before create).
 */
public class DoiUpdaterService extends AbstractIdleService {

  private final DoiUpdaterConfiguration config;

  private MessageListener listener;

  public DoiUpdaterService(DoiUpdaterConfiguration config) {
    this.config = config;
  }

  @Override
  protected void startUp() throws Exception {
    config.ganglia.start();

    Injector inj = Guice.createInjector(
      new RegistryMyBatisModule(config.registry.toRegistryProperties()));

    listener = new MessageListener(config.messaging.getConnectionParameters());
    listener.listen(config.queueName, 1,
      new DoiUpdateListener(CommonBuilder.createRestJsonApiDataCiteService(config.datacite), inj.getInstance(DoiMapper.class), config.timeToRetryInMs));
  }

  @Override
  protected void shutDown() throws Exception {
    if (listener != null) {
      listener.close();
    }
  }
}

package org.gbif.registry.cli.doiupdater;

import org.gbif.common.messaging.MessageListener;
import org.gbif.registry.cli.common.CommonBuilder;
import org.gbif.registry.persistence.guice.RegistryMyBatisModule;
import org.gbif.registry.persistence.mapper.DoiMapper;

import com.google.common.util.concurrent.AbstractIdleService;
import com.google.inject.Guice;
import com.google.inject.Injector;

/**
 * A CLI service that starts and stops a listener of DoiUpdate messages. Must always be only one thread - multiple
 * will introduce a possible race (e.g. delete before create).
 */
public class DoiUpdaterService extends AbstractIdleService {

  private final DoiUpdaterConfiguration config;

  private MessageListener listener;

  public DoiUpdaterService(DoiUpdaterConfiguration config) {
    this.config = config;
  }

  @Override
  protected void startUp() throws Exception {
    config.ganglia.start();

    Injector inj = Guice.createInjector(
      new RegistryMyBatisModule(config.registry.toRegistryProperties()));

    listener = new MessageListener(config.messaging.getConnectionParameters(), 1);
    listener.listen(config.queueName, 1,
      new DoiUpdateListener(CommonBuilder.createRestJsonApiDataCiteService(config.datacite), inj.getInstance(DoiMapper.class), config.timeToRetryInMs));
  }

  @Override
  protected void shutDown() throws Exception {
    if (listener != null) {
      listener.close();
    }
  }
}

Set message prefetch to 1 for DOI updater.


package info.u_team.u_team_test.init;

import info.u_team.u_team_test.entity.TestLiving;
import net.minecraft.world.entity.SpawnPlacements;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;

public class TestSpawnPlacementRegistries {

	private static void setup(FMLCommonSetupEvent event) {
		event.enqueueWork(() -> {
			SpawnPlacements.register(TestEntityTypes.TEST_LIVING.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, TestLiving::checkTestLivingSpawnRules);
		});
	}

	public static void registerMod(IEventBus bus) {
		bus.addListener(TestSpawnPlacementRegistries::setup);
	}

}

package info.u_team.u_team_test.init;

import info.u_team.u_team_test.entity.TestLiving;
import net.minecraft.world.entity.SpawnPlacements;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraftforge.event.entity.SpawnPlacementRegisterEvent;
import net.minecraftforge.event.entity.SpawnPlacementRegisterEvent.Operation;
import net.minecraftforge.eventbus.api.IEventBus;

public class TestSpawnPlacementRegistries {

	private static void register(SpawnPlacementRegisterEvent event) {
		event.register(TestEntityTypes.TEST_LIVING.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, TestLiving::checkTestLivingSpawnRules, Operation.OR);
	}

	public static void registerMod(IEventBus bus) {
		bus.addListener(TestSpawnPlacementRegistries::register);
	}

}

Use event in test mod for spawn placement registry


package com.link_intersystems.gitdirstat.domain;

import java.io.IOException;
import java.util.Collection;

public class PathDeletionIndexFilter implements IndexFilter {

	private Collection<String> pathsToDelete;

	public PathDeletionIndexFilter(Collection<String> pathsToDelete) {
		this.pathsToDelete = pathsToDelete;
	}

	@Override
	public void apply(CommitUpdate commitUpdate) throws IOException {
		TreeUpdate treeUpdate = commitUpdate.getTreeUpdate();
		while (treeUpdate.hasNext()) {
			TreeFileUpdate fileUpdate = treeUpdate.next();
			String path = fileUpdate.getPath();
			if (pathsToDelete.contains(path)) {
				fileUpdate.delete();
			}
		}
	}
}

package com.link_intersystems.gitdirstat.domain;

import java.io.IOException;
import java.util.Collection;
import java.util.HashSet;

public class PathDeletionIndexFilter implements IndexFilter {

	private Collection<String> pathsToDelete;

	public PathDeletionIndexFilter(Collection<String> pathsToDelete) {
		this.pathsToDelete = pathsToDelete;
	}

	@Override
	public void apply(CommitUpdate commitUpdate) throws IOException {
		TreeUpdate treeUpdate = commitUpdate.getTreeUpdate();
		Collection<String> actualPathsToDelete = new HashSet<String>(
				pathsToDelete);
		while (treeUpdate.hasNext()) {
			TreeFileUpdate fileUpdate = treeUpdate.next();
			String path = fileUpdate.getPath();
			if (actualPathsToDelete.remove(path)) {
				fileUpdate.delete();
			}
			if (actualPathsToDelete.isEmpty()) {
				break;
			}
		}
	}
}

Stop iterating tree if all index filter paths are deleted


package com.github.games647.fastlogin.bukkit;

import java.util.List;

import me.clip.placeholderapi.PlaceholderAPI;
import me.clip.placeholderapi.PlaceholderHook;

import org.bukkit.entity.Player;
import org.bukkit.metadata.MetadataValue;

public class PremiumPlaceholder extends PlaceholderHook {

    private final FastLoginBukkit plugin;

    public PremiumPlaceholder(FastLoginBukkit plugin) {
        this.plugin = plugin;
    }

    @Override
    public String onPlaceholderRequest(Player player, String variable) {
        if (player != null && "fastlogin_status".contains(variable)) {
            List<MetadataValue> metadata = player.getMetadata(plugin.getName());
            if (metadata == null) {
                return "unknown";
            }

            if (metadata.isEmpty()) {
                return "cracked";
            } else {
                return "premium";
            }
        }

        return "";
    }

    public static void register(FastLoginBukkit plugin) {
        PlaceholderAPI.registerPlaceholderHook(plugin, new PremiumPlaceholder(plugin));
    }
}

package com.github.games647.fastlogin.bukkit;

import java.util.stream.Collectors;

import me.clip.placeholderapi.PlaceholderAPI;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;

import org.bukkit.entity.Player;

public class PremiumPlaceholder extends PlaceholderExpansion {

    private static final String PLACEHOLDER_VARIABLE = "fastlogin_status";

    private final FastLoginBukkit plugin;

    public PremiumPlaceholder(FastLoginBukkit plugin) {
        this.plugin = plugin;
    }

    public static void register(FastLoginBukkit plugin) {
        PremiumPlaceholder placeholderHook = new PremiumPlaceholder(plugin);
        PlaceholderAPI.registerPlaceholderHook(PLACEHOLDER_VARIABLE, placeholderHook);
    }

    @Override
    public String onPlaceholderRequest(Player player, String variable) {
        if (player != null && PLACEHOLDER_VARIABLE.equals(variable)) {
            return plugin.getStatus(player.getUniqueId()).name();
        }

        return "";
    }

    @Override
    public String getIdentifier() {
        return PLACEHOLDER_VARIABLE;
    }

    @Override
    public String getPlugin() {
        return plugin.getName();
    }

    @Override
    public String getAuthor() {
        return plugin.getDescription().getAuthors().stream().collect(Collectors.joining(", "));
    }

    @Override
    public String getVersion() {
        return plugin.getName();
    }
}

Migrate to PlaceholderExpansion from PlaceholderAPI


package se.jiderhamn.classloader.leak.prevention.cleanup;

import java.security.NoSuchAlgorithmException;
import java.security.Provider;

/**
 * Test that the leak caused by {@link javax.crypto.JceSecurity} is cleared.
 * Thanks to Paul Kiman for the report.
 * @author Mattias Jiderhamn
 */
public class JceSecurityCleanUpTest extends ClassLoaderPreMortemCleanUpTestBase<JceSecurityCleanUp> {
  @Override
  protected void triggerLeak() throws Exception {
    try {
      // Alternative classes: KeyAgreement, KeyGenerator, ExemptionMechanism
      MyProvider myProvider = new MyProvider("foo", 1.0, "bar");
      javax.crypto.Mac.getInstance("baz", myProvider);
    }
    catch (SecurityException e) { // CS:IGNORE
    }
    catch (NoSuchAlgorithmException e) {
      // Custom providers seem to work different in Java 11, this still triggers the leak, even if we get this exception
    }
  }

  /** Custom {@link Provider}, to be put in {@link javax.crypto.JceSecurity} caches */
  public static class MyProvider extends Provider {
    public MyProvider(String name, double version, String info) {
      super(name, version, info);
    }

    @Override
    public synchronized Service getService(String type, String algorithm) {
      return new Service(this, "type", "algorithm", "className", null, null);
    }
  }
}

package se.jiderhamn.classloader.leak.prevention.cleanup;

import java.security.NoSuchAlgorithmException;
import java.security.Provider;

/**
 * Test that the leak caused by {@link javax.crypto.JceSecurity} is cleared.
 * Thanks to Paul Kiman for the report.
 * @author Mattias Jiderhamn
 */
public class JceSecurityCleanUpTest extends ClassLoaderPreMortemCleanUpTestBase<JceSecurityCleanUp> {
  @Override
  protected void triggerLeak() throws Exception {
    try {
      // Alternative classes: KeyAgreement, KeyGenerator, ExemptionMechanism
      MyProvider myProvider = new MyProvider("foo", 1.0, "bar");
      javax.crypto.Mac.getInstance("baz", myProvider);
    }
    catch (SecurityException | NoSuchAlgorithmException e) { // CS:IGNORE
      // Leak is triggered despite an exception being thrown
    }
  }

  /** Custom {@link Provider}, to be put in {@link javax.crypto.JceSecurity} caches */
  public static class MyProvider extends Provider {
    public MyProvider(String name, double version, String info) {
      super(name, version, info);
    }

    @Override
    public synchronized Service getService(String type, String algorithm) {
      return new Service(this, "type", "algorithm", "className", null, null);
    }
  }
}

Move exceptions in one catch expression


package org.wildfly.swarm.swagger.runtime;

import org.jboss.dmr.ModelNode;
import org.jboss.shrinkwrap.api.Archive;
import org.wildfly.swarm.container.JARArchive;
import org.wildfly.swarm.container.runtime.AbstractServerConfiguration;
import org.wildfly.swarm.container.runtime.Configuration;
import org.wildfly.swarm.jaxrs.JAXRSArchive;
import org.wildfly.swarm.swagger.SwaggerFraction;

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

/**
 * @author Lance Ball
 */
@Configuration
public class SwaggerConfiguration extends AbstractServerConfiguration<SwaggerFraction> {

    public SwaggerConfiguration() {
        super(SwaggerFraction.class);
    }

    @Override
    public SwaggerFraction defaultFraction() {
        return new SwaggerFraction();
    }

    @Override
    public void prepareArchive(Archive<?> a) {
        JAXRSArchive deployment = a.as(JAXRSArchive.class);
        JARArchive archive = a.as(JARArchive.class);
        try {
            archive.addModule("io.swagger");
            deployment.addResource(io.swagger.jaxrs.listing.ApiListingResource.class);
            deployment.addResource(io.swagger.jaxrs.listing.SwaggerSerializers.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public List<ModelNode> getList(SwaggerFraction fraction) throws Exception {
        return Collections.emptyList();
    }
}

package org.wildfly.swarm.swagger.runtime;

import org.jboss.dmr.ModelNode;
import org.jboss.shrinkwrap.api.Archive;
import org.wildfly.swarm.container.JARArchive;
import org.wildfly.swarm.container.runtime.AbstractServerConfiguration;
import org.wildfly.swarm.jaxrs.JAXRSArchive;
import org.wildfly.swarm.swagger.SwaggerFraction;

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

/**
 * @author Lance Ball
 */
public class SwaggerConfiguration extends AbstractServerConfiguration<SwaggerFraction> {

    public SwaggerConfiguration() {
        super(SwaggerFraction.class);
    }

    @Override
    public SwaggerFraction defaultFraction() {
        return new SwaggerFraction();
    }

    @Override
    public void prepareArchive(Archive<?> a) {
        JAXRSArchive deployment = a.as(JAXRSArchive.class);
        JARArchive archive = a.as(JARArchive.class);
        try {
            archive.addModule("io.swagger");
            deployment.addResource(io.swagger.jaxrs.listing.ApiListingResource.class);
            deployment.addResource(io.swagger.jaxrs.listing.SwaggerSerializers.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public List<ModelNode> getList(SwaggerFraction fraction) throws Exception {
        return Collections.emptyList();
    }
}

Remove the need for @Configuration annotation. Simplify!