package com.adaptionsoft.games.uglytrivia;

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

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.mockito.Mockito.mock;

public class PlayersTest {

    public static final String PLAYER_ONE = "Thomas";
    public static final String PLAYER_TWO = "Peter";
    public static final String ANY_PLAYER = "Erik";

    private PlayerUI ui = mock(PlayerUI.class);
    private Players players = new Players(ui);

    @Before
    public void addPlayers() {
        players.add(PLAYER_ONE);
        players.add(PLAYER_TWO);
    }

    @Test
    public void shouldAddOnePlayer() {
        assertThat(players.size(), is(2));

        players.add(TestPlayer.named(ANY_PLAYER));

        assertThat(players.size(), is(3));
    }

    @Test(expected = IllegalAccessException.class)
    @Ignore("not implemented")
    public void shouldFailForMoreThanSixPlayers() {
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add("one too many");
    }
}

package com.adaptionsoft.games.uglytrivia;

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

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.mockito.Mockito.mock;

public class PlayersTest {

    public static final String PLAYER_ONE = "Thomas";
    public static final String PLAYER_TWO = "Peter";
    public static final String ANY_PLAYER = "Erik";

    // TODO minor duplication in all Player tests for creating the Players instance.
    private PlayerUI ui = mock(PlayerUI.class);
    private Players players = new Players(ui);

    @Before
    public void addPlayers() {
        players.add(PLAYER_ONE);
        players.add(PLAYER_TWO);
    }

    @Test
    public void shouldAddOnePlayer() {
        assertThat(players.size(), is(2));

        players.add(TestPlayer.named(ANY_PLAYER));

        assertThat(players.size(), is(3));
    }

    @Test(expected = IllegalAccessException.class)
    @Ignore("not implemented")
    public void shouldFailForMoreThanSixPlayers() {
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add(ANY_PLAYER);
        players.add("one too many");
    }
}

Add todo about minor duplication.


package com.example;

public class SimpleCraps implements BettingGame {

	@Override
	public int playGame(int betAmount) {
		// TODO Add your code here. Return the amount the user won (or a negative number if they lost!)

		//To create a die, use:
		Die die = new Die();

		//To roll the die you created, use:
		int rollResult = die.roll();

		//If the result is a draw, return 0:
		return 0;

		//If the result is a win, return betAmount:
		//return betAmount;

		//If the result is a loss, return -betAmount:
		//return -betAmount;
	}

	@Override
	public String getGameName() {
		return "SimpleCraps";
	}

}

package com.example;

public class SimpleCraps implements BettingGame {

	@Override
	public int playGame(int betAmount) {
		// TODO Add your code here. Return the amount the user won (or a negative number if they lost!)

		//To create a die, use:
		//Die die = new Die();

		//To roll the die you created, use:
		//int rollResult = die.roll();

		//If the result is a win, return betAmount:
		//return betAmount;

		//If the result is a loss, return -betAmount:
		//return -betAmount;

		//If the result is a draw, return 0:
		return 0;
	}

	@Override
	public String getGameName() {
		return "SimpleCraps";
	}

}

Comment out a couple of lines


package org.jboss.forge.addon.parser.java.beans;

import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;

import org.jboss.forge.addon.parser.java.facets.JavaSourceFacet;
import org.jboss.forge.addon.parser.java.resources.JavaResource;
import org.jboss.forge.addon.parser.java.resources.JavaResourceVisitor;
import org.jboss.forge.addon.projects.Project;
import org.jboss.forge.addon.resource.visit.VisitContext;
import org.jboss.forge.roaster.model.source.JavaSource;

public class ProjectOperations
{
   public List<JavaResource> getProjectClasses(Project project)
   {
      final List<JavaResource> classes = new ArrayList<>();
      if (project != null)
      {
         project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaResourceVisitor()
         {

            @Override
            public void visit(VisitContext context, JavaResource resource)
            {
               try
               {
                  JavaSource<?> javaType = resource.getJavaType();
                  if (javaType.isClass())
                  {
                     classes.add(resource);
                  }
               }
               catch (FileNotFoundException e)
               {
                  // ignore
               }
            }
         });
      }
      return classes;

   }
}

package org.jboss.forge.addon.parser.java.beans;

import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;

import org.jboss.forge.addon.parser.java.facets.JavaSourceFacet;
import org.jboss.forge.addon.parser.java.resources.JavaResource;
import org.jboss.forge.addon.parser.java.resources.JavaResourceVisitor;
import org.jboss.forge.addon.projects.Project;
import org.jboss.forge.addon.resource.visit.VisitContext;
import org.jboss.forge.roaster.model.source.JavaSource;

/**
 * @author Lincoln Baxter, III
 */
public class ProjectOperations
{
   public List<JavaResource> getProjectClasses(Project project)
   {
      final List<JavaResource> classes = new ArrayList<>();
      if (project != null)
      {
         project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaClassSourceVisitor(classes));
      }
      return classes;
   }

   private static class JavaClassSourceVisitor extends JavaResourceVisitor
   {
      private final List<JavaResource> classes;

      private JavaClassSourceVisitor(List<JavaResource> classes)
      {
         this.classes = classes;
      }

      @Override
      public void visit(VisitContext context, JavaResource resource)
      {
         try
         {
            JavaSource<?> javaType = resource.getJavaType();
            if (javaType.isClass())
            {
               classes.add(resource);
            }
         }
         catch (FileNotFoundException e)
         {
            // ignore
         }
      }
   }
}

Fix CDI explosions. Weld doesn't like Anonmymous classes sometimes for some reason?


/*
 * Copyright 2008-2013 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        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.broadleafcommerce.common.presentation.client;

/**
 *
 * @author jfischer
 *
 */
public enum SupportedFieldType {
    UNKNOWN,
    ID,
    BOOLEAN,
    DATE,
    INTEGER,
    DECIMAL,
    STRING,
    PASSWORD,
    PASSWORD_CONFIRM,
    EMAIL,
    FOREIGN_KEY,
    ADDITIONAL_FOREIGN_KEY,
    MONEY,
    BROADLEAF_ENUMERATION,
    EXPLICIT_ENUMERATION,
    EMPTY_ENUMERATION,
    DATA_DRIVEN_ENUMERATION,
    HTML,
    HTML_BASIC,
    UPLOAD,
    HIDDEN,
    ASSET_URL,
    ASSET_LOOKUP,
    MEDIA,
    RULE_SIMPLE,
    RULE_WITH_QUANTITY,
    STRING_LIST,
    IMAGE
}

/*
 * Copyright 2008-2013 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        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.broadleafcommerce.common.presentation.client;

/**
 *
 * @author jfischer
 *
 */
public enum SupportedFieldType {
    UNKNOWN,
    ID,
    BOOLEAN,
    DATE,
    INTEGER,
    DECIMAL,
    STRING,
    PASSWORD,
    PASSWORD_CONFIRM,
    EMAIL,
    FOREIGN_KEY,
    ADDITIONAL_FOREIGN_KEY,
    MONEY,
    BROADLEAF_ENUMERATION,
    EXPLICIT_ENUMERATION,
    EMPTY_ENUMERATION,
    DATA_DRIVEN_ENUMERATION,
    HTML,
    HTML_BASIC,
    UPLOAD,
    HIDDEN,
    ASSET_URL,
    ASSET_LOOKUP,
    MEDIA,
    RULE_SIMPLE,
    RULE_WITH_QUANTITY,
    STRING_LIST,
    IMAGE,
    COLOR
}

Add COLOR as an available field type


package info.u_team.u_team_test.data.provider;

import info.u_team.u_team_core.data.*;
import info.u_team.u_team_test.init.*;

public class TestItemModelsProvider extends CommonItemModelsProvider {

	public TestItemModelsProvider(GenerationData data) {
		super(data);
	}

	@Override
	protected void registerModels() {
		// Items
		simpleGenerated(TestItems.BASIC.get());
		simpleGenerated(TestItems.BASIC_FOOD.get());
		simpleGenerated(TestItems.BETTER_ENDERPEARL.get());
		iterateItems(TestItems.BASIC_TOOL, this::simpleHandheld);
		iterateItems(TestItems.BASIC_ARMOR, this::simpleGenerated);
		// Blocks
		simpleBlock(TestBlocks.BASIC.get());
		simpleBlock(TestBlocks.BASIC_TILEENTITY.get());
		simpleBlock(TestBlocks.BASIC_ENERGY_CREATOR.get());
		simpleBlock(TestBlocks.BASIC_FLUID_INVENTORY.get());
	}

}

package info.u_team.u_team_test.data.provider;

import info.u_team.u_team_core.data.*;
import info.u_team.u_team_test.init.*;

public class TestItemModelsProvider extends CommonItemModelsProvider {

	public TestItemModelsProvider(GenerationData data) {
		super(data);
	}

	@Override
	protected void registerModels() {
		// Items
		simpleGenerated(TestItems.BASIC.get());
		simpleGenerated(TestItems.BASIC_FOOD.get());
		simpleGenerated(TestItems.BETTER_ENDERPEARL.get());
		iterateItems(TestItems.BASIC_TOOL, this::simpleHandheld);
		iterateItems(TestItems.BASIC_ARMOR, this::simpleGenerated);
		spawnEgg(TestItems.TEST_LIVING_SPAWN_EGG.get());
		// Blocks
		simpleBlock(TestBlocks.BASIC.get());
		simpleBlock(TestBlocks.BASIC_TILEENTITY.get());
		simpleBlock(TestBlocks.BASIC_ENERGY_CREATOR.get());
		simpleBlock(TestBlocks.BASIC_FLUID_INVENTORY.get());
	}

}

Add generation for spawn egg


package io.doist.recyclerviewext.click_listeners;

import android.support.v7.widget.RecyclerView;
import android.view.View;

public class ClickableViewHolder extends RecyclerView.ViewHolder {
    public ClickableViewHolder(View itemView, OnItemClickListener onItemClickListener,
                               OnItemLongClickListener onItemLongClickListener) {
        super(itemView);

        setClickListeners(onItemClickListener, onItemLongClickListener);
    }

    private void setClickListeners(final OnItemClickListener onItemClickListener,
                                   final OnItemLongClickListener onItemLongClickListener) {
        if (onItemClickListener != null) {
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    onItemClickListener.onItemClick(ClickableViewHolder.this);
                }
            });
        }

        if (onItemLongClickListener != null) {
            itemView.setOnLongClickListener(new View.OnLongClickListener() {
                @Override
                public boolean onLongClick(View v) {
                    onItemLongClickListener.onItemLongClick(ClickableViewHolder.this);
                    return true;
                }
            });
        }
    }
}

package io.doist.recyclerviewext.click_listeners;

import android.support.v7.widget.RecyclerView;
import android.view.View;

public class ClickableViewHolder extends RecyclerView.ViewHolder {
    public ClickableViewHolder(View itemView, OnItemClickListener onItemClickListener) {
        this(itemView, onItemClickListener, null);
    }

    public ClickableViewHolder(View itemView, OnItemClickListener onItemClickListener,
                               OnItemLongClickListener onItemLongClickListener) {
        super(itemView);

        setClickListeners(onItemClickListener, onItemLongClickListener);
    }

    private void setClickListeners(final OnItemClickListener onItemClickListener,
                                   final OnItemLongClickListener onItemLongClickListener) {
        if (onItemClickListener != null) {
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    onItemClickListener.onItemClick(ClickableViewHolder.this);
                }
            });
        }

        if (onItemLongClickListener != null) {
            itemView.setOnLongClickListener(new View.OnLongClickListener() {
                @Override
                public boolean onLongClick(View v) {
                    onItemLongClickListener.onItemLongClick(ClickableViewHolder.this);
                    return true;
                }
            });
        }
    }
}

Add extra constructor for backwards compatibility


package com.example.textmate.sqlite.models;

import java.lang.String;

public class textMateScores {

}

package com.example.textmate.sqlite.models;

import java.lang.String;

public class textMateScores {
    private int id, numUpdate;
    private int numScores = 30;
    private String name;
    private double[] score = new double[numScores];

   //Constructor
   //Empty Constructor
    public textMateScores(){}
    //Base Constructor
    public textMateScores(int id,String name,double[] score, int numUpdate){
        this.id=id;
        this.name=name;
        for(int i=0;i<numScores;i++){
        this.score[i]=0;}
        this.numUpdate=0;
    }

    //Class Methods
    public int fetchID(){return this.id;}
    public void setID(int ID){this.id=ID;}

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

    public int fetchNumUpdate(){return this.numUpdate;}
    public void setNumUpdate(int newNumUpdate){this.numUpdate=newNumUpdate;}

    public double fetchScore(int posScore){return this.score[(this.numUpdate % numScores)];}
    public void setScore(double newScore){
        this.score[this.numUpdate%numScores] = newScore;
        this.setNumUpdate(this.numUpdate+1);
    }

}

Update to Model Class for Database


package test;

import models.ContactDB;
import org.junit.Test;
import static org.fest.assertions.Assertions.assertThat;
import play.mvc.Content;
import static play.test.Helpers.contentType;
import static play.test.Helpers.contentAsString;

/**
 *
 * Simple (JUnit) tests that can call all parts of a play app. If you are interested in mocking a whole application, see
 * the wiki for more details.
 *
 */
public class ApplicationTest {

  /**
   * Illustrates a simple test.
   */
  @Test
  public void simpleCheck() {
    int a = 1 + 1;
    assertThat(a).isEqualTo(2);
  }

  /**
   * Illustrates how to render a template for testing.
   */
  @Test
  public void renderTemplate() {
    Content html = views.html.Index.render(ContactDB.getContacts());
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains("home page");
  }
}

package test;

import org.junit.Test;
import static org.fest.assertions.Assertions.assertThat;
import play.mvc.Content;
import static play.test.Helpers.contentType;
import static play.test.Helpers.contentAsString;

/**
 *
 * Simple (JUnit) tests that can call all parts of a play app. If you are interested in mocking a whole application, see
 * the wiki for more details.
 *
 */
public class ApplicationTest {

  /**
   * Illustrates a simple test.
   */
  @Test
  public void simpleCheck() {
    int a = 1 + 1;
    assertThat(a).isEqualTo(2);
  }

  /**
   * Illustrates how to render a template for testing.
   */
  @Test
  public void renderTemplate() {
    Content html = views.html.Index.render("Welcome to the home page.");
    assertThat(contentType(html)).isEqualTo("text/html");
    assertThat(contentAsString(html)).contains("home page");
  }
}

Revert "Fixed error in test package."


package dev.nincodedo.ninbot.components.reaction;

import lombok.Data;
import lombok.NoArgsConstructor;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageChannel;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;

import java.util.List;

@NoArgsConstructor
@Data
abstract class ReactionResponse {

    protected String response;
    protected String target;
    protected List<String> responses;
    protected ReactionMatchType reactionMatchType;

    public ReactionResponse(ReactionResponse reactionResponse) {
        this.response = reactionResponse.response;
        this.target = reactionResponse.target;
        this.responses = reactionResponse.responses;
        this.reactionMatchType = reactionResponse.reactionMatchType;
    }

    abstract void react(Message message, MessageChannel channel);

    boolean canRespond(MessageReceivedEvent event) {
        return switch (reactionMatchType) {
            case EXACT -> getTarget()
                    .equalsIgnoreCase(event.getMessage().getContentStripped());
            case CONTAINS -> event.getMessage()
                    .getContentStripped()
                    .toLowerCase()
                    .contains(getTarget()
                            .toLowerCase());
            case REGEX -> event.getMessage().getContentStripped().matches(getTarget());
        };
    }
}

package dev.nincodedo.ninbot.components.reaction;

import lombok.Data;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageChannel;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;

import java.util.List;

@Data
class ReactionResponse {

    protected String response;
    protected String target;
    protected List<String> responses;
    protected ReactionMatchType reactionMatchType;

    public ReactionResponse() {
    }

    public ReactionResponse(ReactionResponse reactionResponse) {
        this.response = reactionResponse.response;
        this.target = reactionResponse.target;
        this.responses = reactionResponse.responses;
        this.reactionMatchType = reactionResponse.reactionMatchType;
    }

    void react(Message message, MessageChannel channel) {
        //NO-OP
    }

    boolean canRespond(MessageReceivedEvent event) {
        return switch (reactionMatchType) {
            case EXACT -> getTarget()
                    .equalsIgnoreCase(event.getMessage().getContentStripped());
            case CONTAINS -> event.getMessage()
                    .getContentStripped()
                    .toLowerCase()
                    .contains(getTarget()
                            .toLowerCase());
            case REGEX -> event.getMessage().getContentStripped().matches(getTarget());
        };
    }
}

Fix loading issue for reactions


/* This file is part of VoltDB.
 * Copyright (C) 2008-2017 VoltDB Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

/**
 * A fake use case intended for use verifying that 'voltdb init --classes' works with non-trivial use cases.
 * The theme is querying translations for 'Hello' in different languages.
 */
package fakeusecase.greetings;

/* This file is part of VoltDB.
 * Copyright (C) 2008-2017 VoltDB Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

/**
 * A fake use case intended for use verifying that 'voltdb init --classes' works with non-trivial use cases.
 * The theme is querying translations for 'Hello' in different languages.
 */
package org.voltdb_testprocs.fakeusecase.greetings;

Fix package name to keep Eclipse happy.


package net.ceos.project.poi.annotated.core;

import java.lang.annotation.Annotation;

import net.ceos.project.poi.annotated.annotation.XlsElement;
import net.ceos.project.poi.annotated.annotation.XlsFreeElement;

public interface XlsElementFactory {

	static XlsElement build(XlsFreeElement xlsAnnotation) {
		return new XlsElement() {

			@Override
			public Class<? extends Annotation> annotationType() {
				return xlsAnnotation.annotationType();
			}

			@Override
			public String transformMask() {
				return xlsAnnotation.transformMask();
			}

			@Override
			public String title() {
				return xlsAnnotation.title();
			}

			@Override
			public int position() {
				return 0;
			}

			@Override
			public boolean isFormula() {
				return xlsAnnotation.isFormula();
			}

			@Override
			public String formula() {
				return xlsAnnotation.formula();
			}

			@Override
			public String formatMask() {
				return xlsAnnotation.formatMask();
			}

			@Override
			public String decorator() {
				return xlsAnnotation.decorator();
			}

			@Override
			public String customizedRules() {
				return xlsAnnotation.customizedRules();
			}

			@Override
			public String comment() {
				return xlsAnnotation.comment();
			}

			@Override
			public String commentRules() {
				return "";
			}
		};
	}
}

package net.ceos.project.poi.annotated.core;

import java.lang.annotation.Annotation;

import net.ceos.project.poi.annotated.annotation.XlsElement;
import net.ceos.project.poi.annotated.annotation.XlsFreeElement;

public interface XlsElementFactory {

	static XlsElement build(XlsFreeElement xlsAnnotation) {
		return new XlsElement() {

			@Override
			public Class<? extends Annotation> annotationType() {
				return xlsAnnotation.annotationType();
			}

			@Override
			public String transformMask() {
				return xlsAnnotation.transformMask();
			}

			@Override
			public String title() {
				return xlsAnnotation.title();
			}

			@Override
			public int position() {
				return 0;
			}

			@Override
			public boolean isFormula() {
				return xlsAnnotation.isFormula();
			}

			@Override
			public String formula() {
				return xlsAnnotation.formula();
			}

			@Override
			public String formatMask() {
				return xlsAnnotation.formatMask();
			}

			@Override
			public String decorator() {
				return xlsAnnotation.decorator();
			}

			@Override
			public String customizedRules() {
				return xlsAnnotation.customizedRules();
			}

			@Override
			public String comment() {
				return xlsAnnotation.comment();
			}

			@Override
			public String commentRules() {
				return xlsAnnotation.commentRules();
			}
		};
	}
}

Add the commentRules to the factory


package com.insightfullogic.lambdabehave.expectations;

import org.hamcrest.Matcher;
import org.hamcrest.Matchers;

import static org.junit.Assert.assertThat;

/**
 * .
 */
public final class StringExpectation extends BoundExpectation<String> {
    public StringExpectation(final String str, final boolean positive) {
        super(str, positive);
    }

    public StringExpectation isEmptyString() {
        return matches(Matchers.isEmptyString());
    }

    public StringExpectation isEmptyOrNullString() {
        return matches(Matchers.isEmptyOrNullString());
    }

    public StringExpectation equalToIgnoringCase(final String expectedString) {
        return matches(Matchers.equalToIgnoringCase(expectedString));
    }

    public StringExpectation equalToIgnoringWhiteSpace(final String expectedString) {
        return matches(Matchers.equalToIgnoringWhiteSpace(expectedString));
    }

    public StringExpectation containsString(final String substring) {
        return matches(Matchers.containsString(substring));
    }

    public StringExpectation endsWith(final String suffix) {
        return matches(Matchers.endsWith(suffix));
    }

    public StringExpectation startsWith(final String prefix) {
        return matches(Matchers.startsWith(prefix));
    }

    private StringExpectation matches(final Matcher<String> matcher) {
        assertThat(objectUnderTest, matcher);
        return this;
    }
}

package com.insightfullogic.lambdabehave.expectations;

import org.hamcrest.Matcher;
import org.hamcrest.Matchers;

import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

/**
 * .
 */
public final class StringExpectation extends BoundExpectation<String> {
    public StringExpectation(final String str, final boolean positive) {
        super(str, positive);
    }

    public StringExpectation isEmptyString() {
        return matches(Matchers.isEmptyString());
    }

    public StringExpectation isEmptyOrNullString() {
        return matches(Matchers.isEmptyOrNullString());
    }

    public StringExpectation equalToIgnoringCase(final String expectedString) {
        return matches(Matchers.equalToIgnoringCase(expectedString));
    }

    public StringExpectation equalToIgnoringWhiteSpace(final String expectedString) {
        return matches(Matchers.equalToIgnoringWhiteSpace(expectedString));
    }

    public StringExpectation containsString(final String substring) {
        return matches(Matchers.containsString(substring));
    }

    public StringExpectation endsWith(final String suffix) {
        return matches(Matchers.endsWith(suffix));
    }

    public StringExpectation startsWith(final String prefix) {
        return matches(Matchers.startsWith(prefix));
    }

    private StringExpectation matches(final Matcher<String> matcher) {
        assertThat(objectUnderTest, matcher);
        return this;
    }

    public StringExpectation matches(String regex) {
        assertTrue(objectUnderTest.matches(regex));
        return this;
    }

}

Add method to check if a string matches a regular expression


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.opentransport.rdfmapper.nmbs;

import java.net.URL;

import com.google.transit.realtime.GtfsRealtime.FeedEntity;
import com.google.transit.realtime.GtfsRealtime.FeedMessage;

/**
 *
 * @author timtijssens
 */
public class GtfsRealtimeExample {

    public GtfsRealtimeExample(String filename) throws Exception {
        System.out.println("Testing Real Time Example");
        URL url = new URL("http://localhost:8000/" +filename);
        FeedMessage feed = FeedMessage.parseFrom(url.openStream());
        for (FeedEntity entity : feed.getEntityList()) {
          if (entity.hasTripUpdate()) {
            System.out.println(entity.getTripUpdate());
          }
            if (entity.hasAlert()) {
                System.out.println(entity.getAlert());

            }
        }
      }

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.opentransport.rdfmapper.nmbs;

import java.net.URL;

import com.google.transit.realtime.GtfsRealtime.FeedEntity;
import com.google.transit.realtime.GtfsRealtime.FeedMessage;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 *
 * @author timtijssens
 */
public class GtfsRealtimeExample {

    public GtfsRealtimeExample(String filename) throws Exception {
        System.out.println("Testing Real Time Example");

        InputStream is;

        try {
            is = new FileInputStream(filename);
            FeedMessage feed = FeedMessage.parseFrom(is);

            for (FeedEntity entity : feed.getEntityList()) {
              if (entity.hasTripUpdate()) {
                System.out.println(entity.getTripUpdate());
              }
                if (entity.hasAlert()) {
                    System.out.println(entity.getAlert());
                }
            }
            is.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
      }
}

Test your fresh generated trip_updates.pb and service_alerts.pb locally


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

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Noam Y. Tenne
 */
public class GvmOptions {

    private final Set<GvmOption> options;

    public GvmOptions(GvmOption[] gvmOptions) {
        options = new HashSet<>();
        Collections.addAll(options, gvmOptions);
    }

    public boolean isInstall() {
        return options.contains(GvmOption.INSTALL);
    }

    public boolean isDefault() {
        return options.contains(GvmOption.DEFAULT);
    }

    public boolean isOffline() {
        return options.contains(GvmOption.OFFLINE);
    }
}

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

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Noam Y. Tenne
 */
public class GvmOptions {

    private final Set<GvmOption> options;

    public GvmOptions(GvmOption...gvmOptions) {
        options = new HashSet<>();
        Collections.addAll(options, gvmOptions);
    }

    public boolean isInstall() {
        return options.contains(GvmOption.INSTALL);
    }

    public boolean isDefault() {
        return options.contains(GvmOption.DEFAULT);
    }

    public boolean isOffline() {
        return options.contains(GvmOption.OFFLINE);
    }
}

Use a varargs constructor instead of an array for the GVM Options


/*
 * Copyright 2013 Harald Wellmann
 *
 *  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.ops4j.pax.exam.sample1.repo;

import java.util.List;

import org.apache.deltaspike.data.api.EntityRepository;
import org.apache.deltaspike.data.api.Repository;
import org.ops4j.pax.exam.sample1.model.Book;

@Repository
public interface BookRepository extends EntityRepository<Book, Integer>{

    List<Book> findByTitle(String title);

}

/*
 * Copyright 2013 Harald Wellmann
 *
 *  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.ops4j.pax.exam.sample1.repo;

import java.util.List;

import org.apache.deltaspike.data.api.EntityRepository;
import org.apache.deltaspike.data.api.Repository;
import org.ops4j.pax.exam.sample1.model.Book;

@Repository
public interface BookRepository extends EntityRepository<Book, Integer> {

    List<Book> findByTitle(String title);

}

Fix '{' is not preceded with whitespace checkstyle warning


package water.webserver.iface;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * Finds implementation of {@link HttpServerFacade} found on the classpath.
 * There must be exactly one present.
 */
public class HttpServerLoader {
  public static final HttpServerFacade INSTANCE;
  static {
    final ServiceLoader<HttpServerFacade> serviceLoader = ServiceLoader.load(HttpServerFacade.class);
    final Iterator<HttpServerFacade> iter = serviceLoader.iterator();
    if (! iter.hasNext()) {
      throw new IllegalStateException("No implementation of HttpServerFacade found on classpath");
    }
    INSTANCE = iter.next();
    if (iter.hasNext()) {
      final StringBuilder sb = new StringBuilder(INSTANCE.getClass().getName());
      while (iter.hasNext()) {
        sb.append(",");
        sb.append(iter.next().getClass().getName());
      }
      throw new IllegalStateException("Multiple implementations of HttpServerFacade found on classpath: " + sb);
    }
  }
}

package water.webserver.iface;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * Finds implementation of {@link HttpServerFacade} found on the classpath.
 * There must be exactly one present.
 */
public class HttpServerLoader {
  public static final HttpServerFacade INSTANCE;
  static {
    final ServiceLoader<HttpServerFacade> serviceLoader = ServiceLoader.load(HttpServerFacade.class);
    final Iterator<HttpServerFacade> iter = serviceLoader.iterator();
    if (! iter.hasNext()) {
      throw new IllegalStateException("HTTP Server cannot be loaded: No implementation of HttpServerFacade found on classpath. Please refer to https://0xdata.atlassian.net/browse/TN-13 for details.");
    }
    INSTANCE = iter.next();
    if (iter.hasNext()) {
      final StringBuilder sb = new StringBuilder(INSTANCE.getClass().getName());
      while (iter.hasNext()) {
        sb.append(", ");
        sb.append(iter.next().getClass().getName());
      }
      throw new IllegalStateException("HTTP Server cannot be loaded: Multiple implementations of HttpServerFacade found on classpath: " + sb + ". Please refer to https://0xdata.atlassian.net/browse/TN-13 for details.");
    }
  }
}

Add a technote explaining what to do when Jetty is missing


package com.gurkensalat.osm.repository;

import com.gurkensalat.osm.entity.LinkedPlace;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

@RepositoryRestResource(collectionResourceRel = "linkedPlace", path = "linkedPlace")
public interface LinkedPlaceRepository extends PagingAndSortingRepository<LinkedPlace, Long>
{
    LinkedPlace findByOsmId(@Param("osm_id") String osmId);

    LinkedPlace findByDitibCode(@Param("D_CODE") String ditibCode);
}

package com.gurkensalat.osm.repository;

import com.gurkensalat.osm.entity.LinkedPlace;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

@RepositoryRestResource(collectionResourceRel = "linkedPlace", path = "linkedPlace")
public interface LinkedPlaceRepository extends PagingAndSortingRepository<LinkedPlace, Long>
{
    LinkedPlace findByOsmId(@Param("OSM_ID") String osmId);

    LinkedPlace findByDitibCode(@Param("DITIB_CODE") String ditibCode);
}

Clean up schema a bit


package org.realityforge.replicant.client.json.gwt;

import org.realityforge.gwt.propertysource.client.PropertySource;
import org.realityforge.gwt.propertysource.client.annotations.Namespace;
import org.realityforge.gwt.propertysource.client.annotations.Property;

@Namespace("replicant")
public interface ReplicantConfig
  extends PropertySource
{
  @Property( "shouldValidateRepositoryOnLoad" )
  boolean shouldValidateRepositoryOnLoad();
}

package org.realityforge.replicant.client.json.gwt;

import org.realityforge.gwt.propertysource.client.PropertySource;
import org.realityforge.gwt.propertysource.client.annotations.Namespace;

@Namespace("replicant")
public interface ReplicantConfig
  extends PropertySource
{
  boolean shouldValidateRepositoryOnLoad();
}

Remove unnecessary annotation as it matches the method name


package im.actor.core.js.entity;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;

import org.timepedia.exporter.client.Export;
import org.timepedia.exporter.client.ExportClosure;
import org.timepedia.exporter.client.Exportable;

@Export
@ExportClosure
public interface JsMessagesBindClosure extends Exportable {
    void onBind(JsArray<JsMessage> array,
                JsArray<JavaScriptObject> overlays,
                boolean isLoaded,
                Double receiveDate,
                Double readDate);
}

package im.actor.core.js.entity;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;

import org.timepedia.exporter.client.Export;
import org.timepedia.exporter.client.ExportClosure;
import org.timepedia.exporter.client.Exportable;

@Export
@ExportClosure
public interface JsMessagesBindClosure extends Exportable {
    void onBind(JsArray<JsMessage> array,
                JsArray<JavaScriptObject> overlays,
                boolean isLoaded,
                double receiveDate,
                double readDate);
}

Fix messages binding date boxing


package basearch.integration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.thymeleaf.spring4.view.ThymeleafViewResolver;
import org.thymeleaf.templateresolver.ServletContextTemplateResolver;

@Configuration
public class ThymeleafConfiguration {

	@Bean
	public ServletContextTemplateResolver templateResolver() {
		ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
		resolver.setPrefix("/WEB-INF/thymeleaf");
		resolver.setTemplateMode("HTML5");
		return resolver;
	}

	@Bean
	public SpringSecurityDialect springSecurityDialect() {
		return new SpringSecurityDialect();
	}

	@Bean
	public SpringTemplateEngine templateEngine() {
		SpringTemplateEngine templateEngine = new SpringTemplateEngine();
		templateEngine.setTemplateResolver(templateResolver());
		templateEngine.addDialect(springSecurityDialect());
		return templateEngine;
	}

	@Bean
	public ThymeleafViewResolver viewResolver() {
		ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
		viewResolver.setTemplateEngine(templateEngine());
		viewResolver.setOrder(1);
		viewResolver.setViewNames(new String[] {"*.html"});
		return viewResolver;
	}

}

package basearch.integration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.thymeleaf.spring4.view.ThymeleafViewResolver;
import org.thymeleaf.templateresolver.ServletContextTemplateResolver;

@Configuration
public class ThymeleafConfiguration {

	@Bean
	public ServletContextTemplateResolver templateResolver() {
		ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
		resolver.setPrefix("/WEB-INF/thymeleaf");
		resolver.setTemplateMode("HTML5");
		resolver.setCacheable(false);
		return resolver;
	}

	@Bean
	public SpringSecurityDialect springSecurityDialect() {
		return new SpringSecurityDialect();
	}

	@Bean
	public SpringTemplateEngine templateEngine() {
		SpringTemplateEngine templateEngine = new SpringTemplateEngine();
		templateEngine.setTemplateResolver(templateResolver());
		templateEngine.addDialect(springSecurityDialect());
		return templateEngine;
	}

	@Bean
	public ThymeleafViewResolver viewResolver() {
		ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
		viewResolver.setTemplateEngine(templateEngine());
		viewResolver.setOrder(1);
		viewResolver.setViewNames(new String[] {"*.html"});
		return viewResolver;
	}

}

Make thymeleaf templates not cacheable, to ease jetty redeploys


package org.javarosa.core.model.instance.utils;

import org.javarosa.core.model.instance.FormInstance;
import org.javarosa.core.model.instance.TreeElement;
import org.javarosa.xml.ElementParser;
import org.javarosa.xml.TreeElementParser;
import org.javarosa.xml.util.InvalidStructureException;
import org.javarosa.xml.util.UnfullfilledRequirementsException;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.io.InputStream;

/**
 * Collection of static form loading methods
 *
 * @author Phillip Mates
 */
public class FormLoadingUtils {

    public static FormInstance loadFormInstance(String formFilepath)
            throws InvalidStructureException, IOException {
        TreeElement root = xmlToTreeElement(formFilepath);

        return new FormInstance(root, null);
    }

    public static TreeElement xmlToTreeElement(String xmlFilepath)
            throws InvalidStructureException, IOException {
        InputStream is = System.class.getResourceAsStream(xmlFilepath);
        TreeElementParser parser = new TreeElementParser(ElementParser.instantiateParser(is), 0, "instance");

        try {
            return parser.parse();
        } catch (XmlPullParserException e) {
            throw new IOException(e.getMessage());
        } catch (UnfullfilledRequirementsException e) {
            throw new IOException(e.getMessage());
        }
    }
}

package org.javarosa.core.model.instance.utils;

import org.javarosa.core.model.instance.FormInstance;
import org.javarosa.core.model.instance.TreeElement;
import org.javarosa.xml.ElementParser;
import org.javarosa.xml.TreeElementParser;
import org.javarosa.xml.util.InvalidStructureException;
import org.javarosa.xml.util.UnfullfilledRequirementsException;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.io.InputStream;

/**
 * Collection of static form loading methods
 *
 * @author Phillip Mates
 */
public class FormLoadingUtils {

    public static FormInstance loadFormInstance(String formFilepath)
            throws InvalidStructureException, IOException {
        TreeElement root = xmlToTreeElement(formFilepath);

        return new FormInstance(root, null);
    }

    public static TreeElement xmlToTreeElement(String xmlFilepath)
            throws InvalidStructureException, IOException {
        InputStream is = FormLoadingUtils.class.getResourceAsStream(xmlFilepath);
        TreeElementParser parser = new TreeElementParser(ElementParser.instantiateParser(is), 0, "instance");

        try {
            return parser.parse();
        } catch (XmlPullParserException e) {
            throw new IOException(e.getMessage());
        } catch (UnfullfilledRequirementsException e) {
            throw new IOException(e.getMessage());
        }
    }
}

Fix resource loading on android


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

import org.eclipse.kapua.model.xml.ObjectTypeXmlAdapter;

public class MetricTypeXmlAdapter extends ObjectTypeXmlAdapter {

    private static final String TYPE_BASE_64_BINARY = "base64binary";

    @Override
    public String marshal(Class<?> clazz) {

        String value;
        if (clazz == byte[].class) {
            value = TYPE_BASE_64_BINARY;
        } else {
            value = super.marshal(clazz);
        }

        return value;
    }

    @Override
    public Class<?> unmarshal(String value) throws ClassNotFoundException {
        Class<?> clazz;
        if (TYPE_BASE_64_BINARY.equals(value)) {
            clazz = byte[].class;
        } else {
            clazz = super.unmarshal(value);
        }
        return clazz;
    }
}

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

import org.eclipse.kapua.model.xml.ObjectTypeXmlAdapter;

/**
 * XML Adapter from metric type. <br>
 * This adapter extends {@link ObjectTypeXmlAdapter} and serialize/deserialize in a different way the
 * {@link Byte}[] metric type.
 *
 * This is because Kapua uses Base64 encoding of binary data.
 *
 * @since 1.0.0
 */
public class MetricTypeXmlAdapter extends ObjectTypeXmlAdapter {

    private static final String TYPE_BASE_64_BINARY = "base64binary";

    @Override
    public String marshal(Class<?> clazz) {

        String value;
        if (clazz == byte[].class) {
            value = TYPE_BASE_64_BINARY;
        } else {
            value = super.marshal(clazz);
        }

        return value;
    }

    @Override
    public Class<?> unmarshal(String value) throws ClassNotFoundException {
        Class<?> clazz;
        if (TYPE_BASE_64_BINARY.equals(value)) {
            clazz = byte[].class;
        } else {
            clazz = super.unmarshal(value);
        }
        return clazz;
    }
}

Clean up and applyed code formatting


package com.novoda.downloadmanager.lib;

import android.provider.BaseColumns;

/**
 * Constants related to HTTP request headers associated with each download.
 */
public class DownloadsColumnsRequestHeaders implements BaseColumns {
    public static final String HEADERS_DB_TABLE = "request_headers";
    public static final String COLUMN_DOWNLOAD_ID = "download_id";
    public static final String COLUMN_HEADER = "header";
    public static final String COLUMN_VALUE = "value";

    /**
     * Path segment to add to a download URI to retrieve request headers
     */
    public static final String URI_SEGMENT = "headers";

    /**
     * Prefix for ContentValues keys that contain HTTP header lines, to be passed to
     * DownloadProvider.insert().
     */
    public static final String INSERT_KEY_PREFIX = "http_header_";
}

package com.novoda.downloadmanager.lib;

import android.provider.BaseColumns;

/**
 * Constants related to HTTP request headers associated with each download.
 */
public final class DownloadsColumnsRequestHeaders implements BaseColumns {

    public static final String HEADERS_DB_TABLE = "request_headers";
    public static final String COLUMN_DOWNLOAD_ID = "download_id";
    public static final String COLUMN_HEADER = "header";
    public static final String COLUMN_VALUE = "value";

    /**
     * Path segment to add to a download URI to retrieve request headers
     */
    public static final String URI_SEGMENT = "headers";

    /**
     * Prefix for ContentValues keys that contain HTTP header lines, to be passed to
     * DownloadProvider.insert().
     */
    public static final String INSERT_KEY_PREFIX = "http_header_";

    private DownloadsColumnsRequestHeaders() {
        // non-instantiable class
    }
}

Make class final and adds private constructor


package com.intellij.debugger.streams.ui;

import com.intellij.debugger.DebuggerContext;
import com.intellij.debugger.engine.ContextUtil;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.memory.utils.InstanceValueDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiElementFactory;
import com.intellij.psi.PsiExpression;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.Value;
import org.jetbrains.annotations.NotNull;

/**
 * @author Vitaliy.Bibaev
 */
public class PrimitiveValueDescriptor extends InstanceValueDescriptor {
  PrimitiveValueDescriptor(@NotNull Project project, @NotNull Value value) {
    super(project, value);
  }

  @Override
  public String calcValueName() {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.calcValueName();
    }

    return value.type().name();
  }

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

  @Override
  public PsiExpression getDescriptorEvaluation(DebuggerContext debuggerContext) throws EvaluateException {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.getDescriptorEvaluation(debuggerContext);
    }

    final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myProject).getElementFactory();
    return elementFactory.createExpressionFromText("", ContextUtil.getContextElement(debuggerContext));
  }
}

package com.intellij.debugger.streams.ui;

import com.intellij.debugger.DebuggerContext;
import com.intellij.debugger.engine.ContextUtil;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.memory.utils.InstanceValueDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiElementFactory;
import com.intellij.psi.PsiExpression;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.Value;
import org.jetbrains.annotations.NotNull;

/**
 * @author Vitaliy.Bibaev
 */
public class PrimitiveValueDescriptor extends InstanceValueDescriptor {
  PrimitiveValueDescriptor(@NotNull Project project, @NotNull Value value) {
    super(project, value);
  }

  @Override
  public String calcValueName() {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.calcValueName();
    }

    return value.type().name();
  }

  @Override
  public PsiExpression getDescriptorEvaluation(DebuggerContext debuggerContext) throws EvaluateException {
    final Value value = getValue();
    if (value instanceof ObjectReference) {
      return super.getDescriptorEvaluation(debuggerContext);
    }

    final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myProject).getElementFactory();
    return elementFactory.createExpressionFromText("", ContextUtil.getContextElement(debuggerContext));
  }
}

Remove a duplicated label from the collection view


package com.unascribed.correlatedpotentialistics.block.item;

import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;

public class ItemBlockDriveBay extends ItemBlock {

	public ItemBlockDriveBay(Block block) {
		super(block);
	}

	@Override
	public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
		tooltip.add(I18n.format("tooltip.correlatedpotentialistics.rf_usage", 16));
	}

}

package com.unascribed.correlatedpotentialistics.block.item;

import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;

public class ItemBlockDriveBay extends ItemBlock {

	public ItemBlockDriveBay(Block block) {
		super(block);
	}

	@Override
	public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
		tooltip.add(I18n.format("tooltip.correlatedpotentialistics.rf_usage", 8));
	}

}

Fix Drive Bay tooltip saying it uses 16RF/t and not 8RF/t


package com.infinityraider.agricraft.renderers.particles;

//heavily inspired by the OpenBlocks sprinkler
import com.infinityraider.agricraft.utility.BaseIcons;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class LiquidSprayFX extends AgriCraftFX {

    public LiquidSprayFX(World world, double x, double y, double z, float scale, float gravity, Vec3d vector) {
        super(world, x, y, z, scale, gravity, vector, new ResourceLocation(BaseIcons.WATER_STILL.location));
        this.particleMaxAge = 15;
        this.setSize(0.2f, 0.2f);
    }
}

package com.infinityraider.agricraft.renderers.particles;

//heavily inspired by the OpenBlocks sprinkler
import com.infinityraider.agricraft.utility.BaseIcons;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class LiquidSprayFX extends AgriCraftFX {

    public LiquidSprayFX(World world, double x, double y, double z, float scale, float gravity, Vec3d vector) {
        super(world, x, y, z, scale, gravity, vector, new ResourceLocation("minecraft:textures/blocks/water_still.png"));
        this.particleMaxAge = 15;
        this.setSize(0.2f, 0.2f);
    }
}

Fix particle texture causing FileNotFoundException


package de.fau.amos.virtualledger.server;

import org.junit.Assert;
import org.junit.Test;

import javax.ws.rs.core.Response;

public class TestRestProviderTest {
    private final TestRestProvider testRestProvider = new TestRestProvider();

    @Test
    public void helloWorld_noInput_200Status() {
        //arrange
        //act
        final Response result = testRestProvider.helloWorld();
        //assert
        Assert.assertEquals(200, result.getStatus());
    }

    @Test
    public void helloWorld_noInput_helloWorldEntity() {
        //arrange
        //act
        final Response result = testRestProvider.helloWorld();
        //assert
        Assert.assertEquals("Hello World", result.getEntity());
    }
}

package de.fau.amos.virtualledger.server;

import org.junit.Assert;
import org.junit.Test;

import javax.ws.rs.core.Response;

public class TestRestProviderTest {
    private final TestRestProvider testRestProvider = new TestRestProvider();

    @Test
    public void helloWorld_noInput_200Status() {
        //arrange
        //act
        final Response result = testRestProvider.helloWorld();
        //assert
        Assert.assertEquals(200, result.getStatus());
    }

    @Test
    public void helloWorld_noInput_helloWorldEntity() {
        //arrange
        //act
        final Response result = testRestProvider.helloWorld();
        //assert
        Assert.assertEquals("hallo!", result.getEntity());
    }
}

Edit wrong test that make build fail


package com.bazaarvoice.dropwizard.assets;

import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.validation.constraints.NotNull;
import java.util.Map;

public class AssetsConfiguration {

    @NotNull
    @JsonProperty
    private String cacheSpec = ConfiguredAssetsBundle.DEFAULT_CACHE_SPEC.toParsableString();

    @NotNull
    @JsonProperty
    private Map<String, String> overrides = Maps.newHashMap();

    @JsonProperty
    private Map<String, String> mimeTypes = Maps.newHashMap();

    /** The caching specification for how to memoize assets. */
    public String getCacheSpec() {
        return cacheSpec;
    }

    public Iterable<Map.Entry<String, String>> getOverrides() {
        return Iterables.unmodifiableIterable(overrides.entrySet());
    }

    public Iterable<Map.Entry<String, String>> getMimeTypes() {
        return Iterables.unmodifiableIterable(mimeTypes.entrySet());
    }
}

package com.bazaarvoice.dropwizard.assets;

import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.validation.constraints.NotNull;
import java.util.Map;

public class AssetsConfiguration {
    @NotNull
    @JsonProperty
    private String cacheSpec = ConfiguredAssetsBundle.DEFAULT_CACHE_SPEC.toParsableString();

    @NotNull
    @JsonProperty
    private Map<String, String> overrides = Maps.newHashMap();

    @NotNull
    @JsonProperty
    private Map<String, String> mimeTypes = Maps.newHashMap();

    /** The caching specification for how to memoize assets. */
    public String getCacheSpec() {
        return cacheSpec;
    }

    public Iterable<Map.Entry<String, String>> getOverrides() {
        return Iterables.unmodifiableIterable(overrides.entrySet());
    }

    public Iterable<Map.Entry<String, String>> getMimeTypes() {
        return Iterables.unmodifiableIterable(mimeTypes.entrySet());
    }
}

Revert "remove not null constraint"


package io.quarkus.arc.impl;

import io.quarkus.arc.InjectableReferenceProvider;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.InjectionPoint;

/**
 *
 * @author Martin Kouba
 */
public class InjectionPointProvider implements InjectableReferenceProvider<InjectionPoint> {

    private static final ThreadLocal<InjectionPoint> CURRENT = new ThreadLocal<>();

    @Override
    public InjectionPoint get(CreationalContext<InjectionPoint> creationalContext) {
        return CURRENT.get();
    }

    /**
     * Set the current injection point for a non-null parameter, remove the threadlocal for null parameter.
     *
     * @param injectionPoint
     * @return the previous injection point or {@code null}
     */
    static InjectionPoint set(InjectionPoint injectionPoint) {
        if (injectionPoint != null) {
            InjectionPoint prev = InjectionPointProvider.CURRENT.get();
            InjectionPointProvider.CURRENT.set(injectionPoint);
            return prev;
        } else {
            CURRENT.remove();
            return null;
        }
    }

    public static InjectionPoint get() {
        return CURRENT.get();
    }

}

package io.quarkus.arc.impl;

import io.quarkus.arc.InjectableReferenceProvider;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.InjectionPoint;

/**
 *
 * @author Martin Kouba
 */
public class InjectionPointProvider implements InjectableReferenceProvider<InjectionPoint> {

    private static final ThreadLocal<InjectionPoint> CURRENT = new ThreadLocal<>();

    @Override
    public InjectionPoint get(CreationalContext<InjectionPoint> creationalContext) {
        return CURRENT.get();
    }

    /**
     * Set the current injection point for a non-null parameter, remove the threadlocal for null parameter.
     *
     * @param injectionPoint
     * @return the previous injection point or {@code null}
     */
    static InjectionPoint set(InjectionPoint injectionPoint) {
        if (injectionPoint != null) {
            InjectionPoint prev = InjectionPointProvider.CURRENT.get();
            if (injectionPoint.equals(prev)) {
                return injectionPoint;
            } else {
                InjectionPointProvider.CURRENT.set(injectionPoint);
                return prev;
            }
        } else {
            CURRENT.remove();
            return null;
        }
    }

    public static InjectionPoint get() {
        return CURRENT.get();
    }

}

Check to see if injection point is same as current thread local value


/*
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch 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.elasticsearch.search.aggregations.bucket;

import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder;

public class FilterTests extends BaseAggregationTestCase<FilterAggregationBuilder> {

    @Override
    protected FilterAggregationBuilder createTestAggregatorBuilder() {
        FilterAggregationBuilder factory = new FilterAggregationBuilder(randomAlphaOfLengthBetween(1, 20),
                QueryBuilders.termQuery(randomAlphaOfLengthBetween(5, 20), randomAlphaOfLengthBetween(5, 20)));
        // NORELEASE make RandomQueryBuilder work outside of the
        // AbstractQueryTestCase
        // builder.query(RandomQueryBuilder.createQuery(getRandom()));
        return factory;
    }

}

/*
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch 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.elasticsearch.search.aggregations.bucket;

import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder;

public class FilterTests extends BaseAggregationTestCase<FilterAggregationBuilder> {

    @Override
    protected FilterAggregationBuilder createTestAggregatorBuilder() {
        return new FilterAggregationBuilder(randomAlphaOfLengthBetween(1, 20),
                QueryBuilders.termQuery(randomAlphaOfLengthBetween(5, 20), randomAlphaOfLengthBetween(5, 20)));
    }

}

Remove old norelease comment, the test is okay as it is


package org.realityforge.arez.annotations;

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

/**
 * Methods marked with this annotation are computed values within Arez.
 *
 *
The method should take zero parameters and return a single value. The value
 * should be derived from other {@link org.realityforge.arez.Observable}s
 * within the Arez system and the value returned by the method should not change
 * unless the state of the other Observables changes. The method should NOT modify
 * other state in the system.

 *
 *
The computed method is automatically wrapped in a READ_ONLY transaction
 * by the annotation parser.

 */
@Retention( RetentionPolicy.CLASS )
@Target( ElementType.METHOD )
public @interface Computed
{
}

package org.realityforge.arez.annotations;

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

/**
 * Methods marked with this annotation are computed values within Arez.
 *
 *
The method should take zero parameters and return a single value. The value
 * should be derived from other Observables within the Arez system and the value
 * returned by the method should not change unless the state of the other Observables
 * changes. The method should NOT modify other state in the system.

 *
 *
The computed method is automatically wrapped in a READ_ONLY transaction
 * by the annotation parser.

 */
@Retention( RetentionPolicy.CLASS )
@Target( ElementType.METHOD )
public @interface Computed
{
}

Fix javadocs cross link as Observable is not present locally


package net.kencochrane.raven.sentrystub.event.interfaces;

import com.fasterxml.jackson.annotation.JsonProperty;

public class ExceptionInterface {
    @JsonProperty(value = "type")
    private String type;
    @JsonProperty(value = "value")
    private String value;
    @JsonProperty(value = "module")
    private String module;
}

package net.kencochrane.raven.sentrystub.event.interfaces;

import com.fasterxml.jackson.annotation.JsonProperty;

public class ExceptionInterface {
    @JsonProperty(value = "type")
    private String type;
    @JsonProperty(value = "value")
    private String value;
    @JsonProperty(value = "module")
    private String module;
    @JsonProperty(value = "stacktrace")
    private StackTraceInterface stackTraceInterface;
}

Add a stacktrace element to exception


package edu.sdsc.scigraph.owlapi.cases;

import static com.google.common.collect.Iterables.getOnlyElement;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import org.junit.Test;
import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;

import edu.sdsc.scigraph.owlapi.OwlRelationships;

public class TestInferredEdges extends OwlTestCase {

  @Test
  public void testInferredEdges() {
    Node cx = getNode("http://example.org/cx");
    Node dx = getNode("http://example.org/dx");

    Iterable<Relationship> superclasses = dx.getRelationships(OwlRelationships.RDF_SUBCLASS_OF, Direction.OUTGOING);
    Relationship r = getOnlyElement(superclasses);
    assertThat(r.getOtherNode(dx), is(cx));
  }

}

package edu.sdsc.scigraph.owlapi.cases;

import static com.google.common.collect.Iterables.getOnlyElement;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import org.junit.Ignore;
import org.junit.Test;
import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;

import edu.sdsc.scigraph.owlapi.OwlRelationships;

@Ignore
public class TestInferredEdges extends OwlTestCase {

  @Test
  public void testInferredEdges() {
    Node cx = getNode("http://example.org/cx");
    Node dx = getNode("http://example.org/dx");

    Iterable<Relationship> superclasses = dx.getRelationships(OwlRelationships.RDF_SUBCLASS_OF, Direction.OUTGOING);
    Relationship r = getOnlyElement(superclasses);
    assertThat(r.getOtherNode(dx), is(cx));
  }

}

Add direct inferred edges as part of loading SciGraph


package uk.ac.ic.wlgitbridge.bridge.db.sqlite.query;

import uk.ac.ic.wlgitbridge.bridge.db.sqlite.SQLQuery;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by winston on 23/08/2016.
 */
public class GetOldestProjectName implements SQLQuery<String> {

    private static final String GET_OLDEST_PROJECT_NAME =
            "SELECT `name`, MIN(`last_accessed`)\n" +
            "    FROM `projects`";

    @Override
    public String getSQL() {
        return GET_OLDEST_PROJECT_NAME;
    }

    @Override
    public String processResultSet(ResultSet resultSet) throws SQLException {
        while (resultSet.next()) {
            return resultSet.getString("name");
        }
        return null;
    }

}

package uk.ac.ic.wlgitbridge.bridge.db.sqlite.query;

import uk.ac.ic.wlgitbridge.bridge.db.sqlite.SQLQuery;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by winston on 23/08/2016.
 */
public class GetOldestProjectName implements SQLQuery<String> {

    private static final String GET_OLDEST_PROJECT_NAME =
            "SELECT `name`, MIN(`last_accessed`)\n" +
            "    FROM `projects` \n" +
            "    WHERE `last_accessed` IS NOT NULL;";

    @Override
    public String getSQL() {
        return GET_OLDEST_PROJECT_NAME;
    }

    @Override
    public String processResultSet(ResultSet resultSet) throws SQLException {
        while (resultSet.next()) {
            return resultSet.getString("name");
        }
        return null;
    }

}

Fix query for oldest (un-swapped) project


package com.adaptris.core.stubs;

public interface UpgradedToJunit4 {

  // For concrete implementations to override
  default boolean isAnnotatedForJunit4() {
    return false;
  }
}

package com.adaptris.core.stubs;

public interface UpgradedToJunit4 {

  boolean isAnnotatedForJunit4();
}

Remove default method to force compile failures


/**
 *
 */
package org.eclipse.scanning.test.points;

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

import org.eclipse.scanning.api.points.IGenerator;
import org.eclipse.scanning.api.points.IPosition;
import org.eclipse.scanning.api.points.Point;

/**
 * @author fcp94556
 *
 */
class GeneratorUtil {

	/**
	 * Checks the points list vs the iterator
	 * @param gen
	 * @throws Exception
	 */
	public static void testGeneratorPoints(IGenerator<?,?> gen) throws Exception {

		final List ponts = gen.createPoints();
		final List its   = new ArrayList<>(gen.size());
		final Iterator it = gen.iterator();
		while(it.hasNext()) its.add(it.next());

		IPosition[] pnts1 = array(ponts);
		IPosition[] pnts2 = array(ponts);

		if (pnts2.length!=pnts1.length) throw new Exception("Not the same size!");
        for (int i = 0; i < pnts1.length; i++) {
			if (!pnts1[i].equals(pnts2[i])) {
				throw new Exception(pnts1[i]+" does not equal "+pnts2[i]);
			}
		}
 	}

	private static IPosition[] array(List<IPosition> p) {
		return p.toArray(new IPosition[p.size()]);
	}
}

/**
 *
 */
package org.eclipse.scanning.test.points;

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

import org.eclipse.scanning.api.points.IGenerator;
import org.eclipse.scanning.api.points.IPosition;
import org.eclipse.scanning.api.points.Point;

/**
 * @author fcp94556
 *
 */
class GeneratorUtil {

	/**
	 * Checks the points list vs the iterator
	 * @param gen
	 * @throws Exception
	 */
	public static void testGeneratorPoints(IGenerator<?,?> gen) throws Exception {

		final List ponts = gen.createPoints();
		final List its   = new ArrayList<>(gen.size());
		final Iterator it = gen.iterator();
		while(it.hasNext()) its.add(it.next());

		IPosition[] pnts1 = array(ponts);
		IPosition[] pnts2 = array(its);

		if (pnts2.length!=pnts1.length) throw new Exception("Not the same size!");
        for (int i = 0; i < pnts1.length; i++) {
			if (!pnts1[i].equals(pnts2[i])) {
				throw new Exception(pnts1[i]+" does not equal "+pnts2[i]);
			}
		}
 	}

	private static IPosition[] array(List<IPosition> p) {
		return p.toArray(new IPosition[p.size()]);
	}
}

Fix to class used in tests, generates the failures properly!


package com.peterphi.std.guice.common.serviceprops;

import com.google.inject.Provider;
import com.peterphi.std.guice.common.serviceprops.typed.TypedConfigRef;
import org.apache.commons.configuration.Configuration;

public class ConfigRef implements Provider<String>
{
	private final Configuration configuration;
	private final String name;

	public ConfigRef(final Configuration configuration, final String name)
	{
		this.configuration = configuration;
		this.name = name;
	}

	@Override
	public String get()
	{
		return configuration.getString(name);
	}

	public <T> T get(Class<T> clazz)
	{
		return as(clazz).get();
	}

	public <T> TypedConfigRef<T> as(final Class<T> clazz)
	{
		return new TypedConfigRef<>(this, clazz);
	}
}

package com.peterphi.std.guice.common.serviceprops;

import com.google.inject.Provider;
import com.peterphi.std.guice.common.serviceprops.typed.TypedConfigRef;
import org.apache.commons.configuration.Configuration;

import java.util.List;

public class ConfigRef implements Provider<String>
{
	private final Configuration configuration;
	private final String name;

	public ConfigRef(final Configuration configuration, final String name)
	{
		this.configuration = configuration;
		this.name = name;
	}

	@Override
	public String get()
	{
		return configuration.getString(name);
	}

	public String[] getStringArray()
	{
		return configuration.getStringArray(name);
	}

	public List<Object> getList()
	{
		return configuration.getList(name);
	}

	public Object getObject()
	{
		return configuration.getProperty(name);
	}

	public <T> T get(Class<T> clazz)
	{
		return as(clazz).get();
	}

	public <T> TypedConfigRef<T> as(final Class<T> clazz)
	{
		return new TypedConfigRef<>(this, clazz);
	}
}

Add methods to retrieve a string[] as well as the underlying object if needed


package org.stagemonitor.jdbc.p6spy;

import com.p6spy.engine.logging.Category;
import com.p6spy.engine.spy.appender.P6Logger;

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

public class P6SpyMultiLogger implements P6Logger {

	private static List<P6Logger> loggers = new LinkedList<P6Logger>();

	public static void addLogger(P6Logger logger) {
		if (logger != null) {
			loggers.add(logger);
		}
	}

	@Override
	public void logSQL(int connectionId, String now, long elapsed, Category category, String prepared, String sql) {
		for (P6Logger logger : loggers) {
			if (logger.isCategoryEnabled(category)) {
				logger.logSQL(connectionId, now, elapsed, category, prepared, sql);
			}
		}
	}

	@Override
	public void logException(Exception e) {
		for (P6Logger logger : loggers) {
			logger.logException(e);
		}
	}

	@Override
	public void logText(String text) {
		for (P6Logger logger : loggers) {
			logger.logText(text);
		}
	}

	@Override
	public boolean isCategoryEnabled(Category category) {
		boolean result = false;
		for (P6Logger logger : loggers) {
			result |= logger.isCategoryEnabled(category);
		}
		return result;
	}
}

package org.stagemonitor.jdbc.p6spy;

import com.p6spy.engine.logging.Category;
import com.p6spy.engine.spy.appender.P6Logger;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class P6SpyMultiLogger implements P6Logger {

	private static List<P6Logger> loggers = new CopyOnWriteArrayList<>();

	public static void addLogger(P6Logger logger) {
		if (logger != null) {
			loggers.add(logger);
		}
	}

	@Override
	public void logSQL(int connectionId, String now, long elapsed, Category category, String prepared, String sql) {
		for (P6Logger logger : loggers) {
			if (logger.isCategoryEnabled(category)) {
				logger.logSQL(connectionId, now, elapsed, category, prepared, sql);
			}
		}
	}

	@Override
	public void logException(Exception e) {
		for (P6Logger logger : loggers) {
			logger.logException(e);
		}
	}

	@Override
	public void logText(String text) {
		for (P6Logger logger : loggers) {
			logger.logText(text);
		}
	}

	@Override
	public boolean isCategoryEnabled(Category category) {
		boolean result = false;
		for (P6Logger logger : loggers) {
			result |= logger.isCategoryEnabled(category);
		}
		return result;
	}
}

Fix non thread safe list


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

import java.util.List;

/**
 * A java.util.Properties based value. The properties are defined as string to
 * string. This means that the actual value can be returned.
 *
 * Defined in the props element.
 *
 */
public interface PropsMetadata extends NonNullMetadata {

	/**
	 * This is the same as getValuesMetadata but more type safe.
	 *
	 * Defined in prop sub elements.
	 *
	 * @return
	 */
	List/*<MapEntry>*/ getEntries();
}

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

import java.util.List;

/**
 * A java.util.Properties based value. The properties are defined as string to
 * string. This means that the actual value can be returned.
 *
 * Defined in the props element.
 *
 */
public interface PropsMetadata extends NonNullMetadata {

	/**
	 * Defined in prop sub elements.
	 *
	 * @return list of <code.MapEntry objects, never null
	 */
	List/*<MapEntry>*/ getEntries();
}

Comment did not make sense anymore


/*
 * Copyright 2000-2009 JetBrains s.r.o.
 *
 * 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.intellij.xdebugger.impl.actions.handlers;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.project.Project;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XDebuggerManager;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
import org.jetbrains.annotations.NotNull;

/**
 * @author nik
*/
public class XDebuggerPauseActionHandler extends XDebuggerActionHandler {
  @Override
  protected void perform(@NotNull final XDebugSession session, final DataContext dataContext) {
    session.pause();
  }

  @Override
  public boolean isHidden(@NotNull Project project, AnActionEvent event) {
    final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
    return session == null || !((XDebugSessionImpl)session).isPauseActionSupported();
  }

  @Override
  protected boolean isEnabled(@NotNull final XDebugSession session, final DataContext dataContext) {
    assert session instanceof XDebugSessionImpl;
    return ((XDebugSessionImpl)session).isPauseActionSupported() && !session.isPaused();
  }
}

// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xdebugger.impl.actions.handlers;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.project.Project;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XDebuggerManager;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
import org.jetbrains.annotations.NotNull;

/**
 * @author nik
*/
public class XDebuggerPauseActionHandler extends XDebuggerActionHandler {
  @Override
  protected void perform(@NotNull final XDebugSession session, final DataContext dataContext) {
    session.pause();
  }

  @Override
  public boolean isHidden(@NotNull Project project, AnActionEvent event) {
    final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
    return session == null || !((XDebugSessionImpl)session).isPauseActionSupported();
  }

  @Override
  protected boolean isEnabled(@NotNull final XDebugSession session, final DataContext dataContext) {
    return !session.isPaused();
  }
}

Revert "Debugger: fix the "Pause" button status." (see IDEA-227619)


package ch.sheremet.dasfoo.rover.android.client.video;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import ch.sheremet.dasfoo.rover.android.client.R;

/**
 * Created by Katarina Sheremet on 6/7/16 12:00 PM.
 */
public class VideoFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        return inflater.inflate(R.layout.fragment_video, container, false);
    }
}

package ch.sheremet.dasfoo.rover.android.client.video;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import ch.sheremet.dasfoo.rover.android.client.R;

/**
 * Created by Katarina Sheremet on 6/7/16 12:00 PM.
 */
public class VideoFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        return inflater.inflate(R.layout.fragment_video, container, false);
    }

    public void startVideo(View view) {
        //Not implemented yet
        //Todo: add button implementation
    }

    public void stopVideo(View view) {
        //Not implemented yet
        //Todo: add button implementation
    }
}

Add onClick handlers for buttons


package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_1_9_r1__1_9_r2__1_10;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleVehicleMove;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class VehicleMove extends MiddleVehicleMove<RecyclableCollection<ClientBoundPacketData>> {

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData(ProtocolVersion version) {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_VEHICLE_MOVE, version);
		serializer.writeDouble(x);
		serializer.writeDouble(y);
		serializer.writeDouble(y);
		serializer.writeFloat(yaw);
		serializer.writeFloat(pitch);
		return RecyclableSingletonList.create(serializer);
	}

}

package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_1_9_r1__1_9_r2__1_10;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleVehicleMove;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class VehicleMove extends MiddleVehicleMove<RecyclableCollection<ClientBoundPacketData>> {

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData(ProtocolVersion version) {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_VEHICLE_MOVE, version);
		serializer.writeDouble(x);
		serializer.writeDouble(y);
		serializer.writeDouble(z);
		serializer.writeFloat(yaw);
		serializer.writeFloat(pitch);
		return RecyclableSingletonList.create(serializer);
	}

}

Fix vehicle move serializing (still no idea what it does)


package com.veyndan.redditclient.post.media.mutator;

import com.veyndan.redditclient.api.reddit.model.PostHint;
import com.veyndan.redditclient.post.media.model.Text;
import com.veyndan.redditclient.post.model.Post;

import rx.Observable;

final class TextMutatorFactory implements MutatorFactory {

    static TextMutatorFactory create() {
        return new TextMutatorFactory();
    }

    private TextMutatorFactory() {
    }

    @Override
    public Observable<Post> mutate(final Post post) {
        return Observable.just(post)
                .filter(post1 -> post1.getPostHint().equals(PostHint.SELF))
                .map(post1 -> {
                    post1.setMediaObservable(Observable.just(new Text(post1.getBodyHtml())));
                    return post1;
                });
    }
}

package com.veyndan.redditclient.post.media.mutator;

import android.text.TextUtils;

import com.veyndan.redditclient.api.reddit.model.PostHint;
import com.veyndan.redditclient.post.media.model.Text;
import com.veyndan.redditclient.post.model.Post;

import rx.Observable;

final class TextMutatorFactory implements MutatorFactory {

    static TextMutatorFactory create() {
        return new TextMutatorFactory();
    }

    private TextMutatorFactory() {
    }

    @Override
    public Observable<Post> mutate(final Post post) {
        return Observable.just(post)
                .filter(post1 -> post1.getPostHint().equals(PostHint.SELF) &&
                        !TextUtils.isEmpty(post1.getBodyHtml()))
                .map(post1 -> {
                    post1.setMediaObservable(Observable.just(new Text(post1.getBodyHtml())));
                    return post1;
                });
    }
}

Make self posts without text bodies to not have any media adapter delegate


package com.google.errorprone.bugpatterns;

import com.google.errorprone.CompilationTestHelper;

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

import java.io.File;

/**
 * Unit tests for {@link OrderingFrom}.
 *
 * @author sjnickerson@google.com (Simon Nickerson)
 */
public class OrderingFromTest {

  private CompilationTestHelper compilationHelper;

  @Before
  public void setUp() {
    compilationHelper = new CompilationTestHelper(new OrderingFrom.Scanner());
  }

  @Test
  public void testPositiveCase() throws Exception {
    compilationHelper.assertCompileFailsWithMessages(
        new File(this.getClass().getResource("OrderingFromPositiveCases.java").toURI()));
  }

  //@Test
  public void testNegativeCase() throws Exception {
    compilationHelper.assertCompileSucceeds(
        new File(this.getClass().getResource("OrderingFromNegativeCases.java").toURI()));
  }
}

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

package com.google.errorprone.bugpatterns;

import com.google.errorprone.CompilationTestHelper;

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

import java.io.File;

/**
 * Unit tests for {@link OrderingFrom}.
 *
 * @author sjnickerson@google.com (Simon Nickerson)
 */
public class OrderingFromTest {

  private CompilationTestHelper compilationHelper;

  @Before
  public void setUp() {
    compilationHelper = new CompilationTestHelper(new OrderingFrom.Scanner());
  }

  @Test
  public void testPositiveCase() throws Exception {
    compilationHelper.assertCompileFailsWithMessages(
        new File(this.getClass().getResource("OrderingFromPositiveCases.java").toURI()));
  }

  @Test
  public void testNegativeCase() throws Exception {
    compilationHelper.assertCompileSucceeds(
        new File(this.getClass().getResource("OrderingFromNegativeCases.java").toURI()));
  }
}

Enable commented out test for OrderingFrom. (Also add Apache copyright notice)


// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author hmusum
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    @Override
    public void getConfig(ThreadpoolConfig.Builder builder) {
        builder.maxthreads(10);
    }

    @Override
    public void getConfig(QrStartConfig.Builder builder) {
        super.getConfig(builder);
        builder.jvm.heapsize(384);
    }

    protected boolean messageBusEnabled() { return false; }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("http://*/logs");
        addComponent(logHandler);
    }

}

// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author hmusum
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    @Override
    public void getConfig(ThreadpoolConfig.Builder builder) {
        builder.maxthreads(10);
    }

    @Override
    public void getConfig(QrStartConfig.Builder builder) {
        super.getConfig(builder);
        builder.jvm.heapsize(384)
               .verbosegc(true);
    }

    protected boolean messageBusEnabled() { return false; }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("http://*/logs");
        addComponent(logHandler);
    }

}

Use verbose gc logging for logserver-container


/*
 * SPDX-License-Identifier: MIT
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2015-2022 games647 and contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.github.games647.fastlogin.bukkit.listener.protocollib.packet;

import java.security.PublicKey;
import java.time.Instant;

public record ClientPublicKey(Instant expiry, PublicKey key, byte[] signature) {

    public boolean isExpired(Instant verifyTimestamp) {
        return verifyTimestamp.isBefore(expiry);
    }
}

/*
 * SPDX-License-Identifier: MIT
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2015-2022 games647 and contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.github.games647.fastlogin.bukkit.listener.protocollib.packet;

import java.security.PublicKey;
import java.time.Instant;

public record ClientPublicKey(Instant expiry, PublicKey key, byte[] signature) {

    public boolean isExpired(Instant verifyTimestamp) {
        return !verifyTimestamp.isBefore(expiry);
    }
}

Fix public key timestamp verification.