package org.jetbrains.kotlin.android.xmlconverter;

import org.junit.Rule;
import org.junit.rules.TestName;
import sun.plugin.dom.exception.InvalidStateException;
import java.io.File;

import static kotlin.collections.SetsKt.*;
import static kotlin.io.FilesKt.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class BaseXmlConverterTest {

    @Rule
    public TestName name = new TestName();

    protected void doLayoutTest() {
        File testDataDir = new File("xml-converter/testData");
        String testName = name.getMethodName();
        if (!testName.startsWith("test")) {
            throw new InvalidStateException("Test name must start with a 'test' preffix");
        }

        File testDir = new File(testDataDir, decapitalize(testName.substring("test".length())));
        File inputFile = new File(testDir, "layout.xml");
        File outputFile = new File(testDir, "layout.kt");

        assertTrue(inputFile + " does not exist", inputFile.exists());
        assertTrue(outputFile + " does not exist", outputFile.exists());

        String actual = XmlConverter.INSTANCE.convert(readText(inputFile, "UTF-8"), setOf("raw"));
        String expected = readText(outputFile, "UTF-8");

        assertEquals(expected, actual);
    }

    private String decapitalize(String original) {
        if (original.isEmpty()) return original;
        return Character.toLowerCase(original.charAt(0)) + original.substring(1);
    }

}

package org.jetbrains.kotlin.android.xmlconverter;

import kotlin.text.Charsets;
import org.junit.Rule;
import org.junit.rules.TestName;
import sun.plugin.dom.exception.InvalidStateException;
import java.io.File;

import static kotlin.collections.SetsKt.*;
import static kotlin.io.FilesKt.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class BaseXmlConverterTest {

    @Rule
    public TestName name = new TestName();

    protected void doLayoutTest() {
        File testDataDir = new File("xml-converter/testData");
        String testName = name.getMethodName();
        if (!testName.startsWith("test")) {
            throw new InvalidStateException("Test name must start with a 'test' preffix");
        }

        File testDir = new File(testDataDir, decapitalize(testName.substring("test".length())));
        File inputFile = new File(testDir, "layout.xml");
        File outputFile = new File(testDir, "layout.kt");

        assertTrue(inputFile + " does not exist", inputFile.exists());
        assertTrue(outputFile + " does not exist", outputFile.exists());

        String actual = XmlConverter.INSTANCE.convert(readText(inputFile, Charsets.UTF_8), setOf("raw"));
        String expected = readText(outputFile, Charsets.UTF_8);

        assertEquals(expected, actual);
    }

    private String decapitalize(String original) {
        if (original.isEmpty()) return original;
        return Character.toLowerCase(original.charAt(0)) + original.substring(1);
    }

}

Fix compilation error with Kotlin 1.0

Fix compilation error with Kotlin 1.0


package org.vaadin.spring.mvp.autowired;

import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.annotation.VaadinComponent;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import org.vaadin.spring.mvp.FooView;
import org.vaadin.spring.mvp.Presenter;

@UIScope
@VaadinComponent
public class AutowiredPresenter extends Presenter<FooView> {

    @Autowired
    public AutowiredPresenter(FooView view, EventBus eventBus) {
        super(view, eventBus);
    }

    @EventBusListenerMethod
    public void onNewCaption(String caption) {
        getView().setCaption(caption);
    }
}

package org.vaadin.spring.mvp.autowired;

import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.annotation.VaadinComponent;
import org.vaadin.spring.annotation.VaadinUIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import org.vaadin.spring.mvp.FooView;
import org.vaadin.spring.mvp.Presenter;

@VaadinUIScope
@VaadinComponent
public class AutowiredPresenter extends Presenter<FooView> {

    @Autowired
    public AutowiredPresenter(FooView view, EventBus eventBus) {
        super(view, eventBus);
    }

    @EventBusListenerMethod
    public void onNewCaption(String caption) {
        getView().setCaption(caption);
    }
}

Test Class Update: Change UIScope => VaadinUIScope


package com.vryba.selenium.utilities;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;

import static org.testng.Assert.fail;

public class TestBase {

    private String baseUrl = Constant.URL;
    private StringBuffer verificationErrors = new StringBuffer();
    private Logger LOG = LogManager.getFormatterLogger();
    // annotated method will be run before the first test method in the current class is invoked
    @BeforeClass
    public void methodSetup() {
        BrowserFactory.startBrowser(BrowserFactory.BrowserType.FirefoxDriver, baseUrl);
        LOG.info("Starting Browser");
    }
    // annotated method will be run after each test method
    @AfterMethod
    public void testCleanUp() {
        new BrowserUtilities().executeJSCode(BrowserUtilities.CLEAR_LOCAL_STORAGE);
    }
    // annotated method will be run after all the test methods in the current class have been run
    @AfterClass(alwaysRun = true)
    public void tearDown() {
        BrowserFactory.closeSession();
        String verificationErrorString = verificationErrors.toString();
        if (!"".equals(verificationErrorString)) {
            fail(verificationErrorString);
        } else
            LOG.info("Browser Closed");
    }
}

package com.vryba.selenium.utilities;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import static org.testng.Assert.fail;

public class TestBase {

    private String baseUrl = Constant.BASE_URL;
    private StringBuffer verificationErrors = new StringBuffer();
    private Logger LOG = LogManager.getFormatterLogger();
    // annotated method will be run before the first test method in the current class is invoked
    @BeforeMethod
    public void methodSetup() {
        BrowserFactory.startBrowser(BrowserFactory.BrowserType.FirefoxDriver, baseUrl);
        LOG.info("Starting Browser");
    }
// annotated method will be run after each test method
    @AfterMethod
    public void testCleanUp() {
        new BrowserUtilities().executeJSCode(BrowserUtilities.CLEAR_LOCAL_STORAGE);
    }

    // annotated method will be run after all the test methods in the current class have been run
    @AfterClass(alwaysRun = true)
    public void tearDown() {
        BrowserFactory.closeSession();
        String verificationErrorString = verificationErrors.toString();
        if (!"".equals(verificationErrorString)) {
            fail(verificationErrorString);
        } else
            LOG.info("Browser Closed");
    }
}

Replace TestNG @BeforeClass with @BeforeMethod annotation


package uk.co.prenderj.trail.util;

import android.os.AsyncTask;

public abstract class CheckedAsyncTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {
    public abstract Result call(Params... params) throws Exception;

    public abstract void finish(Result result) throws Exception;

    @Override
    protected Result doInBackground(Params... params) {
        try {
            return call(params);
        } catch (Exception e) {
            onException(e);
            return null;
        }
    }

    @Override
    protected void onPostExecute(Result result) {
        try {
            finish(result);
        } catch (Exception e) {
            onException(e);
        }
    }

    public void onException(Exception thrown) {
        cancel(true);
    }
}

package uk.co.prenderj.trail.util;

import android.os.AsyncTask;

public abstract class CheckedAsyncTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {
    private Exception thrown;

    public abstract Result call(Params... params) throws Exception;

    public abstract void finish(Result result) throws Exception;

    @Override
    protected Result doInBackground(Params... params) {
        try {
            return call(params);
        } catch (Exception e) {
            thrown = e;
            return null;
        }
    }

    @Override
    protected void onPostExecute(Result result) {
        if (thrown != null) {
            onException(thrown);
        }
        try {
            finish(result);
        } catch (Exception e) {
            onException(e);
        }
    }

    public void onException(Exception thrown) {
        cancel(true);
    }
}

Revert "Handle exception straight away"

Revert "Handle exception straight away"

This reverts commit 0cac4b793b3eb7c122f1f6550f2e62ba29e02795.


package pokefenn.totemic.item.music;

import net.minecraft.stats.Stats;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import pokefenn.totemic.api.TotemicAPI;
import pokefenn.totemic.init.ModContent;
import pokefenn.totemic.init.ModItems;

public class FluteItem extends Item {
    public FluteItem(Properties properties) {
        super(properties);
    }

    @SuppressWarnings("null")
    @Override
    public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) {
        TotemicAPI.get().music().playMusic(player, ModContent.flute);

        player.getCooldowns().addCooldown(ModItems.flute.get(), 20);
        player.getCooldowns().addCooldown(ModItems.infused_flute.get(), 20);

        player.awardStat(Stats.ITEM_USED.get(this));
        return InteractionResultHolder.success(player.getItemInHand(hand));
    }
}

package pokefenn.totemic.item.music;

import net.minecraft.stats.Stats;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import pokefenn.totemic.api.TotemicAPI;
import pokefenn.totemic.init.ModContent;
import pokefenn.totemic.init.ModItems;

public class FluteItem extends Item {
    public FluteItem(Properties properties) {
        super(properties);
    }

    @Override
    public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) {
        if(!world.isClientSide) {
            if(player.isShiftKeyDown())
                TotemicAPI.get().music().playSelector(player, ModContent.flute);
            else
                TotemicAPI.get().music().playMusic(player, ModContent.flute);
        }

        player.getCooldowns().addCooldown(ModItems.flute.get(), 20);
        player.getCooldowns().addCooldown(ModItems.infused_flute.get(), 20);

        player.awardStat(Stats.ITEM_USED.get(this));
        return InteractionResultHolder.success(player.getItemInHand(hand));
    }
}

Make flute item work properly

Make flute item work properly


/*
 * 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.cloud.aws;

import com.amazonaws.auth.AWSCredentialsProvider;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.ESTestCase;

public class EnvironmentCredentialsTests extends ESTestCase {

    public void test() {
        AWSCredentialsProvider provider =
            InternalAwsS3Service.buildCredentials(logger, deprecationLogger, Settings.EMPTY, Settings.EMPTY, "default");
        // NOTE: env vars are setup by the test runner in gradle
        assertEquals("env_access", provider.getCredentials().getAWSAccessKeyId());
        assertEquals("env_secret", provider.getCredentials().getAWSSecretKey());
        assertWarnings("Supplying S3 credentials through environment variables is deprecated");
    }
}

/*
 * 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.cloud.aws;

import com.amazonaws.auth.AWSCredentialsProvider;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.ESTestCase;

public class EnvironmentCredentialsTests extends ESTestCase {

    public void test() {
        AWSCredentialsProvider provider =
            InternalAwsS3Service.buildCredentials(logger, deprecationLogger, Settings.EMPTY, Settings.EMPTY, "default");
        // NOTE: env vars are setup by the test runner in gradle
        assertEquals("env_access", provider.getCredentials().getAWSAccessKeyId());
        assertEquals("env_secret", provider.getCredentials().getAWSSecretKey());
        assertWarnings("Supplying S3 credentials through environment variables is deprecated. "
                + "See the breaking changes lists in the documentation for details.");
    }
}

Fix warning assertion in credentials test

This commit fixes a warning assertion in a credentials test now that we
are stricter about warning message assertions.


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

package com.google.enterprise.connector.pusher;

/**
 * Interface for a factory that creates {@link Pusher} instances for use by a
 * {@link com.google.enterprise.connector.traverser.Traverser Traverser}.
 */
public interface PusherFactory {
  /**
   * Create a new {@link Pusher} instance appropriate for the supplied
   * dataSource.
   *
   * @param dataSource a data source for a {@code Feed}, typically the name
   *        of a connector instance.
   * @return a {@link Pusher}
   * @throws {@link PushException} if no {@link Pusher} is assigned to the
   *         {@code dataSource}.
   */
  public Pusher newPusher(String dataSource) throws PushException;
}

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

package com.google.enterprise.connector.pusher;

/**
 * Interface for a factory that creates {@link Pusher} instances for use by a
 * {@link com.google.enterprise.connector.traversal.Traverser Traverser}.
 */
public interface PusherFactory {
  /**
   * Create a new {@link Pusher} instance appropriate for the supplied
   * dataSource.
   *
   * @param dataSource a data source for a {@code Feed}, typically the name
   *        of a connector instance.
   * @return a {@link Pusher}
   * @throws PushException if no {@link Pusher} is assigned to the
   *         {@code dataSource}.
   */
  public Pusher newPusher(String dataSource) throws PushException;
}

Resolve a couple of compiler warnings that crept into the code.


package com.msgilligan.bitcoinj.json.conversion;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.bitcoinj.core.Transaction;

import java.io.IOException;
import java.util.Formatter;

/**
 *
 */
public class TransactionHexSerializer extends JsonSerializer<Transaction> {
    @Override
    public void serialize(Transaction value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException {
        // From: http://bitcoin.stackexchange.com/questions/8475/how-to-get-hex-string-from-transaction-in-bitcoinj
        final StringBuilder sb = new StringBuilder();
        Formatter formatter = new Formatter(sb);
        byte[] bytes = value.bitcoinSerialize();
        for (byte b : bytes) {
            formatter.format("%02x", b);
        }
        formatter.close();
        gen.writeString(sb.toString());
    }
}

package com.msgilligan.bitcoinj.json.conversion;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.bitcoinj.core.Transaction;

import java.io.IOException;
import java.util.Formatter;

/**
 *
 */
public class TransactionHexSerializer extends JsonSerializer<Transaction> {
    @Override
    public void serialize(Transaction value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException {
        gen.writeString(bytesToHexString(value.bitcoinSerialize()));
    }

    // From: http://bitcoin.stackexchange.com/questions/8475/how-to-get-hex-string-from-transaction-in-bitcoinj
    public static String bytesToHexString(byte[] bytes) {
        final StringBuilder sb = new StringBuilder();
        Formatter formatter = new Formatter(sb);
        for (byte b : bytes) {
            formatter.format("%02x", b);
        }
        formatter.close();
        return sb.toString();
    }
}

Split out bytesToHexString as a static method.


package doubler.impl;

import doubler.Doubler;
import org.junit.Test;

public class DoublerImplTest {

    @Test
    public void testIt() {
        Doubler doubler = new DoublerImpl();
        assert doubler.doubleIt(2) == 4;
    }
}

package doubler.impl;

import doubler.Doubler;
import org.junit.Test;
import static org.junit.Assert.*;

public class DoublerImplTest {
    @Test
    public void testIt() {
        Doubler doubler = new DoublerImpl();
        assertEquals(4, doubler.doubleIt(2));
    }
}

Use JUnit assert method in test case

gradle: Use JUnit assert method in test case

Signed-off-by: BJ Hargrave <3d26bb3930946e3370762d769a073cece444c2d8@bjhargrave.com>


package amu.zhcet.email;

import amu.zhcet.common.utils.ConsoleHelper;
import com.google.common.base.Strings;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSender;

@Slf4j
@Configuration
public class EmailConfiguration {

    private static boolean EMAIL_ENABLED;

    @Autowired(required = false)
    public EmailConfiguration(JavaMailSender javaMailSender, EmailProperties emailProperties) {
        if (javaMailSender == null || Strings.isNullOrEmpty(emailProperties.getAddress())) {
            log.error(ConsoleHelper.red("CONFIG (Email): Email or Password not found {}"), emailProperties.getAddress());
            EMAIL_ENABLED = false;
        } else {
            EMAIL_ENABLED = true;
            log.info(ConsoleHelper.green("Email Initialized"));
        }
    }

    public static Boolean isEmailSet() {
        return EMAIL_ENABLED;
    }

}

package amu.zhcet.email;

import amu.zhcet.common.utils.ConsoleHelper;
import com.google.common.base.Strings;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSender;

@Slf4j
@Configuration
public class EmailConfiguration {

    private static boolean EMAIL_ENABLED;

    public EmailConfiguration(@Autowired(required = false) JavaMailSender javaMailSender,
                              EmailProperties emailProperties) {
        if (javaMailSender == null || Strings.isNullOrEmpty(emailProperties.getAddress())) {
            log.error(ConsoleHelper.red("CONFIG (Email): Email or Password not found {}"), emailProperties.getAddress());
            EMAIL_ENABLED = false;
        } else {
            EMAIL_ENABLED = true;
            log.info(ConsoleHelper.green("Email Initialized"));
        }
    }

    public static Boolean isEmailSet() {
        return EMAIL_ENABLED;
    }

}

fix: Move optional autowired inside constructor

Fixes #105


package mod.flatcoloredblocks.gui;

import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.fml.client.FMLConfigGuiFactory;

/**
 * Basic Config Factory.
 */
public class ConfigGuiFactory extends FMLConfigGuiFactory
{

	@Override
	public Class<? extends GuiScreen> mainConfigGuiClass()
	{
		return ConfigGui.class;
	}

}

package mod.flatcoloredblocks.gui;

import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.fml.client.FMLConfigGuiFactory;

/**
 * Basic Config Factory.
 */
public class ConfigGuiFactory extends FMLConfigGuiFactory
{

	@Override
	public GuiScreen createConfigGui(
			GuiScreen parentScreen )
	{
		return new ConfigGui( parentScreen );
	}

}

Use createConfigGui instead of mainConfigGuiClass


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

package org.slf4j.impl;

import org.slf4j.spi.LoggerFactoryBinder;
import org.slf4j.ILoggerFactory;

public final class StaticLoggerBinder implements LoggerFactoryBinder {

    public ILoggerFactory getLoggerFactory() {
        return new Slf4jLoggerFactory();
    }

    public String getLoggerFactoryClassStr() {
        return Slf4jLoggerFactory.class.getName();
    }
}

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

package org.slf4j.impl;

import org.slf4j.spi.LoggerFactoryBinder;
import org.slf4j.ILoggerFactory;

public final class StaticLoggerBinder implements LoggerFactoryBinder {

    public static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();

    public ILoggerFactory getLoggerFactory() {
        return new Slf4jLoggerFactory();
    }

    public String getLoggerFactoryClassStr() {
        return Slf4jLoggerFactory.class.getName();
    }
}

Add apparently important SINGLETON field


package com.nikita.recipiesapp.common;

import com.nikita.recipiesapp.common.models.Recipe;

import java.util.List;

public final class AppState {
  public final List<Recipe> recipes;

  private final String selectedRecipeId;
  private final String selectedStepId;

  public AppState(List<Recipe> recipes,
                  String selectedRecipeId,
                  String selectedStepId) {
    this.recipes = recipes;
    this.selectedRecipeId = selectedRecipeId;
    this.selectedStepId = selectedStepId;
  }
}

package com.nikita.recipiesapp.common;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.nikita.recipiesapp.common.models.Recipe;
import com.nikita.recipiesapp.common.models.Step;

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

public final class AppState {
  public final boolean isLoading;
  @Nullable
  public final String notification;
  @Nullable
  public final String error;

  @NonNull
  public final List<Recipe> recipes;

  @NonNull
  private final String selectedRecipeId;
  @NonNull
  private final String selectedStepId;

  public AppState(boolean isLoading,
                  String notification,
                  String error,
                  List<Recipe> recipes,
                  String selectedRecipeId,
                  String selectedStepId) {
    this.isLoading = isLoading;
    this.notification = notification;
    this.error = error;
    this.recipes = recipes;
    this.selectedRecipeId = selectedRecipeId;
    this.selectedStepId = selectedStepId;
  }

  public static AppState create(boolean isLoading,
                                String notification,
                                String error,
                                List<Recipe> recipes,
                                String selectedRecipeId,
                                String selectedStepId) {
    return new AppState(isLoading, notification, error, recipes, selectedRecipeId, selectedStepId);
  }

  public static AppState initial() {
    return create(true, null, null, Collections.emptyList(), "", "");
  }

  public AppState withLoading(boolean isLoading) {
    return create(isLoading, notification, error, recipes, selectedRecipeId, selectedStepId);
  }

  public AppState withNotification(@NonNull String notification) {
    return create(isLoading, notification, error, recipes, selectedRecipeId, selectedStepId);
  }

  public AppState withError(@NonNull String error) {
    return create(isLoading, notification, error, recipes, selectedRecipeId, selectedStepId);
  }

  public AppState withRecipes(@NonNull List<Recipe> recipes) {
    return create(isLoading, notification, error, recipes, selectedRecipeId, selectedStepId);
  }

  public AppState withSelectedRecipe(@NonNull Recipe recipe) {
    return create(isLoading, notification, error, recipes, recipe.id, selectedStepId);
  }

  public AppState withSelectedStep(@NonNull Step step) {
    return create(isLoading, notification, error, recipes, selectedRecipeId, step.id);
  }
}

Add app state mutation methods

Add app state mutation methods


package com.zaxxer.hikari.json.util;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;

import com.zaxxer.hikari.json.JsonProperty;

public final class Clazz
{
   private final Class<?> actualClass;
   private final Map<Integer, Phield> fields;

   public Clazz(Class<?> clazz)
   {
      this.actualClass = clazz;
      this.fields = new HashMap<>();
   }

   void parseFields()
   {
      for (Field field : actualClass.getDeclaredFields()) {
         if (!Modifier.isStatic(field.getModifiers())) {
            JsonProperty jsonProperty = field.getAnnotation(JsonProperty.class);
            boolean excluded = (jsonProperty != null && jsonProperty.exclude());

            Phield phield = new Phield(field, excluded);
            if (jsonProperty != null) {
               fields.put(jsonProperty.name().hashCode(), phield);
            }
            else {
               fields.put(field.getName().hashCode(), phield);
               fields.put(field.getName().toLowerCase().hashCode(), phield);
            }
         }
      }
   }

   public Class<?> getActualClass() {
      return actualClass;
   }

   public Phield getPhield(final int hashCode) {
      return fields.get(hashCode);
   }

   @Override
   public String toString()
   {
      return "Clazz [" + actualClass.getCanonicalName() + "]";
   }

   public Object newInstance() throws InstantiationException, IllegalAccessException
   {
      return actualClass.newInstance();
   }
}

package com.zaxxer.hikari.json.util;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;

import com.zaxxer.hikari.json.JsonProperty;

public final class Clazz
{
   private final Class<?> actualClass;
   private final Map<Integer, Phield> fields;

   public Clazz(Class<?> clazz)
   {
      this.actualClass = clazz;
      this.fields = new HashMap<>((int)(actualClass.getDeclaredFields().length * 1.3));
   }

   void parseFields()
   {
      for (Field field : actualClass.getDeclaredFields()) {
         if (!Modifier.isStatic(field.getModifiers())) {
            JsonProperty jsonProperty = field.getAnnotation(JsonProperty.class);
            boolean excluded = (jsonProperty != null && jsonProperty.exclude());

            Phield phield = new Phield(field, excluded);
            if (jsonProperty != null) {
               fields.put(jsonProperty.name().hashCode(), phield);
            }
            else {
               fields.put(field.getName().hashCode(), phield);
               fields.put(field.getName().toLowerCase().hashCode(), phield);
            }
         }
      }
   }

   public Class<?> getActualClass() {
      return actualClass;
   }

   public Phield getPhield(final int hashCode) {
      return fields.get(hashCode);
   }

   @Override
   public String toString()
   {
      return "Clazz [" + actualClass.getCanonicalName() + "]";
   }

   public Object newInstance() throws InstantiationException, IllegalAccessException
   {
      return actualClass.newInstance();
   }
}

Set initial hash size (should be tuned more).


package net.glowstone.io.entity;

import net.glowstone.entity.passive.GlowWolf;
import net.glowstone.util.nbt.CompoundTag;
import org.bukkit.DyeColor;
import org.bukkit.entity.EntityType;

class WolfStore extends TameableStore<GlowWolf> {

    public WolfStore() {
        super(GlowWolf.class, EntityType.WOLF);
    }

    @Override
    public void load(GlowWolf entity, CompoundTag compound) {
        super.load(entity, compound);
        entity.setCollarColor(DyeColor.getByDyeData(compound.getByte("CollarColor")));
        entity.setAngry(compound.getBool("Angry"));
    }

    @Override
    public void save(GlowWolf entity, CompoundTag tag) {
        super.save(entity, tag);
        tag.putByte("CollarColor", entity.getCollarColor().getDyeData());
        tag.putBool("Angry", entity.isAngry());
    }

}

package net.glowstone.io.entity;

import net.glowstone.entity.passive.GlowWolf;
import net.glowstone.util.nbt.CompoundTag;
import org.bukkit.DyeColor;
import org.bukkit.entity.EntityType;

class WolfStore extends TameableStore<GlowWolf> {

    public WolfStore() {
        super(GlowWolf.class, EntityType.WOLF);
    }

    @Override
    public void load(GlowWolf entity, CompoundTag compound) {
        super.load(entity, compound);
        if (compound.isByte("CollarColor")) {
            entity.setCollarColor(DyeColor.getByDyeData(compound.getByte("CollarColor")));
        }
        if (compound.isByte("Angry")) {
            entity.setAngry(compound.getBool("Angry"));
        }
    }

    @Override
    public void save(GlowWolf entity, CompoundTag tag) {
        super.save(entity, tag);
        tag.putByte("CollarColor", entity.getCollarColor().getDyeData());
        tag.putBool("Angry", entity.isAngry());
    }

}

Fix exception when spawning Wolf from egg


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

package org.gradle.api.tasks;

import org.gradle.api.Action;
import org.gradle.api.Incubating;
import org.gradle.api.Task;
import org.gradle.api.provider.Provider;

/**
 * Providers a task of the given type.
 *
 * @param <T> Task type
 * @since 4.8
 */
@Incubating
public interface TaskProvider<T extends Task> extends Provider<T> {
    /**
     * Configures the task with the given action. Actions are run in the order added.
     *
     * @param action A {@link Action} that can configure the task when required.
     * @since 4.8
     */
    void configure(Action<? super T> action);

    /**
     * The task name referenced by this provider.
     * <p>
     * Must be constant for the life of the object.
     *
     * @return The task name. Never null.
     * @since 4.10
     */
    String getName();
}

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

package org.gradle.api.tasks;

import org.gradle.api.Action;
import org.gradle.api.Incubating;
import org.gradle.api.Task;
import org.gradle.api.provider.Provider;

/**
 * Providers a task of the given type.
 *
 * @param <T> Task type
 * @since 4.8
 */
@Incubating
public interface TaskProvider<T extends Task> extends Provider<T> {
    /**
     * Configures the task with the given action. Actions are run in the order added.
     *
     * @param action A {@link Action} that can configure the task when required.
     * @since 4.8
     */
    void configure(Action<? super T> action);

    /**
     * The task name referenced by this provider.
     * <p>
     * Must be constant for the life of the object.
     *
     * @return The task name. Never null.
     * @since 4.9
     */
    String getName();
}

Revert "Hackily unblock the build"

Revert "Hackily unblock the build"

This reverts commit ea8a58282545fe8fbf7700ad05f50aeb6b492294.


package at.lingu.sqlcompose;

import at.lingu.sqlcompose.projection.Projection;
import at.lingu.sqlcompose.source.Table;
import org.junit.Test;

/**
 * Tests for select statements.
 *
 * @author Florian Fankhauser <flo@lingu.at>
 */
public class SelectTests extends BaseSqlTests {

	private Table users = new Table("users");

	@Test
	public void testSelectAllFields() {

		Select select = new Select(users)
				.project(Projection.ALL);

		generateResult(select);

		assertSql("SELECT * FROM users");
		assertNoParams();
	}

	@Test
	public void testSelectFields() {
		Select select = new Select(users)
				.project(
						users.column("id"),
						users.column("last_name"),
						users.column("first_name"));

		generateResult(select);

		assertSql("SELECT id, last_name, first_name FROM users");
		assertNoParams();
	}

}

package at.lingu.sqlcompose;

import at.lingu.sqlcompose.projection.Projection;
import at.lingu.sqlcompose.source.Table;
import org.junit.Test;

/**
 * Tests for select statements.
 *
 * @author Florian Fankhauser <flo@lingu.at>
 */
public class SelectTests extends BaseSqlTests {

	private Table users = new Table("users");

	@Test
	public void testSelectAllFields() {

		Select select = new Select(users)
				.project(Projection.ALL);

		generateResult(select);

		assertSql("SELECT * FROM users");
		assertNoParams();
	}

	@Test
	public void testSelectFields() {
		Select select = new Select(users)
				.project(
						users.column("id"),
						users.column("last_name"),
						users.column("first_name"));

		generateResult(select);

		assertSql("SELECT id, last_name, first_name FROM users");
		assertNoParams();
	}

	@Test
	public void testSelectFieldsWithAlias() {
		Select select = new Select(users)
				.project(
						users.column("id").as("user_id"),
						users.column("last_name").as("l_name"),
						users.column("first_name").as("f_name"));

		generateResult(select);

		assertSql("SELECT id AS user_id, last_name AS l_name, "
				+ "first_name AS f_name FROM users");
		assertNoParams();
	}
}

Add test for projection alias

Add test for projection alias


package com.thinkaurelius.titan.util.system;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collection;

public class NetworkUtil {
    public static String getLoopbackAddress() {
        return InetAddress.getLoopbackAddress().getHostAddress();
    }

    public static InetAddress getLocalHost() {
        try {
            return InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
            throw new AssertionError(e);
        }
    }

    public static String getLocalAddress() {
        return getLocalHost().getHostAddress();
    }

    public static String getLocalHostName() {
        return getLocalHost().getHostName();
    }

    public static boolean hasLocalAddress(Collection<String> endpoints) {
        return endpoints.contains(getLoopbackAddress()) || endpoints.contains(getLocalAddress()) || endpoints.contains(getLocalHostName());
    }

    public static boolean isLocalConnection(String hostname) {
        InetAddress localhost = NetworkUtil.getLocalHost();
        return hostname.equalsIgnoreCase(NetworkUtil.getLoopbackAddress())
                || hostname.equals(localhost.getHostAddress())
                || hostname.equals(localhost.getHostName());
    }
}

package com.thinkaurelius.titan.util.system;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collection;

public class NetworkUtil {
    public static String getLoopbackAddress() {
        return InetAddress.getLoopbackAddress().getHostAddress();
    }

    public static InetAddress getLocalHost() {
        try {
            return InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
            throw new AssertionError(e);
        }
    }

    public static String getLocalAddress() {
        return getLocalHost().getHostAddress();
    }

    public static String getLocalHostName() {
        return getLocalHost().getHostName();
    }

    public static boolean hasLocalAddress(Collection<String> endpoints) {
        return endpoints.contains(getLoopbackAddress()) || endpoints.contains(getLocalAddress()) || endpoints.contains(getLocalHostName());
    }

    public static boolean isLocalConnection(String hostname) {
        InetAddress localhost = NetworkUtil.getLocalHost();
        return hostname.equalsIgnoreCase(NetworkUtil.getLoopbackAddress())
                || hostname.equals(localhost.getHostAddress())
                || hostname.equals(localhost.getHostName())
                || hostname.equals(localhost.getCanonicalHostName());
    }
}

Make isLocalAddress(...) allow canonical addresses


package eic.beike.projectx.network.projectXServer;

import eic.beike.projectx.util.ScoreEntry;

/**
 * Used to interact with the database, these are long running network operations and should not be called
 * from the UI thread.
 *
 * Created by alex on 10/1/15.
 */
public interface IDatabase {

    /**
     * Register a name for the given id.
     * @return True if registration succeded, false if it failed.
     */
   boolean register(String id, String name);

    /**
     * @return True if score was recorded correctly, false if it failed.
     */
    boolean recordScore(String playerId, int score, long time, String bus);

    /**
     * @return The best ten scores for all players on all buses.
     */
    ScoreEntry[] getTopTen();

    /**
     * @return The best ten scores for the given player.
     */
    ScoreEntry[] getPlayerTopTen(String playerId);

}

package eic.beike.projectx.network.projectXServer;

import eic.beike.projectx.util.ScoreEntry;

import java.util.List;

/**
 * Used to interact with the database, these are long running network operations and should not be called
 * from the UI thread.
 *
 * @Author alex
 */
public interface IDatabase {

    /**
     * Register a name for the given id.
     * @return True if registration succeded, false if it failed.
     */
   boolean register(String id, String name);

    /**
     * @return True if score was recorded correctly, false if it failed.
     */
    boolean recordScore(String playerId, int score, long time, String bus);

    /**
     * @return The best ten scores for all players on all buses.
     */
    List<ScoreEntry> getTopTen();

    /**
     * @return The best ten scores for the given player.
     */
    List<ScoreEntry> getPlayerTopTen(String playerId);

}

Change database interface to return List<>.


package de.danoeh.antennapod.dialog;

import android.content.Context;
import android.view.View;
import android.widget.CheckBox;
import androidx.appcompat.app.AlertDialog;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.playback.Playable;
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;

public class StreamingConfirmationDialog {
    private final Context context;
    private final Playable playable;

    public StreamingConfirmationDialog(Context context, Playable playable) {
        this.context = context;
        this.playable = playable;
    }

    public void show() {
        View view = View.inflate(context, R.layout.checkbox_do_not_show_again, null);
        CheckBox checkDoNotShowAgain = view.findViewById(R.id.checkbox_do_not_show_again);

        new AlertDialog.Builder(context)
                .setTitle(R.string.stream_label)
                .setMessage(R.string.confirm_mobile_streaming_notification_message)
                .setView(view)
                .setPositiveButton(R.string.stream_label, (dialog, which) -> {
                    if (checkDoNotShowAgain.isChecked()) {
                        UserPreferences.setAllowMobileStreaming(true);
                    }
                    new PlaybackServiceStarter(context, playable)
                            .callEvenIfRunning(true)
                            .startWhenPrepared(true)
                            .shouldStream(true)
                            .shouldStreamThisTime(true)
                            .start();
                })
                .setNegativeButton(R.string.cancel_label, null)
                .show();
    }
}

package de.danoeh.antennapod.dialog;

import android.content.Context;
import androidx.appcompat.app.AlertDialog;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.util.playback.Playable;
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;

public class StreamingConfirmationDialog {
    private final Context context;
    private final Playable playable;

    public StreamingConfirmationDialog(Context context, Playable playable) {
        this.context = context;
        this.playable = playable;
    }

    public void show() {
        new AlertDialog.Builder(context)
                .setTitle(R.string.stream_label)
                .setMessage(R.string.confirm_mobile_streaming_notification_message)
                .setPositiveButton(R.string.stream_label, (dialog, which) -> stream())
                .setNegativeButton(R.string.confirm_mobile_streaming_button_always, (dialog, which) -> {
                    UserPreferences.setAllowMobileStreaming(true);
                    stream();
                })
                .setNeutralButton(R.string.cancel_label, null)
                .show();
    }

    private void stream() {
        new PlaybackServiceStarter(context, playable)
                .callEvenIfRunning(true)
                .startWhenPrepared(true)
                .shouldStream(true)
                .shouldStreamThisTime(true)
                .start();
    }
}

Make mobile streaming dialog easier to understand


package io.gapi.vgen;

import com.google.api.Authentication;
import com.google.api.AuthenticationRule;
import com.google.api.Service;
import com.google.api.tools.framework.model.Interface;

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

/**
 * Utility class that provides service configuration data from an Interface.
 */
public class ServiceConfig {
  /**
   * Return the service address.
   */
  public String getServiceAddress(Interface service) {
    return service.getModel().getServiceConfig().getName();
  }

  /**
   * Return the service port.
   * TODO(cbao): Read the port from config.
   */
  public Integer getServicePort() {
    return 443;
  }

  /**
   * Return a list of scopes for authentication.
   */
  public Iterable<String> getAuthScopes(Interface service) {
    List<String> result = new ArrayList<>();
    Service config = service.getModel().getServiceConfig();
    Authentication auth = config.getAuthentication();
    for (AuthenticationRule rule : auth.getRulesList()) {
      List<String> scopes = Arrays.asList(rule.getOauth().getCanonicalScopes().split(", "));
      result.addAll(scopes);
    }
    return result;
  }
}

package io.gapi.vgen;

import com.google.api.Authentication;
import com.google.api.AuthenticationRule;
import com.google.api.Service;
import com.google.api.tools.framework.model.Interface;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * Utility class that provides service configuration data from an Interface.
 */
public class ServiceConfig {
  /**
   * Return the service address.
   */
  public String getServiceAddress(Interface service) {
    return service.getModel().getServiceConfig().getName();
  }

  /**
   * Return the service port.
   * TODO(cbao): Read the port from config.
   */
  public Integer getServicePort() {
    return 443;
  }

  /**
   * Return a list of scopes for authentication.
   */
  public Iterable<String> getAuthScopes(Interface service) {
    Set<String> result = new HashSet<>();
    Service config = service.getModel().getServiceConfig();
    Authentication auth = config.getAuthentication();
    for (AuthenticationRule rule : auth.getRulesList()) {
      // Scopes form a union and the union is used for down-scoping, so adding more scopes that
      // are subsets of the others already in the union essentially has no effect.
      // We are doing this for implementation simplicity so we don't have to compute which scopes
      // are subsets of the others.
      String scopesString = rule.getOauth().getCanonicalScopes();
      List<String> scopes = Arrays.asList(scopesString.split(","));
      for (String scope : scopes) {
        result.add(scope.trim());
      }
    }
    return result;
  }
}

Use hashset to avoid duplicate scopes.

Use hashset to avoid duplicate scopes.

Also add extra comment to explain scoping implmentation.

Change-Id: I7d7d58469e66f233a7f00244241c57872405f904


package jp.crafterkina.pipes.common;

import lombok.Getter;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.InstanceFactory;
import net.minecraftforge.fml.common.SidedProxy;

import static jp.crafterkina.pipes.common.PipesCore.MOD_ID;

@Mod(modid = MOD_ID)
public enum PipesCore {
    INSTANCE;

    public static final String MOD_ID = "jp.crafterkina.pipes";

    @SuppressWarnings("NullableProblems")
    @SidedProxy(clientSide = "jp.crafterkina.pipes.client.ClientProxy", serverSide = "jp.crafterkina.pipes.server.ServerProxy")
    @Getter
    private static CommonProxy proxy;

    @InstanceFactory
    public static PipesCore getInstance(){
        return INSTANCE;
    }
}

package jp.crafterkina.pipes.common;

import jp.crafterkina.pipes.common.recipe.vanilla.CraftManager;
import lombok.Getter;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.InstanceFactory;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import static jp.crafterkina.pipes.common.PipesCore.MOD_ID;

@Mod(modid = MOD_ID)
public enum PipesCore {
    INSTANCE;

    public static final String MOD_ID = "jp.crafterkina.pipes";

    @SuppressWarnings("NullableProblems")
    @SidedProxy(clientSide = "jp.crafterkina.pipes.client.ClientProxy", serverSide = "jp.crafterkina.pipes.server.ServerProxy")
    @Getter
    private static CommonProxy proxy;

    @InstanceFactory
    public static PipesCore getInstance(){
        return INSTANCE;
    }

    @EventHandler
    private void preInit(FMLPreInitializationEvent event){
        CraftManager.INSTANCE.register();
    }
}

Call CraftRecipe Register Func on preInit


package au.com.acegi.hashbench.hashers;

import java.nio.ByteBuffer;
import java.util.Map;
import java.util.zip.Adler32;

public class AdlerHasher implements Hasher {
  public static final String JRE_ADLER_32 = "adler320-jre";

  public static final void register(final Map<String, Hasher> hashers) {
    hashers.put(AdlerHasher.JRE_ADLER_32, new AdlerHasher());
  }

  private final Adler32 delegate = new Adler32();

  private AdlerHasher() {}

  @Override
  public long hash(final byte[] in, final int off, final int len) {
    this.delegate.reset();
    this.delegate.update(in, off, len);
    return this.delegate.getValue();
  }

  @Override
  public long hash(final ByteBuffer bb, final int off, final int len) {
    this.delegate.reset();

    if (bb.hasArray()) {
      this.delegate.update(bb.array(), off, len);
      return this.delegate.getValue();
    }

    final ByteBuffer view = bb.duplicate();
    view.position(off);
    view.limit(off + len);
    this.delegate.update(view);
    return this.delegate.getValue();
  }
}

package au.com.acegi.hashbench.hashers;

import java.nio.ByteBuffer;
import java.util.Map;
import java.util.zip.Adler32;

public class AdlerHasher implements Hasher {
  public static final String JRE_ADLER_32 = "adler32-jre";

  public static final void register(final Map<String, Hasher> hashers) {
    hashers.put(AdlerHasher.JRE_ADLER_32, new AdlerHasher());
  }

  private final Adler32 delegate = new Adler32();

  private AdlerHasher() {}

  @Override
  public long hash(final byte[] in, final int off, final int len) {
    this.delegate.reset();
    this.delegate.update(in, off, len);
    return this.delegate.getValue();
  }

  @Override
  public long hash(final ByteBuffer bb, final int off, final int len) {
    this.delegate.reset();

    if (bb.hasArray()) {
      this.delegate.update(bb.array(), off, len);
      return this.delegate.getValue();
    }

    final ByteBuffer view = bb.duplicate();
    view.position(off);
    view.limit(off + len);
    this.delegate.update(view);
    return this.delegate.getValue();
  }
}

Fix typo in Adler32 name.

Fix typo in Adler32 name.


package com.m4gik.util;

/**
 * A collection of utility methods used throughout this project. This class
 * mainly contains method for implementing the operations of presenting data.
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class Util {

}

package com.m4gik.util;

/**
 * A collection of utility methods used throughout this project. This class
 * mainly contains method for implementing the operations of presenting data.
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class Util {

    /**
     * Base-64 chars.
     */
    private static final String BASE64_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";

    /**
     * Base-64 charset.
     */
    private static final char[] BASE64_CHARSET = BASE64_CHARS.toCharArray();

    /**
     * Hex charset.
     */
    private static final char[] HEX_DIGITS = "0123456789ABCDEF".toCharArray();

    /**
     * Trivial constructor to enforce Singleton pattern.
     */
    private Util() {
        super();
    }

}

Add base static fields and private constructor.


package io.github.jordao76.quotes;

import java.util.*;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.context.annotation.*;

import io.github.jordao76.quotes.domain.*;

@SpringBootApplication
public class QuoteApplication {

  public static void main(String[] args) {
    SpringApplication.run(QuoteApplication.class, args);
  }

  @Bean
  public CommandLineRunner createInitialQuotes(QuoteRepository repo) {
    return (args) -> {
      if (repo.count() < 0) return;
      repo.save(Arrays.asList(
        new Quote(
          "Any sufficiently advanced technology is indistinguishable from magic.",
          "Arthur C. Clarke"),
        new Quote(
          "Perfection (in design) is achieved not when there is nothing more to add, but rather when there is nothing more to take away.",
          "Antoine de Saint-Exupery"),
        new Quote(
          "On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.",
          "Charles Babbage")));
    };
  }

}

package io.github.jordao76.quotes;

import java.util.*;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.context.annotation.*;

import io.github.jordao76.quotes.domain.*;

@SpringBootApplication
public class QuoteApplication {

  public static void main(String[] args) {
    SpringApplication.run(QuoteApplication.class, args);
  }

  @Bean
  public CommandLineRunner createInitialQuotes(QuoteRepository repo) {
    return (args) -> {
      if (repo.count() > 0) return;
      repo.save(Arrays.asList(
        new Quote(
          "Any sufficiently advanced technology is indistinguishable from magic.",
          "Arthur C. Clarke"),
        new Quote(
          "Perfection (in design) is achieved not when there is nothing more to add, but rather when there is nothing more to take away.",
          "Antoine de Saint-Exupery"),
        new Quote(
          "On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.",
          "Charles Babbage")));
    };
  }

}

Fix createInitialQuotes guard clause issue


/**
 * The contents of this file are subject to the OpenMRS Public License
 * Version 1.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://license.openmrs.org
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Copyright (C) OpenMRS, LLC.  All Rights Reserved.
 */
package org.openmrs.module.webservices.rest.web.v1_0.controller;

import org.openmrs.PersonAddress;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.v1_0.resource.PersonAddressResource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Controller for REST web service access to {@link PersonAddress}. Supports CRUD on the resource
 * itself.
 */
@Controller
@RequestMapping(value = "/rest/" + RestConstants.VERSION_1 + "/person/{parentUuid}/addresse")
public class PersonAddressController extends BaseSubResourceController<PersonAddressResource> {

}

/**
 * The contents of this file are subject to the OpenMRS Public License
 * Version 1.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://license.openmrs.org
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Copyright (C) OpenMRS, LLC.  All Rights Reserved.
 */
package org.openmrs.module.webservices.rest.web.v1_0.controller;

import org.openmrs.PersonAddress;
import org.openmrs.module.webservices.rest.web.RestConstants;
import org.openmrs.module.webservices.rest.web.v1_0.resource.PersonAddressResource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Controller for REST web service access to {@link PersonAddress}. Supports CRUD on the resource
 * itself.
 */
@Controller
@RequestMapping(value = "/rest/" + RestConstants.VERSION_1 + "/person/{parentUuid}/address")
public class PersonAddressController extends BaseSubResourceController<PersonAddressResource> {

}

RESTWS-210: Rename subresources (e.g. person/_uuid_/attributes) to be singular, not plural


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

package com.facebook.buck.parser;

import com.facebook.buck.rules.ActionGraph;
import com.facebook.buck.rules.BuildRule;

/**
 * Matches build rules based on their association with actions in the given action graph.
 * @param <T> The interface all rules matched by the predicate implement.
 */
public interface AssociatedRulePredicate {
  public boolean isMatch(
      BuildRule buildRule,
      ActionGraph actionGraph);
}

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

package com.facebook.buck.parser;

import com.facebook.buck.rules.ActionGraph;
import com.facebook.buck.rules.BuildRule;

/**
 * Matches build rules based on their association with actions in the given action graph.
 */
public interface AssociatedRulePredicate {
  public boolean isMatch(
      BuildRule buildRule,
      ActionGraph actionGraph);
}

Remove comment about generic param that does not seem to apply.

Test Plan: Verify that this removes the warning when running `ant javadoc`.


/**
 * Created by andybb on 18.03.15.
 */

import org.junit.Test;
import static org.junit.Assert.*;

import com.mygdx.game.controllers.GameNetworkController;
import com.mygdx.game.controllers.PlayerNetworkController;

import java.util.concurrent.TimeUnit;

public class NetworkTest {
    @Test
    public void testGameInitialization() throws InterruptedException {
        GameNetworkController game1 = new GameNetworkController();
        GameNetworkController game2 = new GameNetworkController();

        game1.startGame("andybb");
        assertEquals("Username for player 1 given and in model should be equal ", "andybb", game1.getPlayerController().getPlayer().getUsername());

        TimeUnit.SECONDS.sleep(1);
        game2.startGame("mats");
        assertEquals("Username for player 2 given and in model should be equal ", "mats", game2.getPlayerController().getPlayer().getUsername());

    }

    @Test
    public void testFireOperation() throws InterruptedException{

    }
}

/**
 * Created by andybb on 18.03.15.
 */

import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;

import com.mygdx.game.controllers.GameNetworkController;

import java.util.concurrent.TimeUnit;

public class NetworkTest {

    private GameNetworkController game1;
    private GameNetworkController game2;

    @Before
    public void setup() {
        game1 = new GameNetworkController();
        game2 = new GameNetworkController();
    }

    @Test
    public void testGameInitialization() throws InterruptedException {

        game1.startGame("andybb");
        assertEquals("Username for player 1 given and in model should be equal ", "andybb", game1.getPlayerController().getPlayer().getUsername());

        TimeUnit.SECONDS.sleep(1);
        game2.startGame("mats");
        assertEquals("Username for player 2 given and in model should be equal ", "mats", game2.getPlayerController().getPlayer().getUsername());

        TimeUnit.SECONDS.sleep(11);
        assertEquals("The opponent of player 1 should player 2", "mats", game1.getPlayerController().getOpponent().getUsername());
        assertEquals("The opponent of player 2 should player 1", "andybb", game2.getPlayerController().getOpponent().getUsername());

    }

    @Test
    public void testFireOperation() throws InterruptedException{

    }
}

Add test to check that the opponent is set correctly


package seedu.task.logic.commands;

import java.util.Optional;

import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import seedu.task.model.TaskManager;

/**
 * Clears the task manager.
 */
public class ClearCommand extends Command {

    public static final String COMMAND_WORD = "clear";
    public static final String MESSAGE_SUCCESS = "Task Manager has been cleared!";
    public static final String MESSAGE_FAILURE = "Task Manager has not been cleared";

    public ClearCommand() {}

    @Override
    public CommandResult execute() {
        assert model != null;
        Alert alert = new Alert(AlertType.INFORMATION);
        alert.setTitle("Clear all tasks");
        alert.setHeaderText("Are you sure you want to clear ALL TASKS in the task manager?");
        alert.setContentText("NOTE: This cannot be undone! ");

        Optional<ButtonType> result = alert.showAndWait();
        if (result.get() == ButtonType.OK){
            model.resetData(TaskManager.getEmptyTaskManager());
            return new CommandResult(MESSAGE_SUCCESS);
        } else {
            return new CommandResult(MESSAGE_FAILURE);
        }

    }
}

package seedu.task.logic.commands;

import java.util.Optional;

import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;
import seedu.task.model.TaskManager;

/**
 * Clears the task manager.
 */
public class ClearCommand extends Command {

    public static final String COMMAND_WORD = "clear";
    public static final String MESSAGE_SUCCESS = "Task Manager has been cleared!";
    public static final String MESSAGE_FAILURE = "Task Manager has not been cleared";
    public static final String MESSAGE_NO_TASKS = "0 tasks listed!";

    public ClearCommand() {
    }

    @Override
    public CommandResult execute() {
        assert model != null;
        if (model != null) {
            Alert alert = new Alert(AlertType.INFORMATION);
            alert.setTitle("Clear all tasks");
            alert.setHeaderText("Are you sure you want to clear ALL TASKS in the task manager?");
            Optional<ButtonType> result = alert.showAndWait();
            if (result.get() == ButtonType.OK) {
                model.resetData(TaskManager.getEmptyTaskManager());
                return new CommandResult(MESSAGE_SUCCESS);
            } else {
                return new CommandResult(MESSAGE_FAILURE);
            }
        }
        else return new CommandResult(MESSAGE_NO_TASKS);

    }
}

Allow undo command to work after the clear command


package info.u_team.u_team_test.init;

import info.u_team.u_team_core.containertype.UContainerType;
import info.u_team.u_team_core.util.registry.BaseRegistryUtil;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.container.*;
import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.event.RegistryEvent.Register;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;

@EventBusSubscriber(modid = TestMod.MODID, bus = Bus.MOD)
public class TestContainers {

	public static final ContainerType<BasicTileEntityContainer> BASIC = new UContainerType<>("basic", BasicTileEntityContainer::new);

	public static final ContainerType<BasicEnergyCreatorContainer> BASIC_ENERGY_CREATOR = new UContainerType<>("energy_creator", BasicEnergyCreatorContainer::new);

	public static final ContainerType<BasicFluidInventoryContainer> BASIC_FLUID_INVENTORY = new UContainerType<>("fluid_inventory", BasicFluidInventoryContainer::new);

	@SubscribeEvent
	public static void register(Register<ContainerType<?>> event) {
		BaseRegistryUtil.getAllGenericRegistryEntriesAndApplyNames(TestMod.MODID, ContainerType.class).forEach(event.getRegistry()::register);
	}
}

package info.u_team.u_team_test.init;

import info.u_team.u_team_core.containertype.UContainerType;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.container.*;
import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.registries.*;

@EventBusSubscriber(modid = TestMod.MODID, bus = Bus.MOD)
public class TestContainers {

	public static final DeferredRegister<ContainerType<?>> CONTAINER_TYPES = DeferredRegister.create(ForgeRegistries.CONTAINERS, TestMod.MODID);

	public static final ContainerType<BasicTileEntityContainer> BASIC = new UContainerType<>("basic", BasicTileEntityContainer::new);

	public static final ContainerType<BasicEnergyCreatorContainer> BASIC_ENERGY_CREATOR = new UContainerType<>("energy_creator", BasicEnergyCreatorContainer::new);

	public static final ContainerType<BasicFluidInventoryContainer> BASIC_FLUID_INVENTORY = new UContainerType<>("fluid_inventory", BasicFluidInventoryContainer::new);

	public static void register(IEventBus bus) {
		CONTAINER_TYPES.register(bus);
	}
}

Add some methods to the container for migration


package com.decker.Essentials.Category;

public class CategoryChild
{
    public CategoryChild(String iconName,String title,String url)
    {
	this.iconame=iconName;
	this.title=title;
	this.url=url;
    }

    public String iconame;
    public String title;
    public String url;
}

package com.decker.Essentials.Category;

public class CategoryChild
{
    public CategoryChild(String iconName,String title,String url)
    {
	this.IconName=iconName;
	this.Title=title;
	this.Url=url;
    }

    public String IconName;
    public String Title;
    public String Url;
}

Revert "Chage vairable to low case for adapt front side js"

This reverts commit a70627dd0194ea6544f780b5f6d9fff20a2a0a0f.


package uk.ac.ebi.quickgo.rest.search.query;

/**
 * Represents the simplest of {@link QuickGOQuery} objects, containing just the field and values to query against.
 */
public class AllQuery extends QuickGOQuery {

    public AllQuery() {  }

    @Override public <T> T accept(QueryVisitor<T> visitor) {
        return visitor.visit(this);
    }

}

package uk.ac.ebi.quickgo.rest.search.query;

/**
 * Represents the simplest of {@link QuickGOQuery} objects, containing just the field and values to query against.
 */
class AllQuery extends QuickGOQuery {
    AllQuery() { }

    @Override public <T> T accept(QueryVisitor<T> visitor) {
        return visitor.visit(this);
    }

    @Override public String toString() {
        return "AllQuery{} ";
    }
}

Add toStringMethod for easy read.

Add toStringMethod for easy read.


/*
 * Copyright 2007 The Kuali Foundation
 *
 * Licensed under the Educational Community License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl1.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.rice.kim.dto;

/**
 * This is the Data Transfer Object (DTO) that is used for our service layer.
 *
 * This class represents a Principal entity in the system.
 *
 * @author Kuali Rice Team (kuali-rice@googlegroups.com)
 */
public class PrincipalDTO extends AbstractEntityBaseDTO implements java.security.Principal {
    private static final long serialVersionUID = -7894319178912177679L;

    private String name;

    /**
     * This overridden method ...
     *
     * @see java.security.Principal#getName()
     */
    @Override
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }
}

/*
 * Copyright 2007 The Kuali Foundation
 *
 * Licensed under the Educational Community License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl1.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.rice.kim.dto;

/**
 * This is the Data Transfer Object (DTO) that is used for our service layer.
 *
 * This class represents a Principal entity in the system.
 *
 * @author Kuali Rice Team (kuali-rice@googlegroups.com)
 */
public class PrincipalDTO extends AbstractEntityBaseDTO implements java.security.Principal {
    private static final long serialVersionUID = -7894319178912177679L;

    private String name;

    /**
     *
     * @see java.security.Principal#getName()
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }
}

KULRICE-1857: Synchronize DTOs with BOs. @Override caused problems


package com.yahoo.vespa.hosted.controller.api.integration.stubs;

public class MockUserManagement {

}

package com.yahoo.vespa.hosted.controller.api.integration.stubs;

import com.yahoo.vespa.hosted.controller.api.integration.user.UserId;
import com.yahoo.vespa.hosted.controller.api.integration.user.UserManagement;
import com.yahoo.vespa.hosted.controller.api.role.Role;

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author jonmv
 */
public class MockUserManagement implements UserManagement {

    private final Map<Role, Set<UserId>> memberships = new HashMap<>();

    @Override
    public void createRole(Role role) {
        if (memberships.containsKey(role))
            throw new IllegalArgumentException(role + " already exists.");

        memberships.put(role, new HashSet<>());
    }

    @Override
    public void deleteRole(Role role) {
        memberships.remove(role);
    }

    @Override
    public void addUsers(Role role, Collection<UserId> users) {
        memberships.get(role).addAll(users);
    }

    @Override
    public void removeUsers(Role role, Collection<UserId> users) {
        memberships.get(role).removeAll(users);
    }

    @Override
    public List<UserId> listUsers(Role role) {
        return List.copyOf(memberships.get(role));
    }

}

Add mock implementation of UserManagement


/**
*    Copyright 2011,2012 Big Switch Networks, Inc.
*    Originally created by David Erickson, Stanford University
*
*    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.floodlightcontroller.core.web.serializers;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.projectfloodlight.openflow.util.HexString;

/**
 * Serialize a DPID as colon-separated hexadecimal
 */
public class DPIDSerializer extends JsonSerializer<Long> {

    @Override
    public void serialize(Long dpid, JsonGenerator jGen,
                          SerializerProvider serializer)
                                  throws IOException, JsonProcessingException {
        jGen.writeString(HexString.toHexString(dpid, 8));
    }

}

/**
*    Copyright 2011,2012 Big Switch Networks, Inc.
*    Originally created by David Erickson, Stanford University
*
*    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.floodlightcontroller.core.web.serializers;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.projectfloodlight.openflow.util.HexString;
import org.projectfloodlight.openflow.types.DatapathId;
/**
 * Serialize a DPID as colon-separated hexadecimal
 */
public class DPIDSerializer extends JsonSerializer<DatapathId> {

    @Override
    public void serialize(DatapathId dpid, JsonGenerator jGen,
                          SerializerProvider serializer)
                                  throws IOException, JsonProcessingException {
        jGen.writeString(HexString.toHexString(dpid.getLong(), 8));
    }

}

Modify the Serializer for DPID (Long -> DatapathId )


package com.uwetrottmann.shopr;

import android.app.Application;

import com.uwetrottmann.shopr.algorithm.AdaptiveSelection;
import com.uwetrottmann.shopr.algorithm.Utils;

public class ShoprApp extends Application {

    private static final int MAX_RECOMMENDATIONS = 5;

    @Override
    public void onCreate() {
        super.onCreate();

        AdaptiveSelection.get().setInitialCaseBase(Utils.getLimitedCaseBase());
        AdaptiveSelection.get().setMaxRecommendations(MAX_RECOMMENDATIONS);
    }

}

package com.uwetrottmann.shopr;

import android.app.Application;

import com.uwetrottmann.shopr.algorithm.AdaptiveSelection;
import com.uwetrottmann.shopr.algorithm.Utils;

public class ShoprApp extends Application {

    private static final int MAX_RECOMMENDATIONS = 8;

    @Override
    public void onCreate() {
        super.onCreate();

        AdaptiveSelection.get().setInitialCaseBase(Utils.getLimitedCaseBase());
        AdaptiveSelection.get().setMaxRecommendations(MAX_RECOMMENDATIONS);
    }

}

Increase number of recs to 8 for now.l

Increase number of recs to 8 for now.l


package com.zakgof.db.velvet.impl.entity;

import java.util.Collection;
import java.util.List;
import java.util.Locale;

import com.zakgof.db.velvet.IVelvet.IStoreIndexDef;
import com.zakgof.db.velvet.annotation.Kind;
import com.zakgof.db.velvet.properties.IProperty;
import com.zakgof.db.velvet.properties.IPropertyAccessor;

public class AnnoEntityDef<K, V> extends EntityDef<K, V> implements IPropertyAccessor<K, V> {

    private AnnoKeyProvider<K, V> annoKeyProvider;

    public AnnoEntityDef(Class<V> valueClass, String kind, AnnoKeyProvider<K, V> annoKeyProvider, List<IStoreIndexDef<?, V>> indexes) {
        super(annoKeyProvider.getKeyClass(), valueClass, kind, annoKeyProvider, indexes);
        this.annoKeyProvider = annoKeyProvider;
    }

    public static String kindOf(Class<?> clazz) {
        Kind annotation = clazz.getAnnotation(Kind.class);
        if (annotation != null)
            return annotation.value();
        String kind = clazz.getSimpleName().toLowerCase(Locale.ENGLISH);
        return kind;
    }

    @Override
    public Collection<String> getProperties() {
        return annoKeyProvider.getProperties();
    }

    @Override
    public IProperty<?, V> get(String property) {
        return annoKeyProvider.get(property);
    }

    @Override
    public IProperty<K, V> getKey() {
        return annoKeyProvider.getKey();
    }

}

package com.zakgof.db.velvet.impl.entity;

import java.util.Collection;
import java.util.List;
import java.util.Locale;

import com.zakgof.db.velvet.IVelvet.IStoreIndexDef;
import com.zakgof.db.velvet.annotation.Kind;
import com.zakgof.db.velvet.properties.IProperty;
import com.zakgof.db.velvet.properties.IPropertyAccessor;

public class AnnoEntityDef<K, V> extends EntityDef<K, V> implements IPropertyAccessor<K, V> {

    private AnnoKeyProvider<K, V> annoKeyProvider;

    public AnnoEntityDef(Class<V> valueClass, String kind, AnnoKeyProvider<K, V> annoKeyProvider, List<IStoreIndexDef<?, V>> indexes) {
        super(annoKeyProvider.getKeyClass(), valueClass, kind, annoKeyProvider, indexes);
        this.annoKeyProvider = annoKeyProvider;
    }

    public static String kindOf(Class<?> clazz) {
        Kind annotation = clazz.getAnnotation(Kind.class);
        if (annotation != null)
            return annotation.value();
        String kind = clazz.getName().toLowerCase(Locale.ENGLISH);
        return kind;
    }

    @Override
    public Collection<String> getProperties() {
        return annoKeyProvider.getProperties();
    }

    @Override
    public IProperty<?, V> get(String property) {
        return annoKeyProvider.get(property);
    }

    @Override
    public IProperty<K, V> getKey() {
        return annoKeyProvider.getKey();
    }

}

Use full class name as a kind (fix issue with proguard)


package uk.ac.ebi.atlas.controllers;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@Scope("request")
public class RequestDiagnosticsController extends HtmlExceptionHandlingController {
    @RequestMapping(value = "/request-diagnostics", produces = "text/html;charset=UTF-8")
    public String showGenePage() {
        return "request-diagnostics";
    }
}

package uk.ac.ebi.atlas.controllers;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@Scope("request")
public class RequestDiagnosticsController extends HtmlExceptionHandlingController {
    @RequestMapping(value = "/request-diagnostics", produces = "text/html;charset=UTF-8")
    public String showRequestDiagnosticsPage() {
        return "request-diagnostics";
    }
}

Change method name to make sense (this was a bad copy-paste job!)


package com.artirigo.kontaktio;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

/**
 * Range and Monitor Kontakt.io beacons
 */
public class KontaktPackage implements ReactPackage {

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

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

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

        modules.add(new KontaktModule(reactContext));

        return modules;
    }

}

package com.artirigo.kontaktio;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

/**
 * Range and Monitor Kontakt.io beacons
 */
public class KontaktPackage implements ReactPackage {

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

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

        modules.add(new KontaktModule(reactContext));

        return modules;
    }

}

Remove createJSModules for RN 0.47.

Remove createJSModules for RN 0.47.


/*
 * Copyright 2017. nekocode (nekocode.cn@gmail.com)
 *
 * 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 cn.nekocode.resinspector;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.view.View;

/**
 * @author nekocode (nekocode.cn@gmail.com)
 */
public class ResourceInspector {

    @NonNull
    public static Context wrap(@NonNull Context base) {
        return base;
    }

    @RestrictTo(RestrictTo.Scope.LIBRARY)
    public static boolean isViewBeingInspected(@Nullable View view) {
        return false;
    }

    @RestrictTo(RestrictTo.Scope.LIBRARY)
    @Nullable
    public static String getViewLayoutResName(@Nullable View view) {
        return null;
    }
}

/*
 * Copyright 2017. nekocode (nekocode.cn@gmail.com)
 *
 * 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 cn.nekocode.resinspector;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.view.View;

/**
 * @author nekocode (nekocode.cn@gmail.com)
 */
public class ResourceInspector {

    @NonNull
    public static Context wrap(@NonNull Context base) {
        return base;
    }

    @RestrictTo(RestrictTo.Scope.LIBRARY)
    public static boolean isViewBeingInspected(@Nullable View view) {
        return false;
    }

    @RestrictTo(RestrictTo.Scope.LIBRARY)
    @Nullable
    public static String getViewLayoutResName(@Nullable View view) {
        return null;
    }

    public static void initialize(@NonNull final Context context) {

    }
}

Add missing method to no-op artifact

Add missing method to no-op artifact


/*
 *
 *  Copyright 2012-2014 Eurocommercial Properties NV
 *
 *
 *  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.estatio.dom.asset;

import org.estatio.dom.TitledEnum;
import org.estatio.dom.utils.StringUtils;

public enum UnitType implements TitledEnum {

    BOUTIQUE,
    CINEMA,
    DEHOR,
    EXTERNAL,
    HYPERMARKET,
    MEDIUM,
    OFFICE,
    SERVICES,
    STORAGE,
    TECHNICAL_ROOM,
    VIRTUAL,
    LAND,
    PARKING,
    ELECTRICAL_SUBSTATION;

    public String title() {
        return StringUtils.enumTitle(this.name());
    }

}

/*
 *
 *  Copyright 2012-2014 Eurocommercial Properties NV
 *
 *
 *  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.estatio.dom.asset;

import org.estatio.dom.TitledEnum;
import org.estatio.dom.utils.StringUtils;

public enum UnitType implements TitledEnum {

    BOUTIQUE,
    CINEMA,
    DEHOR,
    EXTERNAL,
    HYPERMARKET,
    MEDIUM,
    OFFICE,
    SERVICES,
    STORAGE,
    TECHNICAL_ROOM,
    COMMON_AREA,
    VIRTUAL,
    LAND,
    PARKING,
    ELECTRICAL_SUBSTATION;

    public String title() {
        return StringUtils.enumTitle(this.name());
    }

}

Add common area to unit type

Add common area to unit type


package org.spoofax.interpreter.library.ssl;

import io.usethesource.capsule.BinaryRelation;

import org.spoofax.interpreter.core.IContext;
import org.spoofax.interpreter.library.AbstractPrimitive;
import org.spoofax.interpreter.stratego.Strategy;
import org.spoofax.interpreter.terms.IStrategoTerm;

public class SSL_immutable_relation_insert extends AbstractPrimitive {

    protected SSL_immutable_relation_insert() {
        super("SSL_immutable_relation_put", 0, 2);
    }

    @Override
    public boolean call(IContext env, Strategy[] sargs, IStrategoTerm[] targs) {
        if(!(env.current() instanceof StrategoImmutableRelation)) {
            return false;
        }

        final StrategoImmutableRelation map = (StrategoImmutableRelation) env.current();
        final IStrategoTerm key = targs[0];
        final IStrategoTerm value = targs[1];

        env.setCurrent(new StrategoImmutableRelation(
            (BinaryRelation.Immutable<IStrategoTerm, IStrategoTerm>) map.backingRelation.__insert(key, value)));
        return true;
    }

}

package org.spoofax.interpreter.library.ssl;

import io.usethesource.capsule.BinaryRelation;

import org.spoofax.interpreter.core.IContext;
import org.spoofax.interpreter.library.AbstractPrimitive;
import org.spoofax.interpreter.stratego.Strategy;
import org.spoofax.interpreter.terms.IStrategoTerm;

public class SSL_immutable_relation_insert extends AbstractPrimitive {

    protected SSL_immutable_relation_insert() {
        super("SSL_immutable_relation_insert", 0, 2);
    }

    @Override
    public boolean call(IContext env, Strategy[] sargs, IStrategoTerm[] targs) {
        if(!(env.current() instanceof StrategoImmutableRelation)) {
            return false;
        }

        final StrategoImmutableRelation map = (StrategoImmutableRelation) env.current();
        final IStrategoTerm key = targs[0];
        final IStrategoTerm value = targs[1];

        env.setCurrent(new StrategoImmutableRelation(
            (BinaryRelation.Immutable<IStrategoTerm, IStrategoTerm>) map.backingRelation.__insert(key, value)));
        return true;
    }

}

Fix bug in primitive name string put -> insert


package codechicken.enderstorage.plugin.jei;

import codechicken.enderstorage.recipe.RecipeBase;
import mezz.jei.api.*;
import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;

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

/**
 * Created by covers1624 on 8/07/2017.
 */
@JEIPlugin//TODO FIXME TODO, Recipe handler for recoloring.
public class EnderStorageJEIPlugin implements IModPlugin {

    public static ICraftingGridHelper gridHelper;

    @Override
    public void register(IModRegistry registry) {
        IJeiHelpers helpers = registry.getJeiHelpers();
        IGuiHelper guiHelpers = helpers.getGuiHelper();

        gridHelper = guiHelpers.createCraftingGridHelper(1, 0);
        Set<Object> recipes = new HashSet<>();
        recipes.add(new ESCraftingRecipeWrapper((RecipeBase) ForgeRegistries.RECIPES.getValue(new ResourceLocation("enderstorage:ender_chest"))));
        recipes.add(new ESCraftingRecipeWrapper((RecipeBase) ForgeRegistries.RECIPES.getValue(new ResourceLocation("enderstorage:ender_tank"))));
        recipes.add(new ESCraftingRecipeWrapper((RecipeBase) ForgeRegistries.RECIPES.getValue(new ResourceLocation("enderstorage:ender_pouch"))));
        registry.addRecipes(recipes, VanillaRecipeCategoryUid.CRAFTING);
    }

}

package codechicken.enderstorage.plugin.jei;

import codechicken.enderstorage.recipe.RecipeBase;
import com.google.common.collect.Sets;
import mezz.jei.api.*;
import mezz.jei.api.gui.ICraftingGridHelper;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;

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

/**
 * Created by covers1624 on 8/07/2017.
 */
@JEIPlugin//TODO FIXME TODO, Recipe handler for recoloring.
public class EnderStorageJEIPlugin implements IModPlugin {

    public static ICraftingGridHelper gridHelper;

    @Override
    public void register(IModRegistry registry) {
        IJeiHelpers helpers = registry.getJeiHelpers();
        IGuiHelper guiHelpers = helpers.getGuiHelper();

        gridHelper = guiHelpers.createCraftingGridHelper(1, 0);
        registry.handleRecipes(RecipeBase.class, ESCraftingRecipeWrapper::new, VanillaRecipeCategoryUid.CRAFTING);
    }

}

Handle some JEI stuff differently, still broken..


/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 *
 */
package com.xpn.xwiki.util;

import junit.framework.TestCase;

/**
 * Unit tests for {@link com.xpn.xwiki.util.Util}.
 *
 * @version $Id: $
 */
public class UtilTest extends TestCase
{
    public void testConvertToAlphaNumeric()
    {
        assertEquals("Search", Util.convertToAlphaNumeric("Search"));
        assertEquals("Search", Util.convertToAlphaNumeric("S.earch"));
        assertEquals("e", Util.convertToAlphaNumeric("$%#^()"));
    }
}

/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 *
 */
package com.xpn.xwiki.util;

import junit.framework.TestCase;

/**
 * Unit tests for {@link com.xpn.xwiki.util.Util}.
 *
 * @version $Id: $
 */
public class UtilTest extends TestCase
{
    public void testConvertToAlphaNumeric()
    {
        assertEquals("Search", Util.convertToAlphaNumeric("Search"));
        assertEquals("Search", Util.convertToAlphaNumeric("S.earch"));
        assertEquals("e", Util.convertToAlphaNumeric("e$%#^()"));
    }
}

XWIKI-2054: Add Utility API to remove all non alpha numeric chartacters from some text

* Fixed unit tests so that it works on all system encodings

Note: I don't know to test an accent properly...

git-svn-id: cfa2b40e478804c47c05d0f328c574ec5aa2b82e@7268 f329d543-caf0-0310-9063-dda96c69346f


package org.jboss.seam.faces.environment;

import javax.enterprise.inject.Produces;
import javax.faces.context.FacesContext;
import javax.inject.Named;

/**
 *

 * A producer which retrieves the Project Stage for the current
 * request of the JavaServer Faces application, storing the result as a
 * dependent-scoped bean instance.
 *

 *
 *

 * This producer is named, allowing the Project Stage to be accessed via EL:
 *

 *
 *

 * #{projectStage}
 *

 *
 * @author Brian Leathem
 */
public class ProjectStageProducer
{
   @Named
   @Produces
   public String getProjectStage(final FacesContext context)
   {
      return context.getExternalContext().getInitParameter("javax.faces.PROJECT_STAGE");
   }
}

package org.jboss.seam.faces.environment;

import javax.enterprise.inject.Produces;
import javax.faces.application.ProjectStage;
import javax.faces.context.FacesContext;
import javax.inject.Named;

/**
 *

 * A producer which retrieves the ProjectStage for the current request
 * of the JavaServer Faces application, storing the result as a
 * ApplicationScoped bean instance.
 *

 *
 *

 * This producer is named, allowing the Project Stage to be accessed via EL:
 *

 *
 *

 * #{projectStage}
 *

 *
 * @author Brian Leathem
 */
public class ProjectStageProducer
{
   @Named
   @Produces
   public ProjectStage getProjectStage(final FacesContext context)
   {
      return context.getApplication().getProjectStage();
   }
}

SEAMFACES-95: Make ProjectStage available from EL - using Enum