package org.revapi.maven;

import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;

/**
 * @author Lukas Krejci
 * @since 0.7.0
 */
@Mojo(name = "report-fork", defaultPhase = LifecyclePhase.SITE,
        requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Execute(phase = LifecyclePhase.PACKAGE)
public class ReportForkMojo {
}

package org.revapi.maven;

import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;

/**
 * @author Lukas Krejci
 * @since 0.7.0
 */
@Mojo(name = "report-fork", defaultPhase = LifecyclePhase.SITE,
        requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Execute(phase = LifecyclePhase.PACKAGE)
public class ReportForkMojo extends ReportMojo {
}

Make report-fork goal actually do something.


package com.emc.ecs.managementClient;

import java.util.List;
import java.util.NoSuchElementException;
import java.util.Optional;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;

import com.emc.ecs.managementClient.model.DataServiceReplicationGroup;
import com.emc.ecs.managementClient.model.DataServiceReplicationGroupList;
import com.emc.ecs.serviceBroker.EcsManagementClientException;
import com.emc.ecs.serviceBroker.EcsManagementResourceNotFoundException;

public class ReplicationGroupAction {

	public static List<DataServiceReplicationGroup> list(Connection connection)
			throws EcsManagementClientException {
		UriBuilder uri = connection.getUriBuilder().segment("vdc",
				"data-service", "vpools");
		Response response = connection.handleRemoteCall("get", uri, null);
		DataServiceReplicationGroupList rgList = response
				.readEntity(DataServiceReplicationGroupList.class);
		return rgList.getReplicationGroups();
	}

	public static DataServiceReplicationGroup get(Connection connection,
			String id) throws EcsManagementClientException,
					EcsManagementResourceNotFoundException {
		List<DataServiceReplicationGroup> repGroups = list(connection);
		Optional<DataServiceReplicationGroup> optionalRg = repGroups.stream()
				.filter(rg -> rg.getName().equals(id)).findFirst();
		try {
			return optionalRg.get();
		} catch (NoSuchElementException e) {
			throw new EcsManagementResourceNotFoundException(e.getMessage());
		}
	}

}

package com.emc.ecs.managementClient;

import java.util.List;
import java.util.NoSuchElementException;
import java.util.Optional;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;

import com.emc.ecs.managementClient.model.DataServiceReplicationGroup;
import com.emc.ecs.managementClient.model.DataServiceReplicationGroupList;
import com.emc.ecs.serviceBroker.EcsManagementClientException;
import com.emc.ecs.serviceBroker.EcsManagementResourceNotFoundException;

public class ReplicationGroupAction {

	public static List<DataServiceReplicationGroup> list(Connection connection)
			throws EcsManagementClientException {
		UriBuilder uri = connection.getUriBuilder().segment("vdc",
				"data-service", "vpools");
		Response response = connection.handleRemoteCall("get", uri, null);
		DataServiceReplicationGroupList rgList = response
				.readEntity(DataServiceReplicationGroupList.class);
		return rgList.getReplicationGroups();
	}

	public static DataServiceReplicationGroup get(Connection connection,
			String id) throws EcsManagementClientException,
					EcsManagementResourceNotFoundException {
		List<DataServiceReplicationGroup> repGroups = list(connection);
		Optional<DataServiceReplicationGroup> optionalRg = repGroups.stream()
				.filter(rg -> rg.getId().equals(id)).findFirst();
		try {
			return optionalRg.get();
		} catch (NoSuchElementException e) {
			throw new EcsManagementResourceNotFoundException(e.getMessage());
		}
	}

}

Return by ID in client model


package com.blabbertabber.blabbertabber;

import junit.framework.TestCase;

/**
 * Created by cunnie on 8/9/15.
 */
public class MainActivityTest extends TestCase {

    public void setUp() throws Exception {
        super.setUp();

    }

    public void tearDown() throws Exception {

    }

    public void testOnCreate() throws Exception {

    }

    public void testOnCreateOptionsMenu() throws Exception {

    }

    public void testOnOptionsItemSelected() throws Exception {

    }
}

package com.blabbertabber.blabbertabber;

import junit.framework.TestCase;

/**
 * Created by cunnie on 8/9/15.
 */
public class MainActivityTest extends TestCase {

    public void setUp() throws Exception {
        super.setUp();

    }

    public void tearDown() throws Exception {
    }

    public void testOnCreate() throws Exception {
        throw new Exception("Holy cow!!!  What went wrong here?");
    }

    public void testOnCreateOptionsMenu() throws Exception {

    }

    public void testOnOptionsItemSelected() throws Exception {

    }
}

Create new TDD unit test: test failure


/**
 *
 */
package org.mwc.cmap.core.DataTypes.TrackData;

import Debrief.Tools.Tote.WatchableList;

/**
 * @author ian.mayo
 *
 */
public interface TrackDataProvider
{
	public static interface TrackDataListener
	{
		/** find out that the primary has changed
		 *
		 * @param primary the primary track
		 */
		public void primaryUpdated(WatchableList primary);

		/** find out that the secondaries have changed
		 *
		 * @param secondaries list of secondary tracks
		 */
		public void secondariesUpdated(WatchableList[] secondaries);
	}

	/** declare that we want to be informed about changes
	 * in selected tracks
	 */
	public void addTrackDataListener(TrackDataListener listener);

	/** find out what the primary track is
	 *
	 */
	public WatchableList getPrimaryTrack();

	/** find out what the secondary track is
	 *
	 */
	public WatchableList[] getSecondaryTracks();

}

/**
 *
 */
package org.mwc.cmap.core.DataTypes.TrackData;

import Debrief.Tools.Tote.WatchableList;

/**
 * @author ian.mayo
 *
 */
public interface TrackDataProvider
{
	public static interface TrackDataListener
	{
		/** find out that the primary has changed
		 *
		 * @param primary the primary track
		 */
		public void primaryUpdated(WatchableList primary);

		/** find out that the secondaries have changed
		 *
		 * @param secondaries list of secondary tracks
		 */
		public void secondariesUpdated(WatchableList[] secondaries);
	}

	/** declare that we want to be informed about changes
	 * in selected tracks
	 */
	public void addTrackDataListener(TrackDataListener listener);

	/** forget that somebody wants to know about track changes
	 *
	 */
	public void removeTrackDataListener(TrackDataListener listener);

	/** find out what the primary track is
	 *
	 */
	public WatchableList getPrimaryTrack();

	/** find out what the secondary track is
	 *
	 */
	public WatchableList[] getSecondaryTracks();

}

Allow removal of track data


/*
 * 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.aries.blueprint.uberbundle;

import org.apache.aries.blueprint.container.BlueprintExtender;
import org.apache.aries.proxy.impl.ProxyManagerActivator;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class UberActivator implements BundleActivator
{
  private BlueprintExtender blueprintActivator = new BlueprintExtender();
  private ProxyManagerActivator proxyActivator = new ProxyManagerActivator();

  public void start(BundleContext context)
  {
    proxyActivator.start(context);
    blueprintActivator.start(context);
  }

  public void stop(BundleContext arg0)
  {
    blueprintActivator.stop(arg0);
    proxyActivator.start(arg0);
  }
}

/*
 * 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.aries.blueprint.uberbundle;

import org.apache.aries.blueprint.container.BlueprintExtender;
import org.apache.aries.proxy.impl.ProxyManagerActivator;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class UberActivator implements BundleActivator
{
  private BlueprintExtender blueprintActivator = new BlueprintExtender();
  private ProxyManagerActivator proxyActivator = new ProxyManagerActivator();

  public void start(BundleContext context)
  {
    proxyActivator.start(context);
    blueprintActivator.start(context);
  }

  public void stop(BundleContext context)
  {
    blueprintActivator.stop(context);
    proxyActivator.stop(context);
  }
}

Fix problem with the proxy activator when using the blueprint bundle


package protocolsupport.protocol.utils.types;

import java.text.MessageFormat;

import protocolsupport.utils.CollectionsUtils;
import protocolsupport.utils.CollectionsUtils.ArrayMap;

public enum GameMode {

	SURVIVAL(0), CREATIVE(1), ADVENTURE(2), SPECTATOR(3);

	private static final ArrayMap<GameMode> byId = CollectionsUtils.makeEnumMappingArrayMap(GameMode.class, GameMode::getId);

	private final int id;
	GameMode(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

	public static GameMode getById(int id) {
		GameMode gm = byId.get(id);
		if (gm == null) {
			throw new IllegalArgumentException(MessageFormat.format("Unknown gamemode network id {0}", id));
		}
		return gm;
	}

}

package protocolsupport.protocol.utils.types;

import java.text.MessageFormat;

import protocolsupport.utils.CollectionsUtils;
import protocolsupport.utils.CollectionsUtils.ArrayMap;

public enum GameMode {

	NOT_SET(-1), SURVIVAL(0), CREATIVE(1), ADVENTURE(2), SPECTATOR(3);

	private static final ArrayMap<GameMode> byId = CollectionsUtils.makeEnumMappingArrayMap(GameMode.class, GameMode::getId);

	private final int id;
	GameMode(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

	public static GameMode getById(int id) {
		GameMode gm = byId.get(id);
		if (gm == null) {
			throw new IllegalArgumentException(MessageFormat.format("Unknown gamemode network id {0}", id));
		}
		return gm;
	}

}

Support -1 gamemode (not set), while it's not valid gamemode and should be only used as starting gamemode for server internals, sometimes custom npc plugins do not set it. All supported versions support this gamemode, and no internal logic depends on it, so allowing it shouldn't bring any problems


package com.leafriend.flix;

import java.io.Console;

public class Flix {

    private Options options;

    public static void main(String[] args) {

        Console console = System.console();

        console.printf("Hello, FLiX\n");
    public Flix(Options options) {
        this.options = options;
    }

    }

}

package com.leafriend.flix;

public class Flix {

    private Options options;

    public static void main(String[] args) {

        Options options = new Options();

        new Flix(options).run();

    }

    public Flix(Options options) {
        this.options = options;
    }

    public void run() {

    }

}

Call run() for new instance


/**
 *
 */
package com.cj.votron;

import java.util.ArrayList;
import java.util.Arrays;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * @author gvamos
 *
 */
public class ElectionsActivity extends Activity {
	  private ListView electionListView ;
	  private ArrayAdapter<String> listAdapter ;

	  @Override
	  public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    Log.i(this.getClass().getName(),":onCreate");
	    setContentView(R.layout.activity_elections);

	    // Find the ListView resource.
	    electionListView = (ListView) findViewById( R.id.electionsListView );

	    // Create and populate a List of planet names.
	    String[] planets = new String[] { "London", "Paris", "Chatsworth" };
	    ArrayList<String> planetList = new ArrayList<String>();
	    planetList.addAll( Arrays.asList(planets) );

	    // Create ArrayAdapter using the planet list.
	    listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow, planetList);

	    // Add more planets. If you passed a String[] instead of a List<String>
	    // into the ArrayAdapter constructor, you must not add more items.
	    // Otherwise an exception will occur.
	    listAdapter.add( "Foo" );
	    listAdapter.add( "Bar" );
	    listAdapter.add( "Baz" );

	    // Set the ArrayAdapter as the ListView's adapter.
	    electionListView.setAdapter( listAdapter );
	  }

}

/**
 *
 */
package com.cj.votron;

import java.util.ArrayList;
import java.util.Arrays;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * @author gvamos
 *
 */
public class ElectionsActivity extends Activity {

	  private ListView electionListView ;
	  private ArrayAdapter<String> listAdapter ;
	  private Config.Elections elections;

	  @Override
	  public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    Log.i(this.getClass().getName(),":onCreate");
	    setContentView(R.layout.activity_elections);

	    elections = Config.getInstance().getElections();
	    elections.updateElections();

	    // Shave the yak.
	    electionListView = (ListView) findViewById( R.id.electionsListView );
	    listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow, (elections.getElectionsList()));
	    electionListView.setAdapter( listAdapter );
	  }
}

Refactor to use central config object


package org.keycloak.admin.client.resource;

import org.keycloak.representations.idm.MappingsRepresentation;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * @author rodrigo.sasaki@icarros.com.br
 */
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface RoleMappingResource {

    @GET
    public MappingsRepresentation getAll();

    @Path("realm")
    public RoleScopeResource realmLevel();

    @Path("applications/{appName}")
    public RoleScopeResource applicationLevel(@PathParam("appName") String appName);

}

package org.keycloak.admin.client.resource;

import org.keycloak.representations.idm.MappingsRepresentation;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * @author rodrigo.sasaki@icarros.com.br
 */
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface RoleMappingResource {

    @GET
    public MappingsRepresentation getAll();

    @Path("realm")
    public RoleScopeResource realmLevel();

    @Path("clients/{clientId}")
    public RoleScopeResource clientLevel(@PathParam("clientId") String clientId);

}

Change role mapping path in admin client to match API changes


public class View {
	private Player player;
	public View (Player p) {
		player=p;
	}

	public void update() {
		System.out.println("The current player has a health of " + player.getHealth());//TODO

	}

}

public class View {
	private Player player;
	public View (Player p) {
		player=p;
	}

	public void update() {
		System.out.println("The current player has a health of " + player.getHealth());//TODO
		System.out.println("The player has the following items");

		for (Item item : player.getInventory(null)) {
			System.out.println(item.getDescription());
		}

		System.out.println("The player is in room " + player.getCurrentRoom().getLongDescription());

	}

}

Add some text based display


import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import java.util.Arrays;
import java.util.Collection;

import static org.junit.Assert.assertEquals;

@RunWith(Parameterized.class)
public class BinaryTest {

    private String input;
    private int expectedOutput;

    @Parameters
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][]{
                {"1", 1},
                {"10", 2},
                {"11", 3},
                {"100", 4},
                {"1001", 9},
                {"11010", 26},
                {"10001101000", 1128},
                {"2", 0},
                {"5", 0},
                {"9", 0},
                {"134678", 0},
                {"abc10z", 0},
                {"011", 3}
        });
    }

    public BinaryTest(String input, int expectedOutput) {
        this.input = input;
        this.expectedOutput = expectedOutput;
    }

    @Test
    public void test() {
        Binary binary = new Binary(input);

        assertEquals(expectedOutput, binary.getDecimal());
    }
}

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import java.util.Arrays;
import java.util.Collection;

import static org.junit.Assert.assertEquals;

@RunWith(Parameterized.class)
public class BinaryTest {

    private String input;
    private int expectedOutput;

    @Parameters
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][]{
                {"1", 1},
                {"10", 2},
                {"11", 3},
                {"100", 4},
                {"1001", 9},
                {"11010", 26},
                {"10001101000", 1128},
                {"2", 0},
                {"5", 0},
                {"9", 0},
                {"134678", 0},
                {"abc10", 0},
                {"10z", 0},
                {"10a10", 0},
                {"011", 3}
        });
    }

    public BinaryTest(String input, int expectedOutput) {
        this.input = input;
        this.expectedOutput = expectedOutput;
    }

    @Test
    public void test() {
        Binary binary = new Binary(input);

        assertEquals(expectedOutput, binary.getDecimal());
    }
}

Add canonical cases to test


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

/**
 * A Message that can have a format String attached to it.
 */
public interface FormattedMessage extends Message {
    /**
     * Set the message format.
     * @param format The message format.
     */
    void setFormat(String format);

    /**
     * Return the message format.
     * @return the message format String.
     */
    String getFormat();
}

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

/**
 * A Message that can have a format String attached to it. The format string is used by the
 * Message implementation as extra information that it may use to help it to determine how
 * to format itself. For example, MapMessage accepts a format of "XML" to tell it to render
 * the Map as XML instead of its default format of {key1="value1" key2="value2"}.
 */
public interface FormattedMessage extends Message {
    /**
     * Set the message format.
     * @param format The message format.
     */
    void setFormat(String format);

    /**
     * Return the message format.
     * @return the message format String.
     */
    String getFormat();
}

Add more details to the javadoc


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

package org.gradle.tooling.exceptions;

/**
 * Thrown when the {@link org.gradle.tooling.PhasedBuildActionExecuter.Builder} has been configured
 * with more than one {@link org.gradle.tooling.BuildAction} per phase.
 */
public class MultipleBuildActionsException extends RuntimeException {

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

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

package org.gradle.tooling.exceptions;

import org.gradle.api.Incubating;

/**
 * Thrown when the {@link org.gradle.tooling.PhasedBuildActionExecuter.Builder} has been configured
 * with more than one {@link org.gradle.tooling.BuildAction} per phase.
 *
 * @since 4.7
 */
@Incubating
public class MultipleBuildActionsException extends RuntimeException {

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

Add @Incubating and @since annotations


package net.somethingdreadful.MAL;

import android.content.res.Configuration;

import org.holoeverywhere.ThemeManager;
import org.holoeverywhere.app.Application;

import java.util.Locale;

public class Theme extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        PrefManager Prefs = new PrefManager(getApplicationContext());
        Locale locale = Prefs.getLocale();

        // apply it until the app remains cached
        Locale.setDefault(locale);
        Configuration newConfig = new Configuration();
        newConfig.locale = locale;
        getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics());
    }

    static {
        ThemeManager.setDefaultTheme(ThemeManager.MIXED);
    }
}

package net.somethingdreadful.MAL;

import android.content.res.Configuration;

import org.holoeverywhere.ThemeManager;
import org.holoeverywhere.app.Application;

import java.util.Locale;

public class Theme extends Application {

    Locale locale;

    @Override
    public void onCreate() {
        super.onCreate();
        PrefManager Prefs = new PrefManager(getApplicationContext());
        locale = Prefs.getLocale();

        // apply it until the app remains cached
        Locale.setDefault(locale);
        Configuration newConfig = new Configuration();
        newConfig.locale = locale;
        getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics());
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        // apply it until the app remains cached
        Locale.setDefault(locale);
        Configuration Config = new Configuration();
        Config.locale = locale;
        getBaseContext().getResources().updateConfiguration(Config, getBaseContext().getResources().getDisplayMetrics());
    }

    static {
        ThemeManager.setDefaultTheme(ThemeManager.MIXED);
    }
}

Fix language when the device has been rotated (Language)


package uk.ac.ebi.quickgo.annotation.service.comm.rest.ontology.model;

import uk.ac.ebi.quickgo.rest.comm.ResponseType;

import java.util.List;

/**
 * Represents part of the model corresponding to the response available from the resource:
 *
 *

 *
/go/terms/{term}

 *

 *
 * This model captures the parts reached by the JSON path expression, "$.results.name".
 *
 * Created 07/04/17
 * @author Edd
 */
public class BasicOntology implements ResponseType {
    private List<Result> results;

    public BasicOntology() {}

    public List<Result> getResults() {
        return results;
    }

    public void setResults(List<Result> results) {
        this.results = results;
    }

    @Override public String toString() {
        return "ResponseType{" +
                "results=" + results +
                '}';
    }

    public static class Result {
        private String id;
        private String name;

        public Result() {}

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

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

        @Override public String toString() {
            return "Result{" +
                    "id='" + id + '\'' +
                    ", name='" + name + '\'' +
                    '}';
        }
    }
}

package uk.ac.ebi.quickgo.annotation.service.comm.rest.ontology.model;

import uk.ac.ebi.quickgo.rest.comm.ResponseType;

import java.util.List;

/**
 * Represents part of the model corresponding to the response available from the resource:
 *
 *

 *
/go/terms/{term}

 *

 *
 * or
 *
 *

 *
/eco/terms/{term}

 *

 *
 * This model captures the parts reached by the JSON path expression, "$.results.name".
 *
 * Created 07/04/17
 * @author Edd
 */
public class BasicOntology implements ResponseType {
    private List<Result> results;

    public BasicOntology() {}

    public List<Result> getResults() {
        return results;
    }

    public void setResults(List<Result> results) {
        this.results = results;
    }

    @Override public String toString() {
        return "ResponseType{" +
                "results=" + results +
                '}';
    }

    public static class Result {
        private String id;
        private String name;

        public Result() {}

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

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

        @Override public String toString() {
            return "Result{" +
                    "id='" + id + '\'' +
                    ", name='" + name + '\'' +
                    '}';
        }
    }
}

Update the javadoc to show that the basic ontology information can come from go terms OR eco terms


package de.qaware.oss.cloud.service.billing.integration;

import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.logging.Logger;

@Singleton
@Startup
public class AutostartBean {

    @Inject
    private Logger logger;

    @PersistenceContext
    private EntityManager entityManager;

    @PostConstruct
    void autostart() {
        logger.info("Autostarting Billing service entity manager.");
    }
}

package de.qaware.oss.cloud.service.billing.integration;

import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.logging.Logger;

@Singleton
@Startup
public class AutostartBean {

    @Inject
    private Logger logger;

    @PersistenceContext
    private EntityManager entityManager;

    @PostConstruct
    void autostart() {
        logger.info("Autostarting Billing service entity manager.");
        entityManager.clear();
    }
}

Use entity manager on startup.


/*
 * Copyright (C) 2012 Archie L. Cobbs. All rights reserved.
 *
 * $Id$
 */

package org.dellroad.stuff.pobj;

import java.util.Set;

import javax.validation.ConstraintViolation;

/**
 * Runtime exception thrown during {@link PersistentObject} operations.
 */
@SuppressWarnings("serial")
public class PersistentObjectValidationException extends PersistentObjectException {

    private final Set<ConstraintViolation<?>> violations;

    /**
     * Constructor.
     *
     * @param violations set of violations
     * @throws IllegalArgumentException if {@code violations} is null
     */
    public PersistentObjectValidationException(Set<ConstraintViolation<?>> violations) {
        this.violations = violations;
    }

    /**
     * Get the set of constraint violations.
     */
    public Set<ConstraintViolation<?>> getViolations() {
        return this.violations;
    }

    private static String generateMessage(Set<ConstraintViolation<?>> violations) {
        if (violations == null)
            throw new IllegalArgumentException("null violations");
        StringBuilder buf = new StringBuilder("object failed to validate with " + violations.size() + " violation(s): ");
        boolean first = true;
        for (ConstraintViolation<?> violation : violations) {
            if (first)
                first = false;
            else
                buf.append("; ");
            buf.append("[" + violation.getPropertyPath() + "]: " + violation.getMessage());
        }
        return buf.toString();
    }
}

/*
 * Copyright (C) 2012 Archie L. Cobbs. All rights reserved.
 *
 * $Id$
 */

package org.dellroad.stuff.pobj;

import java.util.Set;

import javax.validation.ConstraintViolation;

/**
 * Runtime exception thrown during {@link PersistentObject} operations.
 */
@SuppressWarnings("serial")
public class PersistentObjectValidationException extends PersistentObjectException {

    private final Set<ConstraintViolation<?>> violations;

    /**
     * Constructor.
     *
     * @param violations set of violations
     * @throws IllegalArgumentException if {@code violations} is null
     */
    public PersistentObjectValidationException(Set<ConstraintViolation<?>> violations) {
        super(PersistentObjectValidationException.generateMessage(violations));
        this.violations = violations;
    }

    /**
     * Get the set of constraint violations.
     */
    public Set<ConstraintViolation<?>> getViolations() {
        return this.violations;
    }

    private static String generateMessage(Set<ConstraintViolation<?>> violations) {
        if (violations == null)
            throw new IllegalArgumentException("null violations");
        StringBuilder buf = new StringBuilder("object failed to validate with " + violations.size() + " violation(s): ");
        boolean first = true;
        for (ConstraintViolation<?> violation : violations) {
            if (first)
                first = false;
            else
                buf.append("; ");
            buf.append("[" + violation.getPropertyPath() + "]: " + violation.getMessage());
        }
        return buf.toString();
    }
}

Fix bug in previous comit.


package bj.pranie.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

import javax.sql.DataSource;

/**
 * Created by Sebastian Sokolowski on 13.10.16.
 */
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    CustomAuthenticationProvider customAuthenticationProvider;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .antMatchers("/",
                        "/week", "/week/*",
                        "/wm/*/*/*/*",
                        "/user/registration", "/user/restore",
                        "/images/*",
                        "/js/*").permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/login")
                .defaultSuccessUrl("/week")
                .permitAll()
                .and()
                .logout()
                .permitAll();
    }

    @Autowired
    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.authenticationProvider(customAuthenticationProvider);
    }
}

package bj.pranie.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

import javax.sql.DataSource;

/**
 * Created by Sebastian Sokolowski on 13.10.16.
 */
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    CustomAuthenticationProvider customAuthenticationProvider;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .antMatchers("/",
                        "/logout",
                        "/week", "/week/*",
                        "/wm/*/*/*/*",
                        "/user/registration", "/user/restore",
                        "/images/*",
                        "/js/*").permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/login")
                .defaultSuccessUrl("/week")
                .permitAll()
                .and()
                .logout()
                .logoutUrl("/logout")
                .logoutSuccessUrl("/")
                .permitAll();
    }

    @Autowired
    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.authenticationProvider(customAuthenticationProvider);
    }
}

Add logout url and regirect to main page after successful login.


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

package org.gradle.execution.plan;

import javax.annotation.Nullable;

/**
 * Represents a set of nodes reachable from a particular entry point node (a "requested task")
 */
public class OrdinalGroup extends NodeGroup {
    private final int ordinal;

    public OrdinalGroup(int ordinal) {
        this.ordinal = ordinal;
    }

    @Override
    public String toString() {
        return "task group " + ordinal;
    }

    @Nullable
    @Override
    public OrdinalGroup asOrdinal() {
        return this;
    }

    @Override
    public NodeGroup withOrdinalGroup(OrdinalGroup newOrdinal) {
        return newOrdinal;
    }

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

    public int getOrdinal() {
        return ordinal;
    }
}

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

package org.gradle.execution.plan;

import javax.annotation.Nullable;

/**
 * Represents a set of nodes reachable from a particular entry point node (a "requested task")
 */
public class OrdinalGroup extends NodeGroup {
    private final int ordinal;

    public OrdinalGroup(int ordinal) {
        this.ordinal = ordinal;
    }

    @Override
    public String toString() {
        return "task group " + ordinal;
    }

    @Nullable
    @Override
    public OrdinalGroup asOrdinal() {
        return this;
    }

    @Override
    public NodeGroup withOrdinalGroup(OrdinalGroup newOrdinal) {
        return newOrdinal;
    }

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

    public int getOrdinal() {
        return ordinal;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        OrdinalGroup that = (OrdinalGroup) o;

        return ordinal == that.ordinal;
    }

    @Override
    public int hashCode() {
        return ordinal;
    }
}

Add equals/hashCode to ordinal Group


package com.speedment.runtime.connector.sqlite.internal;

import com.speedment.runtime.config.Column;
import com.speedment.runtime.core.db.DbmsColumnHandler;

import java.util.function.Predicate;

/**
 * Implementation of {@link DbmsColumnHandler} for SQLite databases.
 *
 * @author Emil Forslund
 * @since  3.1.10
 */
public final class SqliteColumnHandler implements DbmsColumnHandler {
    @Override
    public Predicate<Column> excludedInInsertStatement() {
        return Column::isAutoIncrement;
    }

    @Override
    public Predicate<Column> excludedInUpdateStatement() {
        return col -> false;
    }
}

package com.speedment.runtime.connector.sqlite.internal;

import com.speedment.runtime.config.Column;
import com.speedment.runtime.core.db.DbmsColumnHandler;

import java.util.function.Predicate;

/**
 * Implementation of {@link DbmsColumnHandler} for SQLite databases.
 *
 * @author Emil Forslund
 * @since  3.1.10
 */
public final class SqliteColumnHandler implements DbmsColumnHandler {
    @Override
    public Predicate<Column> excludedInInsertStatement() {
        return col -> false;
    }

    @Override
    public Predicate<Column> excludedInUpdateStatement() {
        return col -> false;
    }
}

Remove filter that excludes auto increment columns from persists


import com.github.sormuras.bach.Bach;
import com.github.sormuras.bach.ToolCall;
import com.github.sormuras.bach.ToolFinder;

class format {
  public static void main(String... args) throws Exception {
    var bach = Bach.ofDefaults().with(ToolFinder.ofJavaTools(".bach/external-tools"));
    if (bach.configuration().finder().find("format@1.15.0").isEmpty()) {
      bach.run(
          """
          load-and-verify
            .bach/external-tools/format@1.15.0/google-java-format-1.15.0-all-deps.jar
            https://github.com/google/google-java-format/releases/download/v1.15.0/google-java-format-1.15.0-all-deps.jar\
          #SIZE=3519780\
          &SHA-256=a356bb0236b29c57a3ab678f17a7b027aad603b0960c183a18f1fe322e4f38ea
          """);
    }
    var format = ToolCall.of("format@1.15.0").with("--replace").withFindFiles("**/*.java");
    bach.run("banner", "Format %d .java files".formatted(format.arguments().size() - 1));
    bach.run(format);
  }
}

import com.github.sormuras.bach.Bach;
import com.github.sormuras.bach.ToolCall;

class format {
  public static void main(String... args) throws Exception {
    var bach = Bach.ofDefaults();
    if (bach.configuration().finder().find("format@1.15.0").isEmpty()) {
      bach.run(
          """
          load-and-verify
            .bach/external-tools/format@1.15.0/google-java-format-1.15.0-all-deps.jar
            https://github.com/google/google-java-format/releases/download/v1.15.0/google-java-format-1.15.0-all-deps.jar\
          #SIZE=3519780\
          &SHA-256=a356bb0236b29c57a3ab678f17a7b027aad603b0960c183a18f1fe322e4f38ea
          """);
    }
    var format = ToolCall.of("format@1.15.0").with("--replace").withFindFiles("**/*.java");
    bach.run("banner", "Format %d .java files".formatted(format.arguments().size() - 1));
    bach.run(format);
  }
}

Use default Bach factory with its external tool finder


package com.obidea.semantika.cli2.command;

public class CommandFactory
{
   public static Command create(String command) throws Exception
   {
      if (command.startsWith(Command.SELECT)) {
         return new SelectCommand(command);
      }
      else if (command.startsWith(Command.SET_PREFIX)) {
         return new SetPrefixCommand(command);
      }
      else if (command.startsWith(Command.SHOW_PREFIXES)) {
         return new ShowPrefixesCommand(command);
      }
      throw new Exception("Unknown command"); //$NON-NLS-1$
   }
}

package com.obidea.semantika.cli2.command;

public class CommandFactory
{
   public static Command create(String command) throws Exception
   {
      if (startsWith(command, Command.SELECT)) {
         return new SelectCommand(command);
      }
      else if (startsWith(command, Command.SET_PREFIX)) {
         return new SetPrefixCommand(command);
      }
      else if (startsWith(command, Command.SHOW_PREFIXES)) {
         return new ShowPrefixesCommand(command);
      }
      throw new Exception("Unknown command"); //$NON-NLS-1$
   }

   private static boolean startsWith(String command, String keyword)
   {
      return command.startsWith(keyword) || command.startsWith(keyword.toUpperCase());
   }
}

Set the string comparison to ignore letter cases.


package se.claremont.autotest.common;

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

/**
 * The LogFolder class maintains the test run log folder for logging purposes of test based logs,
 * html based logs, summary log, screen shots and other assets that has to do with test resources
 * being saved along a test execution.
 *
 * Created by jordam on 2016-09-05.
 */
public class LogFolder {
    public static String testRunLogFolder = null;  //Used for test case logging
    @SuppressWarnings("FieldCanBeLocal")
    private static String baseLogFolder = null;     //Read from Settings

    /**
     * Sets the values to run time values.
     *
     * @param testSetName The name of the testSet. Normally used to get test case logs in correct folder
     */
    public static void setLogFolder(String testSetName){
        if(testRunLogFolder == null){
            baseLogFolder = TestRun.settings.getValue(Settings.SettingParameters.BASE_LOG_FOLDER);
            if(!baseLogFolder.endsWith("\\")){ baseLogFolder = baseLogFolder + "\\"; }
            testRunLogFolder = baseLogFolder + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + "_" + testSetName + "\\";
        }
    }
}

package se.claremont.autotest.common;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * The LogFolder class maintains the test run log folder for logging purposes of test based logs,
 * html based logs, summary log, screen shots and other assets that has to do with test resources
 * being saved along a test execution.
 *
 * Created by jordam on 2016-09-05.
 */
public class LogFolder {
    public static String testRunLogFolder = null;  //Used for test case logging
    @SuppressWarnings("FieldCanBeLocal")
    private static String baseLogFolder = null;     //Read from Settings

    /**
     * Sets the values to run time values.
     *
     * @param testSetName The name of the testSet. Normally used to get test case logs in correct folder
     */
    public static void setLogFolder(String testSetName){
        if(testRunLogFolder == null){
            baseLogFolder = TestRun.settings.getValue(Settings.SettingParameters.BASE_LOG_FOLDER);
            if(!baseLogFolder.endsWith("\\") || !baseLogFolder.endsWith("/")){ baseLogFolder = baseLogFolder + "\\"; }
            testRunLogFolder = baseLogFolder.replace("\\", File.separator).replace("/", File.separator) + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + "_" + testSetName + File.separator;
        }
    }
}

Fix for bad file separators for screenshots


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

package com.facebook.buck.util.zip;

public enum ZipCompressionLevel {
  NONE(0),
  DEFAULT(6),
  MAX(9),
  ;

  private final int value;

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

  public int getValue() {
    return value;
  }
}

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

package com.facebook.buck.util.zip;

public enum ZipCompressionLevel {
  NONE(0),
  MIN(1),
  DEFAULT(6),
  MAX(9),
  ;

  private final int value;

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

  public int getValue() {
    return value;
  }
}

Revert "[Cleanup] Remove unused MIN enum value."


package org.fakekoji;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.nio.file.Path;

public class Utils {

    private static final ClassLoader classLoader = Utils.class.getClassLoader();

    public static String readResource(Path path) throws IOException {
        return readFile(classLoader.getResource(path.toString()));
    }

    public static String readFile(File file) throws IOException {
        final StringBuilder content = new StringBuilder();
        final FileReader fileReader = new FileReader(file);
        final BufferedReader bufferedReader = new BufferedReader(fileReader);
        String line;
        while ((line = bufferedReader.readLine()) != null) {
            content.append(line);
        }
        bufferedReader.close();
        fileReader.close();
        return content.toString();
    }

    public static String readFile(URL url) throws IOException {
        return readFile(new File(url.getFile()));
    }

    public static void writeToFile(Path path, String content) throws IOException {
        writeToFile(path.toFile(), content);
    }

    public static void writeToFile(File file, String content) throws IOException {
        final PrintWriter writer = new PrintWriter(file.getAbsolutePath());
        writer.write(content);
        writer.flush();
        writer.close();
    }
}

package org.fakekoji;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;

import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;

public class Utils {

    private static final ClassLoader classLoader = Utils.class.getClassLoader();

    public static String readResource(Path path) throws IOException {
        return readFile(classLoader.getResource(path.toString()));
    }

    public static String readFile(File file) throws IOException {
        final StringBuilder content = new StringBuilder();
        final FileReader fileReader = new FileReader(file);
        final BufferedReader bufferedReader = new BufferedReader(fileReader);
        String line;
        while ((line = bufferedReader.readLine()) != null) {
            content.append(line);
        }
        bufferedReader.close();
        fileReader.close();
        return content.toString();
    }

    public static String readFile(URL url) throws IOException {
        return readFile(new File(url.getFile()));
    }

    public static void writeToFile(Path path, String content) throws IOException {
        writeToFile(path.toFile(), content);
    }

    public static void writeToFile(File file, String content) throws IOException {
        final PrintWriter writer = new PrintWriter(file.getAbsolutePath());
        writer.write(content);
        writer.flush();
        writer.close();
    }

    public static void moveFile(File source, File target) throws IOException {
        Files.move(source.toPath(), target.toPath(), REPLACE_EXISTING);
    }
}

Create function for moving files


// Copyright (C) 2011 jOVAL.org.  All rights reserved.
// This software is licensed under the AGPL 3.0 license available at http://www.joval.org/agpl_v3.txt

package org.joval.os.windows.registry;

import org.joval.intf.windows.registry.IKey;
import org.joval.intf.windows.registry.IMultiStringValue;

/**
 * Representation of a Windows registry multi-string value.
 *
 * @author David A. Solin
 * @version %I% %G%
 */
public class MultiStringValue extends Value implements IMultiStringValue {
    String[] data;

    public MultiStringValue(IKey parent, String name, String[] data) {
	type = Type.REG_MULTI_SZ;
	this.parent = parent;
	this.name = name;
	this.data = data;
    }

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

    public String toString() {
	StringBuffer sb = new StringBuffer("MultiStringValue [Name=\"").append(name).append("\" Value={");
	for (int i=0; i < data.length; i++) {
	    if (i > 0) {
		sb.append(", ");
	    }
	    sb.append("\"").append(data[i]).append("\"");
	}
	sb.append("}]");
	return sb.toString();
    }
}

// Copyright (C) 2011 jOVAL.org.  All rights reserved.
// This software is licensed under the AGPL 3.0 license available at http://www.joval.org/agpl_v3.txt

package org.joval.os.windows.registry;

import org.joval.intf.windows.registry.IKey;
import org.joval.intf.windows.registry.IMultiStringValue;

/**
 * Representation of a Windows registry multi-string value.
 *
 * @author David A. Solin
 * @version %I% %G%
 */
public class MultiStringValue extends Value implements IMultiStringValue {
    String[] data;

    public MultiStringValue(IKey parent, String name, String[] data) {
	type = Type.REG_MULTI_SZ;
	this.parent = parent;
	this.name = name;
	this.data = data;
    }

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

    public String toString() {
	StringBuffer sb = new StringBuffer("MultiStringValue [Name=\"").append(name).append("\" Value=");
	if (data == null) {
	    sb.append("null");
	} else {
	    sb.append("{");
	    for (int i=0; i < data.length; i++) {
		if (i > 0) {
		    sb.append(", ");
		}
		sb.append("\"").append(data[i]).append("\"");
	    }
	    sb.append("}");
	}
	sb.append("]");
	return sb.toString();
    }
}

Handle REG_MULTI_SZ.toString when there the value is null (i.e., raw data is a single \0, not a double \0\0).


package se.chalmers.watchme.database;

import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
/**
 * The table in the database that holds data for Movies.
 *
 * @author lisastenberg
 */
public class MoviesTable {

	public static final String TABLE_MOVIES = "movies";

	public static final String COLUMN_MOVIE_ID = "_id";
	public static final String COLUMN_TITLE = "title";
	public static final String COLUMN_RATING = "rating";
	public static final String COLUMN_NOTE = "note";
	public static final String COLUMN_DATE = "releasedate";

	private static final String CREATE_MOVIES_TABLE = "CREATE TABLE "
			+ TABLE_MOVIES + "(" + COLUMN_MOVIE_ID + " INTEGER PRIMARY KEY,"
			+ COLUMN_TITLE + " TEXT," + COLUMN_RATING + " INTEGER," + COLUMN_NOTE
			+ " TEXT," + COLUMN_DATE + " INTEGER" + ")";

	public static void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_MOVIES_TABLE);
	}

	public static void onUpgrade(SQLiteDatabase db, int oldVersion,
			int newVersion) {
		Log.w(MoviesTable.class.getName(), "Upgrading database from version "
				+ oldVersion + " to " + newVersion
				+ ", which will destroy all old data");
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_MOVIES);
		onCreate(db);
	}
}

package se.chalmers.watchme.database;

import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
/**
 * The table in the database that holds data for Movies.
 *
 * @author lisastenberg
 */
public class MoviesTable {

	public static final String TABLE_MOVIES = "movies";

	public static final String COLUMN_MOVIE_ID = "_id";
	public static final String COLUMN_TITLE = "title";
	public static final String COLUMN_RATING = "rating";
	public static final String COLUMN_NOTE = "note";
	public static final String COLUMN_DATE = "releasedate";
	public static final String COLUMN_IMDB_ID = "imdbid";

	private static final String CREATE_MOVIES_TABLE = "CREATE TABLE "
			+ TABLE_MOVIES + "(" + COLUMN_MOVIE_ID + " INTEGER PRIMARY KEY,"
			+ COLUMN_TITLE + " TEXT," + COLUMN_RATING + " INTEGER," + COLUMN_NOTE
			+ " TEXT," + COLUMN_DATE + " INTEGER," + COLUMN_IMDB_ID +" TEXT" + ")";

	public static void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_MOVIES_TABLE);
	}

	public static void onUpgrade(SQLiteDatabase db, int oldVersion,
			int newVersion) {
		Log.w(MoviesTable.class.getName(), "Upgrading database from version "
				+ oldVersion + " to " + newVersion
				+ ", which will destroy all old data");
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_MOVIES);
		onCreate(db);
	}
}

Add IMDB ID column to Movies table


package cpw.mods.fml.common;

import org.objectweb.asm.tree.ClassNode;

public interface IASMHook {
    /**
     * Inject the {@link Mod} class node into this instance. This allows retrieval from custom
     * attributes or other artifacts in your mod class
     *
     * @param modClassNode The mod class
     * @return optionally a code generated class that will be injected into the classloader
     */
    ClassNode inject(ClassNode modClassNode);
    /**
     * Allow mods to manipulate classes loaded from this {@link Mod}'s jar file. The {@link Mod}
     * class is always guaranteed to be called first
     *
     * @param node The class being loaded
     */
    void modifyClass(String className, ClassNode node);
}

package cpw.mods.fml.common;

import org.objectweb.asm.tree.ClassNode;

public interface IASMHook {
    /**
     * Inject the {@link Mod} class node into this instance. This allows retrieval from custom
     * attributes or other artifacts in your mod class
     *
     * @param modClassNode The mod class
     * @return optionally some code generated classes that will be injected into the classloader
     */
    ClassNode[] inject(ClassNode modClassNode);
    /**
     * Allow mods to manipulate classes loaded from this {@link Mod}'s jar file. The {@link Mod}
     * class is always guaranteed to be called first.
     * The node state should be changed in place.
     *
     * @param node The class being loaded
     */
    void modifyClass(String className, ClassNode node);
}

Tweak IASM hook api. You can return multiple classes now.


package de.innoaccel.wamp.server.converter;

public class MessageParseException extends Exception
{
    private String message;

    public MessageParseException(String message)
    {
        super("Cannot parse message");

        this.message = message;
    }

    public String getRawMessage()
    {
        return this.message;
    }
}

package de.innoaccel.wamp.server.converter;

public class MessageParseException extends Exception
{
}

Remove unnecessary message wrapper of exception


package net.katsuster.strview.media.ts;

import net.katsuster.strview.io.*;
import net.katsuster.strview.media.*;

/**
 * @author katsuhiro
 */
public class TSPacketList extends AbstractLargeList<TSPacket> {
    public LargeBitList buf;

    public TSPacketList() {
        super(LENGTH_UNKNOWN);
    }

    public TSPacketList(LargeBitList l) {
        super(LENGTH_UNKNOWN);

        buf = l;
    }

    @Override
    public void count() {
        setLength(buf.length() / 188 / 8);
    }

    @Override
    protected TSPacket getInner(long index) {
        TSPacket p = new TSPacket();
        FromBitBufferConverter c = new FromBitBufferConverter(BitBuffer.wrap(buf));

        c.doInit();
        c.position(index * 188 * 8);
        p.setNumber(index);
        p.setLevel(0);
        p.read(c);
        c.doFinal();

        return p;
    }

    @Override
    protected void setInner(long index, TSPacket data) {

    }
}

package net.katsuster.strview.media.ts;

import net.katsuster.strview.io.*;
import net.katsuster.strview.media.*;

/**
 * @author katsuhiro
 */
public class TSPacketList extends AbstractLargeList<TSPacket> {
    public LargeBitList buf;

    public TSPacketList() {
        super(LENGTH_UNKNOWN);
    }

    public TSPacketList(LargeBitList l) {
        super(LENGTH_UNKNOWN);

        buf = l;
    }

    @Override
    public void count() {
        setLength(buf.length() / 188 / 8);
    }

    @Override
    protected TSPacket getInner(long index) {
        TSPacket p = new TSPacket();
        FromBitListConverter c = new FromBitListConverter(buf);

        c.doInit();
        c.position(index * 188 * 8);
        p.setNumber(index);
        p.setLevel(0);
        p.read(c);
        c.doFinal();

        return p;
    }

    @Override
    protected void setInner(long index, TSPacket data) {

    }
}

Use LargeBitList instead of BitBuffer.


/**
 * Copyright 2010 The PlayN 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 playn.java;

import playn.core.LogImpl;

class JavaLog extends LogImpl {

  @Override
  protected void logImpl(Level level, String msg, Throwable e) {
    switch (level) {
    default:
      System.out.println(msg);
      if (e != null)
        e.printStackTrace(System.err);
      break;
    case WARN:
    case ERROR:
      System.err.println(msg);
      if (e != null)
        e.printStackTrace(System.out);
      break;
    }
  }
}

/**
 * Copyright 2010 The PlayN 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 playn.java;

import playn.core.LogImpl;

class JavaLog extends LogImpl {

  @Override
  protected void logImpl(Level level, String msg, Throwable e) {
    switch (level) {
    default:
      System.out.println(msg);
      if (e != null)
        e.printStackTrace(System.out);
      break;
    case WARN:
    case ERROR:
      System.err.println(msg);
      if (e != null)
        e.printStackTrace(System.err);
      break;
    }
  }
}

Use out with out, err with err.


package demo.mantle;

public class TestTool implements java.util.spi.ToolProvider {
  @Override
  public String name() {
    return "test(demo.mantle)";
  }

  @Override
  public int run(java.io.PrintWriter out, java.io.PrintWriter err, String... args) {
    try {
      checkMantle();
      return 0;
    } catch (Throwable t) {
      return 1;
    }
  }

  private static void checkMantle() {
    var mantle = new Mantle();
    var type = mantle.core.getClass();
    if (!type.getSimpleName().equals("PublicCore")) {
      throw new AssertionError("Expected PublicCore, but got: " + type);
    }
  }
}

package demo.mantle;

public class TestTool implements java.util.spi.ToolProvider {
  @Override
  public String name() {
    return "test(demo.mantle)";
  }

  @Override
  public int run(java.io.PrintWriter out, java.io.PrintWriter err, String... args) {
    try {
      checkMantle();
      return 0;
    } catch (Throwable throwable) {
      throwable.printStackTrace(err);
      return 1;
    }
  }

  private static void checkMantle() {
    var mantle = new Mantle();
    var type = mantle.core.getClass();
    if (!type.getSimpleName().equals("PublicCore")) {
      throw new AssertionError("Expected PublicCore, but got: " + type);
    }
  }
}

Print stack trace on error


// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.athenz.api;

import java.util.Objects;

/**
 * Represents an Athenz Access Token
 *
 * @author bjorncs
 */
public class AthenzAccessToken {

    public static final String HTTP_HEADER_NAME = "Authorization";

    private static final String BEARER_TOKEN_PREFIX = "Bearer ";

    private final String value;

    public AthenzAccessToken(String value) {
        this.value = stripBearerTokenPrefix(value);
    }

    private static String stripBearerTokenPrefix(String rawValue) {
        String stripped = rawValue.strip();
        return stripped.startsWith(BEARER_TOKEN_PREFIX)
                ? stripped.substring(BEARER_TOKEN_PREFIX.length())
                : stripped;
    }

    public String value() { return value; }

    @Override public String toString() { return "AthenzAccessToken{value='" + value + "'}"; }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AthenzAccessToken that = (AthenzAccessToken) o;
        return Objects.equals(value, that.value);
    }

    @Override
    public int hashCode() {
        return Objects.hash(value);
    }
}

// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.athenz.api;

import java.util.Objects;

/**
 * Represents an Athenz Access Token
 *
 * @author bjorncs
 */
public class AthenzAccessToken {

    public static final String HTTP_HEADER_NAME = "Authorization";

    private static final String BEARER_TOKEN_PREFIX = "Bearer ";

    private final String value;

    public AthenzAccessToken(String value) {
        this.value = stripBearerTokenPrefix(value);
    }

    private static String stripBearerTokenPrefix(String rawValue) {
        String stripped = rawValue.strip();
        String prefixRemoved = stripped.startsWith(BEARER_TOKEN_PREFIX)
                ? stripped.substring(BEARER_TOKEN_PREFIX.length()).strip()
                : stripped;
        if (prefixRemoved.isBlank()) {
            throw new IllegalArgumentException(String.format("Access token is blank: '%s'", prefixRemoved));
        }
        return prefixRemoved;
    }

    public String value() { return value; }

    @Override public String toString() { return "AthenzAccessToken{value='" + value + "'}"; }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AthenzAccessToken that = (AthenzAccessToken) o;
        return Objects.equals(value, that.value);
    }

    @Override
    public int hashCode() {
        return Objects.hash(value);
    }
}

Access tokens should not be an empty string


/*
 * Copyright 2009-2010 by The Regents of the University of California
 * 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 from
 *
 *     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 edu.uci.ics.asterix.aql.translator;

import edu.uci.ics.asterix.aql.base.Statement;
import edu.uci.ics.asterix.aql.expression.Query;

public class QueryResult {

    private final Query query;
    private final String resultPath;

    public QueryResult(Query statement, String resultPath) {
        this.query = statement;
        this.resultPath = resultPath;
    }

    public Statement getStatement() {
        return query;
    }

    public String getResultPath() {
        return resultPath;
    }

}

/*
 * Copyright 2009-2010 by The Regents of the University of California
 * 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 from
 *
 *     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 edu.uci.ics.asterix.aql.translator;

import edu.uci.ics.asterix.aql.base.Statement;
import edu.uci.ics.asterix.aql.expression.Query;
import edu.uci.ics.hyracks.api.dataset.ResultSetId;
import edu.uci.ics.hyracks.api.job.JobId;

public class QueryResult {

    private final Query query;

    private final ResultSetId resultSetId;

    private JobId jobId;

    public QueryResult(Query statement, ResultSetId resultSetId) {
        this.query = statement;
        this.resultSetId = resultSetId;
    }

    public void setJobId(JobId jobId) {
        this.jobId = jobId;
    }

    public JobId getJobId() {
        return jobId;
    }

    public Statement getStatement() {
        return query;
    }

    public ResultSetId getResultId() {
        return resultSetId;
    }

}

Store and implement the necessary data and methods for storing information about the job and result set id.


/*
 * Copyright 2017 The Android Open Source Project
 *
 * 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.material.catalog.application;

import android.app.Application;
import dagger.BindsInstance;
import dagger.android.support.AndroidSupportInjectionModule;
import io.material.catalog.application.scope.ApplicationScope;
import io.material.catalog.main.MainActivity;

/** The Application's root component. */
@ApplicationScope
@dagger.Component(
  modules = {
    AndroidSupportInjectionModule.class,
    MainActivity.Module.class,
  }
)
public interface CatalogApplicationComponent {
  void inject(CatalogApplication app);

  /** The root component's builder. */
  @dagger.Component.Builder
  interface Builder {
    @BindsInstance
    CatalogApplicationComponent.Builder application(Application application);

    CatalogApplicationComponent build();
  }
}

/*
 * Copyright 2017 The Android Open Source Project
 *
 * 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.material.catalog.application;

import android.app.Application;
import dagger.BindsInstance;
import dagger.android.AndroidInjectionModule;
import io.material.catalog.application.scope.ApplicationScope;
import io.material.catalog.main.MainActivity;

/** The Application's root component. */
@ApplicationScope
@dagger.Component(
    modules = {
      AndroidInjectionModule.class,
      MainActivity.Module.class,
    })
public interface CatalogApplicationComponent {
  void inject(CatalogApplication app);

  /** The root component's builder. */
  @dagger.Component.Builder
  interface Builder {
    @BindsInstance
    CatalogApplicationComponent.Builder application(Application application);

    CatalogApplicationComponent build();
  }
}

Migrate from AndroidSupportInjectionModule to AndroidInjectionModule.


package org.nanopub;

import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;

import org.openrdf.model.URI;
import org.openrdf.rio.trig.TriGWriter;

/**
 * @author Tobias Kuhn
 */
public class CustomTrigWriter extends TriGWriter {

	public CustomTrigWriter(OutputStream out) {
		super(out);
	}

	public CustomTrigWriter(Writer writer) {
		super(writer);
	}

	protected void writeURI(URI uri) throws IOException {
		String prefix = namespaceTable.get(uri.toString());
		if (prefix != null) {
			writer.write(prefix);
			writer.write(":");
		} else {
			super.writeURI(uri);
		}
	}

}

package org.nanopub;

import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;

import org.openrdf.model.URI;
import org.openrdf.rio.trig.TriGWriter;
import org.openrdf.rio.turtle.TurtleUtil;

/**
 * @author Tobias Kuhn
 */
public class CustomTrigWriter extends TriGWriter {

	public CustomTrigWriter(OutputStream out) {
		super(out);
	}

	public CustomTrigWriter(Writer writer) {
		super(writer);
	}

	@Override
	protected void writeURI(URI uri) throws IOException {
		String uriString = uri.toString();

		String prefix = namespaceTable.get(uriString);
		if (prefix != null) {
			// Exact match: no suffix required
			writer.write(prefix);
			writer.write(":");
			return;
		}

		prefix = null;

		int splitIdxNorm = TurtleUtil.findURISplitIndex(uriString);
		// Do also split at dots:
		int splitIdxDot = uriString.lastIndexOf(".") + 1;
		if (uriString.length() == splitIdxDot) splitIdxDot = -1;
		int splitIdx = Math.max(splitIdxNorm, splitIdxDot);
		if (splitIdx > 0) {
			String namespace = uriString.substring(0, splitIdx);
			prefix = namespaceTable.get(namespace);
		}

		if (prefix != null) {
			// Namespace is mapped to a prefix; write abbreviated URI
			writer.write(prefix);
			writer.write(":");
			writer.write(uriString.substring(splitIdx));
		} else {
			// Write full URI
			writer.write("<");
			writer.write(TurtleUtil.encodeURIString(uriString));
			writer.write(">");
		}
	}

}

Make sure prefixes are split at '.' when writing TriG


/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2009, Red Hat Middleware LLC, and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.jboss.threads;

import java.util.concurrent.RejectedExecutionException;

class RejectingExecutor implements DirectExecutor {
    static final RejectingExecutor INSTANCE = new RejectingExecutor();

    private RejectingExecutor() {
    }

    public void execute(final Runnable command) {
        throw new RejectedExecutionException();
    }

    public String toString() {
        return "Rejecting executor";
    }
}

/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2009, Red Hat Middleware LLC, and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.jboss.threads;

import java.util.concurrent.RejectedExecutionException;

class RejectingExecutor implements DirectExecutor {
    static final RejectingExecutor INSTANCE = new RejectingExecutor();

    private final String message;

    private RejectingExecutor() {
        message = null;
    }

    RejectingExecutor(final String message) {
        this.message = message;
    }

    public void execute(final Runnable command) {
        throw new RejectedExecutionException(message);
    }

    public String toString() {
        return "Rejecting executor";
    }
}

Allow rejecting executor to have a fixed message


package com.github.arteam.jdbi3;

import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.jdbi.v3.sqlobject.customizer.Bind;
import org.jdbi.v3.sqlobject.statement.SqlQuery;
import org.jdbi.v3.stringtemplate4.UseStringTemplateSqlLocator;

import java.time.LocalDate;
import java.util.Optional;

@UseStringTemplateSqlLocator
public interface GameDao {

    @SqlQuery
    ImmutableList<Integer> findGameIds();

    @SqlQuery
    ImmutableSet<String> findAllUniqueHomeTeams();

    @SqlQuery
    Optional<Integer> findIdByTeamsAndDate(@Bind("home_team") String homeTeam,
                                           @Bind("visitor_team") String visitorTeam,
                                           @Bind("played_at") LocalDate date);

    @SqlQuery
    LocalDate getFirstPlayedSince(@Bind("up") LocalDate up);

    @SqlQuery
    @Timed(name = "get-last-played")
    Optional<LocalDate> getLastPlayedDateByTeams(@Bind("home_team") String homeTeam,
                                                 @Bind("visitor_team") String visitorTeam);

    @SqlQuery
    Optional<String> findHomeTeamByGameId(@Bind("id") Optional<Integer> id);
}

package com.github.arteam.jdbi3;

import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.jdbi.v3.sqlobject.customizer.Bind;
import org.jdbi.v3.sqlobject.statement.SqlQuery;
import org.jdbi.v3.stringtemplate4.UseStringTemplateSqlLocator;

import java.time.LocalDate;
import java.util.Optional;

@UseStringTemplateSqlLocator
@Timed(name = "game-dao")
public interface GameDao {

    @SqlQuery
    ImmutableList<Integer> findGameIds();

    @SqlQuery
    ImmutableSet<String> findAllUniqueHomeTeams();

    @SqlQuery
    Optional<Integer> findIdByTeamsAndDate(@Bind("home_team") String homeTeam,
                                           @Bind("visitor_team") String visitorTeam,
                                           @Bind("played_at") LocalDate date);

    @SqlQuery
    LocalDate getFirstPlayedSince(@Bind("up") LocalDate up);

    @SqlQuery
    @Timed(name = "last-played-date")
    Optional<LocalDate> getLastPlayedDateByTeams(@Bind("home_team") String homeTeam,
                                                 @Bind("visitor_team") String visitorTeam);

    @SqlQuery
    Optional<String> findHomeTeamByGameId(@Bind("id") Optional<Integer> id);
}

Use the `@Timed` annotation on SQLObjects


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

import io.grpc.Internal;
import io.spine.server.transport.ChannelId;
import io.spine.server.transport.Subscriber;

/**
 * An in-memory implementation of the {@link Subscriber}.
 *
 * <p>To use only in scope of the same JVM as {@linkplain InMemoryPublisher publishers}.
 */
@Internal
public class InMemorySubscriber extends Subscriber {

    public InMemorySubscriber(ChannelId id) {
        super(id);
    }
}

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

import io.spine.server.transport.ChannelId;
import io.spine.server.transport.Subscriber;

/**
 * An in-memory implementation of the {@link Subscriber}.
 *
 * <p>To use only in scope of the same JVM as {@linkplain InMemoryPublisher publishers}.
 */

class InMemorySubscriber extends Subscriber {

    InMemorySubscriber(ChannelId id) {
        super(id);
    }
}

Reduce visibility where `public` is not required


package com.redhat.victims;

public class Resources {
	public static final String JAR_FILE = "testdata/junit-4.11/junit-4.11.jar";
	public static final String JAR_SHA1 = JAR_FILE + ".sha1";
	public static final String JAR_JSON = JAR_FILE + ".json";

	public static final String POM_FILE = "testdata/junit-4.11/junit-4.11.pom";
	public static final String POM_SHA1 = POM_FILE + ".sha1";
	public static final String POM_JSON = POM_FILE + ".json";

	public static final String RECORD_CLIENT_JAR = "testdata/records/victims-client-1.0-SNAPSHOT.jar.json";

	public static final String TEST_RESPONSE = "testdata/service/test.response";
	public static final String TEST_SHA512 = "testdata/service/test.sha512";
	public static final String TEST_CVE = "testdata/service/test.cve";

}

package com.redhat.victims;

public class Resources {
	public static final String JAR_FILE = "testdata/junit-4.11/junit-4.11.jar";
	public static final String JAR_SHA1 = JAR_FILE + ".sha1";
	public static final String JAR_JSON = JAR_FILE + ".json";

	public static final String POM_FILE = "testdata/junit-4.11/junit-4.11.pom";
	public static final String POM_SHA1 = POM_FILE + ".sha1";
	public static final String POM_JSON = POM_FILE + ".json";

	public static final String RECORD_CLIENT_JAR = "testdata/records/victims-client.jar.json";

	public static final String TEST_RESPONSE = "testdata/service/test.response";
	public static final String TEST_SHA512 = "testdata/service/test.sha512";
	public static final String TEST_CVE = "testdata/service/test.cve";

}

Fix typo in resource file path


package com.vaadin.demo.featurebrowser;

import com.vaadin.ui.Accordion;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;

/**
 * Accordion is a derivative of TabSheet, a vertical tabbed layout that places
 * the tab contents between the vertical tabs.
 */
@SuppressWarnings("serial")
public class AccordionExample extends CustomComponent {
    public AccordionExample() {
        // Create a new accordion
        final Accordion accordion = new Accordion();
        setCompositionRoot(accordion);

        // Add a few tabs to the accordion.
        for (int i = 0; i < 5; i++) {
            // Create a root component for a accordion tab
            VerticalLayout layout = new VerticalLayout();
            accordion.addComponent(layout);

            // The accordion tab label is taken from the caption of the root
            // component. Notice that layouts can have a caption too.
            layout.setCaption("Tab " + (i + 1));

            // Add some components in each accordion tab
            Label label = new Label("These are the contents of Tab " + (i + 1)
                    + ".");
            layout.addComponent(label);

            TextField textfield = new TextField("Some text field");
            layout.addComponent(textfield);
        }
    }
}

package com.vaadin.demo.featurebrowser;

import com.vaadin.ui.Accordion;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;

/**
 * Accordion is a derivative of TabSheet, a vertical tabbed layout that places
 * the tab contents between the vertical tabs.
 */
@SuppressWarnings("serial")
public class AccordionExample extends CustomComponent {
    public AccordionExample() {
        // Create a new accordion
        final Accordion accordion = new Accordion();
        setCompositionRoot(accordion);

        // Add a few tabs to the accordion.
        for (int i = 0; i < 5; i++) {
            // Create a root component for a accordion tab
            VerticalLayout layout = new VerticalLayout();
            // The accordion tab label is taken from the caption of the root
            // component. Notice that layouts can have a caption too.
            layout.setCaption("Tab " + (i + 1));

            accordion.addComponent(layout);

            // Add some components in each accordion tab
            Label label = new Label("These are the contents of Tab " + (i + 1)
                    + ".");
            layout.addComponent(label);

            TextField textfield = new TextField("Some text field");
            layout.addComponent(textfield);
        }
    }
}

Fix FeatureBrowser Accordion example tab captions


package tars.commons.core;

/**
 * Container for user visible messages.
 */
public class Messages {

    public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
    public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
    public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The task index provided is invalid";
    public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d tasks listed!";

}

package tars.commons.core;

/**
 * Container for user visible messages.
 */
public class Messages {

    public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
    public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
    public static final String MESSAGE_INVALID_DATE = "Invalid date";
    public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The task index provided is invalid";
    public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d tasks listed!";

}

Add new message for invalid date


package thredds.catalog2;

import thredds.catalog.ServiceType;

import java.util.List;

/**
 * _more_
 *
 * @author edavis
 * @since 4.0
 */
public interface Dataset extends MetadataContainer
{
  public String getName();
  public String getId();
  public String getAlias();
  public List<Access> getAccesses();
  public Access getAccess( ServiceType type );
  public List<Dataset> getDatasets();
}

package thredds.catalog2;

import thredds.catalog.ServiceType;

import java.util.List;

/**
 * _more_
 *
 * @author edavis
 * @since 4.0
 */
public interface Dataset extends MetadataContainer
{
  public String getName();
  public String getId();
  public String getAlias();

  public boolean isAccessible();
  public List<Access> getAccesses();
  public Access getAccess( ServiceType type );

  public boolean isCollection();
  public List<Dataset> getDatasets();

  public Catalog getParentCatalog();
  public Dataset getParent();
}

Work on refactoring the thredds.catalog package.


package pro.cucumber;

import org.junit.Before;
import org.junit.Test;
import pro.cucumber.gitcli.GitCliRevisionProvider;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.regex.Pattern;

import static org.junit.Assert.assertTrue;

public abstract class RevisionProviderContract {
    private Path rootPath;

    @Before
    public void createScm() throws IOException {
        rootPath = Files.createTempDirectory("GitWC");
        Path subfolder = rootPath.resolve("subfolder");
        Files.createDirectory(subfolder);
        Files.createFile(subfolder.resolve("file"));
        Exec.cmd("git init", rootPath);
        Exec.cmd("git add -A", rootPath);
        Exec.cmd("git commit -am \"files\"", rootPath);
    }

    @Test
    public void findsRev() {
        String sha1Pattern = "^[a-f0-9]{40}$";
        RevisionProvider revisionProvider = makeRevisionProvider(rootPath);
        assertTrue("Expected a sha1", Pattern.matches(sha1Pattern, revisionProvider.getRev()));
    }

    protected abstract RevisionProvider makeRevisionProvider(Path rootPath);

}

package pro.cucumber;

import org.junit.Before;
import org.junit.Test;
import pro.cucumber.gitcli.GitCliRevisionProvider;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.regex.Pattern;

import static org.junit.Assert.assertTrue;

public abstract class RevisionProviderContract {
    private Path rootPath;

    @Before
    public void createScm() throws IOException {
        rootPath = Files.createTempDirectory("GitWC");
        Path subfolder = rootPath.resolve("subfolder");
        Files.createDirectory(subfolder);
        Files.createFile(subfolder.resolve("file"));
        Exec.cmd("git init", rootPath);
        Exec.cmd("git add -A", rootPath);
        Exec.cmd("git commit -am \"files\"", rootPath);
        System.out.println(Exec.cmd("ls -al", rootPath));
    }

    @Test
    public void findsRev() {
        String sha1Pattern = "^[a-f0-9]{40}$";
        RevisionProvider revisionProvider = makeRevisionProvider(rootPath);
        assertTrue("Expected a sha1", Pattern.matches(sha1Pattern, revisionProvider.getRev()));
    }

    protected abstract RevisionProvider makeRevisionProvider(Path rootPath);

}

Add some debugging for circle


package com.hubspot.jinjava.objects.serialization;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.hubspot.jinjava.util.WhitespaceUtils;
import java.util.Objects;

public class PyishObjectMapper {
  private static final ObjectWriter PYISH_OBJECT_WRITER = new ObjectMapper()
    .registerModule(
      new SimpleModule()
        .setSerializerModifier(PyishBeanSerializerModifier.INSTANCE)
        .addSerializer(PyishSerializable.class, PyishSerializer.INSTANCE)
    )
    .writer(PyishPrettyPrinter.INSTANCE)
    .with(PyishCharacterEscapes.INSTANCE);

  public static String getAsUnquotedPyishString(Object val) {
    if (val != null) {
      return WhitespaceUtils.unquoteAndUnescape(getAsPyishString(val));
    }
    return "";
  }

  public static String getAsPyishString(Object val) {
    try {
      return PYISH_OBJECT_WRITER
        .writeValueAsString(val)
        .replace("'", "\\'")
        // Replace double-quotes with single quote as they are preferred in Jinja
        .replaceAll("(?<!\\\\)(\\\\\\\\)*(?:\")", "$1'");
    } catch (JsonProcessingException e) {
      return Objects.toString(val, "");
    }
  }
}

package com.hubspot.jinjava.objects.serialization;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.hubspot.jinjava.util.WhitespaceUtils;
import java.util.Objects;

public class PyishObjectMapper {
  public static final ObjectWriter PYISH_OBJECT_WRITER = new ObjectMapper()
    .registerModule(
      new SimpleModule()
        .setSerializerModifier(PyishBeanSerializerModifier.INSTANCE)
        .addSerializer(PyishSerializable.class, PyishSerializer.INSTANCE)
    )
    .writer(PyishPrettyPrinter.INSTANCE)
    .with(PyishCharacterEscapes.INSTANCE);

  public static String getAsUnquotedPyishString(Object val) {
    if (val != null) {
      return WhitespaceUtils.unquoteAndUnescape(getAsPyishString(val));
    }
    return "";
  }

  public static String getAsPyishString(Object val) {
    try {
      return PYISH_OBJECT_WRITER
        .writeValueAsString(val)
        .replace("'", "\\'")
        // Replace double-quotes with single quote as they are preferred in Jinja
        .replaceAll("(?<!\\\\)(\\\\\\\\)*(?:\")", "$1'");
    } catch (JsonProcessingException e) {
      return Objects.toString(val, "");
    }
  }
}

Make static PYISH_OBJECT_WRITER public so it can be used in PyishSerializable overrides


package org.cytoscape.commandDialog.internal.tasks;

import org.cytoscape.work.AbstractTask;
import org.cytoscape.work.ProvidesTitle;
import org.cytoscape.work.TaskMonitor;
import org.cytoscape.work.Tunable;

public class SleepCommandTask extends AbstractEmptyObservableTask {

	@ProvidesTitle
	public String getTitle() { return "Sleeping..."; }

	@Tunable(description="Duration of sleep in seconds")
	public double duration;

	public SleepCommandTask() {
		super();
	}

	@Override
	public void run(TaskMonitor arg0) throws Exception {
		if (duration != 0d) {
			arg0.showMessage(TaskMonitor.Level.INFO, "Sleeping for "+duration+" seconds");
			Thread.sleep((long)duration*1000);
			arg0.showMessage(TaskMonitor.Level.INFO, "Slept for "+duration+" seconds");
		}

	}
}

package org.cytoscape.commandDialog.internal.tasks;

import org.cytoscape.work.AbstractTask;
import org.cytoscape.work.ProvidesTitle;
import org.cytoscape.work.TaskMonitor;
import org.cytoscape.work.Tunable;

public class SleepCommandTask extends AbstractEmptyObservableTask {

	@ProvidesTitle
	public String getTitle() { return "Sleeping..."; }

	@Tunable(description="Duration of sleep in seconds",
	         longDescription="Enter the time in seconds to sleep",
	         exampleStringValue="5")
	public double duration;

	public SleepCommandTask() {
		super();
	}

	@Override
	public void run(TaskMonitor arg0) throws Exception {
		if (duration != 0d) {
			arg0.showMessage(TaskMonitor.Level.INFO, "Sleeping for "+duration+" seconds");
			Thread.sleep((long)duration*1000);
			arg0.showMessage(TaskMonitor.Level.INFO, "Slept for "+duration+" seconds");
		}

	}
}

Add longDescription and exampleStringValue to sleep


package com.allforfunmc.easyoreapi;

import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod (modid="oreapi", name="AllForFun's EasyOreAPI", version="Dev")
public class EasyOreApi {
	@Instance (value="GenericModID")
	public static EasyOreApi instance;
	@SidedProxy(clientSide="com.allforfunmc.easyoreapi.ClientProxy",serverSide="com.allforfunmc.easyoreapi.CommonProxy")
	public static CommonProxy proxy;
	@EventHandler()
	public void load(FMLInitializationEvent event) {
		proxy.registerRenderers();
	}
	@EventHandler()
	public void Init(FMLInitializationEvent event) {

	}
	@EventHandler()
	public void postInit(FMLInitializationEvent event){
		IWorldGenerator generator = new Generator();
		GameRegistry.registerWorldGenerator(generator, 21);
	}
}

package com.allforfunmc.easyoreapi;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;

@Mod (modid="oreapi", name="AllForFun's EasyOreAPI", version="Dev")
public class EasyOreApi {
	@Instance (value="GenericModID")
	public static EasyOreApi instance;
	@SidedProxy(clientSide="com.allforfunmc.easyoreapi.ClientProxy",serverSide="com.allforfunmc.easyoreapi.CommonProxy")
	public static CommonProxy proxy;
	@EventHandler()
	public void load(FMLInitializationEvent event) {
		proxy.registerRenderers();
	}
	@EventHandler()
	public void Init(FMLInitializationEvent event) {

	}
	@EventHandler()
	public void postInit(FMLInitializationEvent event){

	}
}

Revert "Updated What Im Working On File"