/*
 * Copyright 2015 Anton Tananaev (anton.tananaev@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 org.traccar;

import org.traccar.helper.Log;
import org.traccar.model.Position;

public class DefaultDataHandler extends BaseDataHandler {

    @Override
    protected Position handlePosition(Position position) {

        try {
            Context.getDataManager().addPosition(position);
            Context.getDataManager().updateLatestPosition(position);
        } catch (Exception error) {
            Log.warning(error);
        }

        return position;
    }

}

/*
 * Copyright 2015 Anton Tananaev (anton.tananaev@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 org.traccar;

import org.traccar.helper.Log;
import org.traccar.model.Position;

public class DefaultDataHandler extends BaseDataHandler {

    @Override
    protected Position handlePosition(Position position) {

        try {
            Context.getDataManager().addPosition(position);
            Position lastPosition = Context.getConnectionManager().getLastPosition(position.getDeviceId());
            if (position.getFixTime().compareTo(lastPosition.getFixTime()) > 0) {
                Context.getDataManager().updateLatestPosition(position);
            }
        } catch (Exception error) {
            Log.warning(error);
        }

        return position;
    }

}

Update position only when latest


/*
 ** 2013 August 11
 **
 ** The author disclaims copyright to this source code.  In place of
 ** a legal notice, here is a blessing:
 **    May you do good and not evil.
 **    May you find forgiveness for yourself and forgive others.
 **    May you share freely, never taking more than you give.
 */
package info.ata4.disunity.cli;

import com.beust.jcommander.Parameter;

/**
 * DisUnity configuration class.
 *
 * @author Nico Bergemann <barracuda415 at yahoo.de>
 */
public class DisUnityOptions {

    @Parameter(
        names = {"-h", "--help"},
        description = "Print this help.",
        help = true
    )
    private boolean help;

    @Parameter(
        names = { "-v", "--verbose" },
        description = "Show more verbose log output."
    )
    private boolean verbose;

    @Parameter(
        names = { "-f", "--output-format" },
        description = "Set output text format."
    )
    private OutputFormat outputFormat;

    public boolean isHelp() {
        return help;
    }

    public boolean isVerbose() {
        return verbose;
    }

    public OutputFormat getOutputFormat() {
        return outputFormat;
    }
}

/*
 ** 2013 August 11
 **
 ** The author disclaims copyright to this source code.  In place of
 ** a legal notice, here is a blessing:
 **    May you do good and not evil.
 **    May you find forgiveness for yourself and forgive others.
 **    May you share freely, never taking more than you give.
 */
package info.ata4.disunity.cli;

import com.beust.jcommander.Parameter;

/**
 * DisUnity configuration class.
 *
 * @author Nico Bergemann <barracuda415 at yahoo.de>
 */
public class DisUnityOptions {

    @Parameter(
        names = {"-h", "--help"},
        description = "Print this help.",
        help = true
    )
    private boolean help;

    @Parameter(
        names = { "-v", "--verbose" },
        description = "Show more verbose log output."
    )
    private boolean verbose;

    @Parameter(
        names = { "-f", "--output-format" },
        description = "Set output text format."
    )
    private OutputFormat outputFormat = OutputFormat.PLAINTEXT;

    public boolean isHelp() {
        return help;
    }

    public boolean isVerbose() {
        return verbose;
    }

    public OutputFormat getOutputFormat() {
        return outputFormat;
    }
}

Set default output format to plain text


package nuclibook.routes;

import nuclibook.constants.P;
import nuclibook.entity_utils.ExportUtils;
import nuclibook.entity_utils.PatientUtils;
import nuclibook.entity_utils.SecurityUtils;
import nuclibook.models.Patient;
import nuclibook.server.HtmlRenderer;
import spark.Request;
import spark.Response;

import java.util.List;

public class ExportRoute extends DefaultRoute {

    @Override
    public Object handle(Request request, Response response) throws Exception {
        // necessary prelim routine
        prepareToHandle();

        String[] fileSplit = request.params(":file:").split("\\.", 2);
        String table = fileSplit[0];

        String type = "";
        try {
            type = fileSplit[1];
        } catch (ArrayIndexOutOfBoundsException e) {
            return null;
        }

        String exportData = null;

        if (table.equals("patients")) {
            if (SecurityUtils.requirePermission(P.VIEW_PATIENT_LIST, response)) {
                if (type.equals("csv")) {
                    exportData = ExportUtils.exportCSV(Patient.class);
                }
            }
        }

        if (exportData != null) {
            response.header("Content-Disposition", "attachment");
        }

        return exportData;
    }
}

package nuclibook.routes;

import nuclibook.constants.P;
import nuclibook.entity_utils.ActionLogger;
import nuclibook.entity_utils.ExportUtils;
import nuclibook.entity_utils.PatientUtils;
import nuclibook.entity_utils.SecurityUtils;
import nuclibook.models.Patient;
import nuclibook.server.HtmlRenderer;
import spark.Request;
import spark.Response;

import java.util.List;

public class ExportRoute extends DefaultRoute {

    @Override
    public Object handle(Request request, Response response) throws Exception {
        // necessary prelim routine
        prepareToHandle();

        String[] fileSplit = request.params(":file:").split("\\.", 2);
        String table = fileSplit[0];

        String type = "";
        try {
            type = fileSplit[1];
        } catch (ArrayIndexOutOfBoundsException e) {
            return null;
        }

        String exportData = null;

        if (table.equals("patients")) {
            if (SecurityUtils.requirePermission(P.EXPORT_PATIENTS, response)) {
                if (type.equals("csv")) {
                    exportData = ExportUtils.exportCSV(Patient.class);
                }
                ActionLogger.logAction(ActionLogger.EXPORT_PATIENTS, 0);
            } else {
                ActionLogger.logAction(ActionLogger.ATTEMPT_EXPORT_PATIENTS, 0, "Failed as user does not have permissions for this action");
            }
        }

        if (exportData != null) {
            response.header("Content-Disposition", "attachment");
        }

        return exportData;
    }
}

Add export log + permissions


package org.synyx.minos.core.web.support;

import org.synyx.minos.core.web.event.Event;

/**
 * @author Oliver Gierke - gierke@synyx.de
 */
public class ProjectDeletedEvent implements Event {

    private String name;

    /**
     * @param name
     */
    public ProjectDeletedEvent(String name) {

        super();
        this.name = name;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {

        // TODO Auto-generated method stub
        return getClass().getSimpleName() + ": " + name;
    }

}

package org.synyx.minos.core.web.support;

import org.synyx.minos.core.web.event.Event;

/**
 * @author Oliver Gierke - gierke@synyx.de
 */
public class ProjectDeletedEvent implements Event {

    private String name;

    /**
     * @param name
     */
    public ProjectDeletedEvent(String name) {

        super();
        this.name = name;
    }

    @Override
    public String toString() {

        return getClass().getSimpleName() + ": " + name;
    }
}

Comment boyscouting: leaving the comments cleaner than you found them


package org.jvirtanen.nassau.binaryfile;

import org.jvirtanen.nassau.ProtocolException;

public class BinaryFILEException extends ProtocolException {

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

}

package org.jvirtanen.nassau.binaryfile;

import org.jvirtanen.nassau.ProtocolException;

/**
 * Indicates a protocol error while handling the BinaryFILE file format.
 */
public class BinaryFILEException extends ProtocolException {

    /**
     * Construct an instance with the specified detail message.
     *
     * @param message the detail message
     */
    public BinaryFILEException(String message) {
        super(message);
    }

}

Add documentation for BinaryFILE exception


package floobits;

import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.ui.InputValidator;
import com.intellij.openapi.util.text.StringUtil;

public class JoinWorkspace extends AnAction {

    private static class URLInputValidator implements InputValidator {
        @Override
        public boolean canClose(String inputString) {
            return true;
        }

        @Override
        public boolean checkInput(String inputString) {
            try {
                final URL url = new URL(inputString);
                return StringUtil.isNotEmpty(url.getHost());
            } catch (MalformedURLException e) {
                return false;
            }
        }
    }

    public void actionPerformed(AnActionEvent e) {
        String inputValue = JOptionPane.showInputDialog("Workspace URL", "https://floobits.com/kansface/asdf");
        Flog.info(inputValue);
        FloobitsPlugin.joinWorkspace(inputValue);
    }
}

package floobits;

import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.ui.InputValidator;
import com.intellij.openapi.util.text.StringUtil;

public class JoinWorkspace extends AnAction {

    private static class URLInputValidator implements InputValidator {
        @Override
        public boolean canClose(String inputString) {
            return true;
        }

        @Override
        public boolean checkInput(String inputString) {
            try {
                final URL url = new URL(inputString);
                return StringUtil.isNotEmpty(url.getHost());
            } catch (MalformedURLException e) {
                return false;
            }
        }
    }

    public void actionPerformed(AnActionEvent e) {
        String inputValue = JOptionPane.showInputDialog("Workspace URL", "https://floobits.com/");
        Flog.info(inputValue);
        FloobitsPlugin.joinWorkspace(inputValue);
    }
}

Remove kansface repo from input.


/**
 * This file is part of AlmuraSDK, All Rights Reserved.
 *
 * Copyright (c) 2015 AlmuraDev <http://github.com/AlmuraDev/>
 */
package com.almuradev.almurasdk.permissions;

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

public class PermissibleAllMods implements Permissible {

    private Set<Permissible> permissibles = new HashSet<>();

    public void addPermissible(Permissible permissible) {
        this.permissibles.add(permissible);
    }

    @Override
    public String getPermissibleModName() {
        return "all";
    }

    @Override
    public float getPermissibleModVersion() {
        return 0.0F;
    }

    @Override
    public void registerPermissions(PermissionsManagerClient permissionsManager) {
    }

    @Override
    public void onPermissionsCleared(PermissionsManager manager) {
        for (Permissible permissible : this.permissibles) {
            permissible.onPermissionsCleared(manager);
        }
    }

    @Override
    public void onPermissionsChanged(PermissionsManager manager) {
        for (Permissible permissible : this.permissibles) {
            permissible.onPermissionsChanged(manager);
        }
    }
}

/**
 * This file is part of AlmuraSDK, All Rights Reserved.
 *
 * Copyright (c) 2015 AlmuraDev <http://github.com/AlmuraDev/>
 */
package com.almuradev.almurasdk.permissions;

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

public class PermissibleAllMods implements Permissible {

    private Set<Permissible> permissibles = new HashSet<>();

    public void addPermissible(Permissible permissible) {
        this.permissibles.add(permissible);
    }

    @Override
    public String getPermissibleModName() {
        return "all";
    }

    @Override
    public float getPermissibleModVersion() {
        return 0.0F;
    }

    @Override
    public void registerPermissions(PermissionsManager permissionsManager) {
    }

    @Override
    public void onPermissionsCleared(PermissionsManager manager) {
        for (Permissible permissible : this.permissibles) {
            permissible.onPermissionsCleared(manager);
        }
    }

    @Override
    public void onPermissionsChanged(PermissionsManager manager) {
        for (Permissible permissible : this.permissibles) {
            permissible.onPermissionsChanged(manager);
        }
    }
}

Update build.gradle and fix compilation


package com.samovich.java.basics.collections.list.arraylist;

/**
 * Created by Samovich on 1/20/2015.
 */
public class ArrayListForEach {
}

/**
 * @file ArrayListForEach.java
 * @author Valery Samovich
 * @version 1
 * @date 2014/01/09
 */

/*
 *  Following code shows an example how to create a Collection of type List
 *  which is parameterized with <String> to indicate to the Java compiler
 *  that only Strings are allowed in this list.
 */
package com.samovich.java.basics.collections.list.arraylist;

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

public class ArrayListForEach {

    public static void main(String[] args) {

        // Create a list, use is ArrayList as concrete type
        // ArrayList<> infers the String type from the left side
        List<String> myList = new ArrayList<String>();

        myList.add("string1");
        myList.add("string2");
        myList.add("string3");

        // Loop over it and print the result to the console
        for(String value : myList) {
            System.out.println(value);
        }
    }
}

Refactor the code and add the ArrayList with For Statement


package net.squanchy.eventdetails.widget;

import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.util.AttributeSet;

import net.squanchy.R;
import net.squanchy.schedule.domain.view.Event;

public class EventDetailsCoordinatorLayout extends CoordinatorLayout {

    private FloatingActionButton floatingActionButton;
    private EventDetailsHeaderLayout headerLayout;
    private EventDetailsLayout detailsLayout;

    public EventDetailsCoordinatorLayout(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public EventDetailsCoordinatorLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();

        floatingActionButton = (FloatingActionButton) findViewById(R.id.favorite_fab);
        headerLayout = (EventDetailsHeaderLayout) findViewById(R.id.event_details_header);
        detailsLayout = (EventDetailsLayout) findViewById(R.id.event_details);
    }

    public void updateWith(Event event) {
        headerLayout.updateWith(event);
        detailsLayout.updateWith(event);
    }
}

package net.squanchy.eventdetails.widget;

import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.util.AttributeSet;

import net.squanchy.R;
import net.squanchy.schedule.domain.view.Event;

public class EventDetailsCoordinatorLayout extends CoordinatorLayout {

    private FloatingActionButton floatingActionButton;
    private EventDetailsHeaderLayout headerLayout;
    private EventDetailsLayout detailsLayout;

    public EventDetailsCoordinatorLayout(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public EventDetailsCoordinatorLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();

        floatingActionButton = (FloatingActionButton) findViewById(R.id.favorite_fab);
        headerLayout = (EventDetailsHeaderLayout) findViewById(R.id.event_details_header);
        detailsLayout = (EventDetailsLayout) findViewById(R.id.event_details);
    }

    public void updateWith(Event event) {
        headerLayout.updateWith(event);
        detailsLayout.updateWith(event);

        floatingActionButton.setImageResource(
                event.favorited() ?
                        R.drawable.ic_favorite_filled :
                        R.drawable.ic_favorite_empty
        );
    }
}

Swap FAB icon based on favorite status


package com.github.games647.changeskin.bungee.listener;

import com.github.games647.changeskin.bungee.ChangeSkinBungee;
import com.github.games647.changeskin.core.SkinData;
import com.github.games647.changeskin.core.UserPreference;

import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.event.EventPriority;

public class JoinListener extends AbstractSkinListener {

    public JoinListener(ChangeSkinBungee plugin) {
        super(plugin);
    }

    @EventHandler(priority = EventPriority.HIGH)
    public void onPlayerLogin(PostLoginEvent postLoginEvent) {
        ProxiedPlayer player = postLoginEvent.getPlayer();

        //updates to the chosen one
        UserPreference preferences = plugin.getLoginSession(player.getPendingConnection());
        SkinData targetSkin = preferences.getTargetSkin();
        if (targetSkin == null) {
            setRandomSkin(preferences, player);
        } else {
            plugin.applySkin(player, targetSkin);
        }
    }
}

package com.github.games647.changeskin.bungee.listener;

import com.github.games647.changeskin.bungee.ChangeSkinBungee;
import com.github.games647.changeskin.core.SkinData;
import com.github.games647.changeskin.core.UserPreference;

import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.event.EventPriority;

public class JoinListener extends AbstractSkinListener {

    public JoinListener(ChangeSkinBungee plugin) {
        super(plugin);
    }

    @EventHandler(priority = EventPriority.HIGH)
    public void onPlayerLogin(PostLoginEvent postLoginEvent) {
        ProxiedPlayer player = postLoginEvent.getPlayer();

        //updates to the chosen one
        UserPreference preferences = plugin.getLoginSession(player.getPendingConnection());
        if (preferences == null) {
            return;
        }

        SkinData targetSkin = preferences.getTargetSkin();
        if (targetSkin == null) {
            setRandomSkin(preferences, player);
        } else {
            plugin.applySkin(player, targetSkin);
        }
    }
}

Fix NPE on bungeecord lazy loading


package de.retest.recheck.persistence;

/**
 * Extends the standard {@link ClassAndMethodBasedNamingStrategy}, but instead of the qualified class name (e.g.
 * `com.mycompany.MyTest`) returns the {@link Class#getSimpleName()} of the class (e.g. `MyTest`).
 */
public class ClassAndMethodBasedShortNamingStrategy extends ClassAndMethodBasedNamingStrategy {

	/**
	 * @return The {@link Class#getSimpleName()} of the test class (e.g. `MyTest`).
	 */
	@Override
	public String getSuiteName() {
		String result = super.getSuiteName();
		if ( result.contains( "." ) ) {
			result = result.substring( result.lastIndexOf( "." ) + 1 );
		}
		if ( result.contains( "$" ) ) {
			result = result.substring( 0, result.indexOf( "$" ) );
		}
		return result;
	}
}

package de.retest.recheck.persistence;

/**
 * Extends the standard {@link ClassAndMethodBasedNamingStrategy}, but instead of the qualified class name (e.g.
 * `com.mycompany.MyTest`) returns the {@link Class#getSimpleName()} of the class (e.g. `MyTest`).
 */
public class ClassAndMethodBasedShortNamingStrategy extends ClassAndMethodBasedNamingStrategy {

	/**
	 * @return The {@link Class#getSimpleName()} of the test class (e.g. `MyTest`).
	 */
	@Override
	public String getSuiteName() {
		String result = super.getSuiteName();
		if ( result.contains( "." ) ) {
			result = result.substring( result.lastIndexOf( '.' ) + 1 );
		}
		if ( result.contains( "$" ) ) {
			result = result.substring( 0, result.indexOf( '$' ) );
		}
		return result;
	}
}

Change to single quotes for faster lastInfexOf


package io.github.tatools.sunshine.core;

import java.util.List;

/**
 * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com)
 * @version $Id$
 * @since 0.1
 */
public final class SunshineSuitePrintable implements SunshineSuite {

    private final SunshineSuite sunshineSuite;

    public SunshineSuitePrintable(SunshineSuite sunshineSuite) {
        this.sunshineSuite = sunshineSuite;
    }

    @Override
    public List<SunshineTest> tests() throws SuiteException {
        System.out.println("Sunshine suite contains the following tests:");
        this.sunshineSuite.tests().forEach(System.out::println);
        return this.sunshineSuite.tests();
    }
}

package io.github.tatools.sunshine.core;

import java.util.List;

/**
 * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com)
 * @version $Id$
 * @since 0.1
 */
public final class SunshineSuitePrintable implements SunshineSuite {

    private final SunshineSuite sunshineSuite;

    public SunshineSuitePrintable(SunshineSuite sunshineSuite) {
        this.sunshineSuite = sunshineSuite;
    }

    @Override
    public List<SunshineTest> tests() throws SuiteException {
        final List<SunshineTest> tests = this.sunshineSuite.tests();
        final StringBuilder message = new StringBuilder();
        message.append("Sunshine found ")
                .append(tests.size())
                .append(" classes by the specified pattern. They all will be passed to appropriate xUnit engine.")
                .append("\nClasses:");
        tests.forEach(c -> message.append("\n- ").append(c));
        System.out.println(message);
        return tests;
    }
}

Print found classes count and their names


package info.u_team.u_team_core.util.registry;

import java.util.function.Supplier;

import info.u_team.u_team_core.api.registry.IUBlockRegistryType;
import net.minecraft.block.Block;
import net.minecraft.item.*;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.*;

public class BlockDeferredRegister {

	public final DeferredRegister<Block> blocks;
	public final DeferredRegister<Item> items;

	public BlockDeferredRegister(String modid) {
		blocks = DeferredRegister.create(ForgeRegistries.BLOCKS, modid);
		items = DeferredRegister.create(ForgeRegistries.ITEMS, modid);
	}

	public <B extends Block & IUBlockRegistryType, I extends BlockItem> BlockRegistryObject<B, I> register(String name, Supplier<? extends B> supplier) {
		final RegistryObject<B> block = blocks.register(name, supplier);
		final RegistryObject<I> item = RegistryObject.of(new ResourceLocation(name), ForgeRegistries.ITEMS);

		return new BlockRegistryObject<B, I>(block, item);
	}

	public void register(IEventBus bus) {
		blocks.register(bus);
		items.register(bus);
	}

}

package info.u_team.u_team_core.util.registry;

import java.util.function.Supplier;

import info.u_team.u_team_core.api.registry.IUBlockRegistryType;
import net.minecraft.block.Block;
import net.minecraft.item.*;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.*;

public class BlockDeferredRegister {

	public final DeferredRegister<Block> blocks;

	public BlockDeferredRegister(String modid) {
		blocks = DeferredRegister.create(ForgeRegistries.BLOCKS, modid);
	}

	public <B extends Block & IUBlockRegistryType, I extends BlockItem> BlockRegistryObject<B, I> register(String name, Supplier<? extends B> supplier) {
		final RegistryObject<B> block = blocks.register(name, supplier);
		final RegistryObject<I> item = RegistryObject.of(new ResourceLocation(name), ForgeRegistries.ITEMS);

		return new BlockRegistryObject<B, I>(block, item);
	}

	public void register(IEventBus bus) {
		blocks.register(bus);
	}

}

Remove unused item deferred register in block deferred register


/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.

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

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

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

package org.tensorflow.lite;

import static com.google.common.truth.Truth.assertThat;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests for {@link org.tensorflow.lite.TensorFlowLite}. */
@RunWith(JUnit4.class)
public final class TensorFlowLiteTest {

  @Test
  @SuppressWarnings("deprecation")
  public void testVersion() {
    assertThat(TensorFlowLite.version()).isEqualTo("3");
  }

  @Test
  public void testSchemaVersion() {
    assertThat(TensorFlowLite.schemaVersion()).isEqualTo("3");
  }

  @Test
  public void testRuntimeVersion() {
    assertThat(TensorFlowLite.runtimeVersion()).startsWith("1.");
  }
}

/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.

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

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

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

package org.tensorflow.lite;

import static com.google.common.truth.Truth.assertThat;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests for {@link org.tensorflow.lite.TensorFlowLite}. */
@RunWith(JUnit4.class)
public final class TensorFlowLiteTest {

  @Test
  @SuppressWarnings("deprecation")
  public void testVersion() {
    assertThat(TensorFlowLite.version()).isEqualTo("3");
  }

  @Test
  public void testSchemaVersion() {
    assertThat(TensorFlowLite.schemaVersion()).isEqualTo("3");
  }

  @Test
  public void testRuntimeVersion() {
    // Unlike the schema version, which should almost never change, the runtime version can change
    // with some frequency, so simply ensure that it's non-empty and doesn't fail.
    assertThat(TensorFlowLite.runtimeVersion()).isNotEmpty();
  }
}

Fix brittle TFLite Java version test


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

import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.VFS;

/**
 * Simply changed the last modification time of the given file
 */
public class ChangeLastModificationTime
{
    public static void main(String[] args) throws Exception
    {
        if (args.length == 0)
        {
            System.err.println("Please pass the name of a file as parameter.");
            return;
        }

        FileObject fo = VFS.getManager().resolveFile(args[0]);
        long setTo = System.currentTimeMillis();
        System.err.println("set to: " + setTo);
        fo.getContent().setLastModifiedTime(setTo);
        System.err.println("after set: " + fo.getContent().getLastModifiedTime());
    }
}

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

import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.VFS;

/**
 * Simply changed the last modification time of the given file.
 */
public class ChangeLastModificationTime
{
    public static void main(String[] args) throws Exception
    {
        if (args.length == 0)
        {
            System.err.println("Please pass the name of a file as parameter.");
            return;
        }

        FileObject fo = VFS.getManager().resolveFile(args[0]);
        long setTo = System.currentTimeMillis();
        System.err.println("set to: " + setTo);
        fo.getContent().setLastModifiedTime(setTo);
        System.err.println("after set: " + fo.getContent().getLastModifiedTime());
    }
}

Fix Checkstyle issues: First sentence should end with a period.


package modules.admin.User.actions;

import modules.admin.domain.Contact;
import modules.admin.domain.Contact.ContactType;
import modules.admin.domain.User;
import modules.admin.domain.User.WizardState;

import org.skyve.metadata.controller.ServerSideAction;
import org.skyve.metadata.controller.ServerSideActionResult;
import org.skyve.web.WebContext;

public class New implements ServerSideAction<User> {
	/**
	 * For Serialization.
	 */
	private static final long serialVersionUID = 7776867319664519408L;

	@Override
	public ServerSideActionResult<User> execute(User adminUser, WebContext webContext) throws Exception {

		// Clear out old matches
		adminUser.getCandidateContacts().clear();

		Contact contact = Contact.newInstance();
		String searchContactName = adminUser.getSearchContactName();
		if (searchContactName == null) {
			searchContactName = "<New Person>";
		}
		contact.setName(searchContactName);
		contact.setEmail1(adminUser.getSearchEmail());
		contact.setContactType(ContactType.person);
		adminUser.setContact(contact);

		adminUser.setWizardState(WizardState.createContact);

		return new ServerSideActionResult<>(adminUser);
	}
}

package modules.admin.User.actions;

import org.skyve.metadata.controller.ServerSideAction;
import org.skyve.metadata.controller.ServerSideActionResult;
import org.skyve.web.WebContext;

import modules.admin.domain.Contact;
import modules.admin.domain.Contact.ContactType;
import modules.admin.domain.User;
import modules.admin.domain.User.WizardState;

public class New implements ServerSideAction<User> {

	private static final long serialVersionUID = 7776867319664519408L;

	@Override
	public ServerSideActionResult<User> execute(User adminUser, WebContext webContext) throws Exception {

		// Clear out old matches
		adminUser.getCandidateContacts().clear();

		Contact contact = Contact.newInstance();
		String searchContactName = adminUser.getSearchContactName();
		contact.setName(searchContactName);
		contact.setEmail1(adminUser.getSearchEmail());
		contact.setContactType(ContactType.person);
		adminUser.setContact(contact);

		adminUser.setWizardState(WizardState.createContact);

		return new ServerSideActionResult<>(adminUser);
	}
}

Remove confusing contact name placeholder value during new user creation.


package info.u_team.u_team_test.integration;

import org.apache.logging.log4j.*;

import info.u_team.u_team_core.api.integration.*;

@Integration("uteamcore")
public class TestIntegrationCall implements IModIntegration {

	public static final Logger LOGGER = LogManager.getLogger("IntegrationCall");

	static {
		LOGGER.info("Integration call is cinit!");
	}

	@Override
	public void construct() {
		LOGGER.info("Integration call is constructed!");
	}

}

package info.u_team.u_team_test.integration;

import org.apache.logging.log4j.*;

import info.u_team.u_team_core.api.integration.*;
import info.u_team.u_team_test.TestMod;

@Integration(modid = TestMod.MODID, integration = "uteamcore")
public class TestIntegrationCall implements IModIntegration {

	public static final Logger LOGGER = LogManager.getLogger("IntegrationCall");

	static {
		LOGGER.info("Integration call is cinit!");
	}

	@Override
	public void construct() {
		LOGGER.info("Integration call is constructed!");
	}

}

Add the new modid field in the integration call


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.stuy.commands;

import edu.wpi.first.wpilibj.Compressor;
import java.lang.Math;

/**
 *
 * @author Kevin Wang
 */
public class DriveManualJoystickControl extends CommandBase {

    public DriveManualJoystickControl() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(drivetrain);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        drivetrain.compressor.start();

    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        drivetrain.tankDrive(-oi.getLeftStick().getY(), -oi.getRightStick().getY());
        // If we're driving, stop the compressor from turning on. Otherwise, it's fine.
        if ( Math.abs(oi.getLeftStick().getY()) < 0.1  || Math.abs(oi.getRightStick().getY()) < 0.1) {
            drivetrain.compressor.stop();
        } else {
            drivetrain.compressor.start();
        }
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return false;
    }

    // Called once after isFinished returns true
    protected void end() {
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.stuy.commands;

import edu.wpi.first.wpilibj.Compressor;
import java.lang.Math;

/**
 *
 * @author Kevin Wang
 */
public class DriveManualJoystickControl extends CommandBase {

    public DriveManualJoystickControl() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(drivetrain);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        drivetrain.compressor.start();

    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        drivetrain.tankDrive(-oi.getLeftStick().getY(), -oi.getRightStick().getY());
        // If we're driving, stop the compressor from turning on. Otherwise, it's fine.
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return false;
    }

    // Called once after isFinished returns true
    protected void end() {
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}

Remove compressor disablement while driving


package by.triumgroup.recourse.supplier.entity.model;

import by.triumgroup.recourse.entity.model.BaseEntity;
import org.springframework.data.util.Pair;

public interface EntityIntegerPKSupplier<E extends BaseEntity<Integer>> extends EntitySupplier<E, Integer>{
    @Override
    default Integer getAnyId(){
        return 1;
    }

    @Override
    default Pair<Integer, Integer> getDifferentIds(){
        return Pair.of(1, 2);
    }
}

package by.triumgroup.recourse.supplier.entity.model;

import by.triumgroup.recourse.entity.model.BaseEntity;
import org.springframework.data.util.Pair;

import java.util.Random;

public interface EntityIntegerPKSupplier<E extends BaseEntity<Integer>> extends EntitySupplier<E, Integer>{
    @Override
    default Integer getAnyId(){
        return new Random().ints(1, Integer.MAX_VALUE).findFirst().getAsInt();
    }

    @Override
    default Pair<Integer, Integer> getDifferentIds(){
        Integer first = getAnyId();
        Integer second = first + 1;
        return Pair.of(first, second);
    }
}

Add random id generating for tests


package com.galvarez.ttw.model.components;

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

import com.artemis.Component;
import com.artemis.Entity;
import com.galvarez.ttw.model.DiplomaticSystem.Action;
import com.galvarez.ttw.model.DiplomaticSystem.State;

public final class Diplomacy extends Component {

  public final Map<Entity, State> relations = new HashMap<>();

  public final Map<Entity, Integer> lastChange = new HashMap<>();

  public final Map<Entity, Action> proposals = new HashMap<>();

  public final EnumSet<State> knownStates = EnumSet.of(State.NONE);

  public Diplomacy() {
  }

  public State getRelationWith(Entity other) {
    State state = relations.get(other);
    return state != null ? state : State.NONE;
  }

  public Action getProposalTo(Entity other) {
    Action action = proposals.get(other);
    return action != null ? action : Action.NO_CHANGE;
  }

}

package com.galvarez.ttw.model.components;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import com.artemis.Component;
import com.artemis.Entity;
import com.galvarez.ttw.model.DiplomaticSystem.Action;
import com.galvarez.ttw.model.DiplomaticSystem.State;

public final class Diplomacy extends Component {

  public final Map<Entity, State> relations = new HashMap<>();

  public final Map<Entity, Integer> lastChange = new HashMap<>();

  public final Map<Entity, Action> proposals = new HashMap<>();

  public final EnumSet<State> knownStates = EnumSet.of(State.NONE);

  public Diplomacy() {
  }

  public State getRelationWith(Entity other) {
    State state = relations.get(other);
    return state != null ? state : State.NONE;
  }

  public Action getProposalTo(Entity other) {
    Action action = proposals.get(other);
    return action != null ? action : Action.NO_CHANGE;
  }

  /** Get all empires whose state is the one passed as a parameter. */
  public List<Entity> getEmpires(State state) {
    List<Entity> others = new ArrayList<Entity>();
    for (Entry<Entity, State> e : relations.entrySet()) {
      if (e.getValue() == state)
        others.add(e.getKey());
    }
    return others;
  }

}

Add helper method to get all the empires we have some relation with.


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

package androidx.navigation;

/**
 * Dummy file, because android gradle plugin requires not empty sources
 */
public class Foo {
}

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

package androidx.navigation;

/**
 * Placeholder file, because android gradle plugin requires not empty sources
 */
public class Foo {
}

Update language to comply with Android's inclusive language guidance


package com.pushtechnology.adapters.rest.model.latest;

import java.util.List;

import com.pushtechnology.adapters.rest.model.AnyModel;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Value;

/**
 * Configuration model. Version 4.
 *
 * @author Push Technology Limited
 */
@Value
@Builder
@AllArgsConstructor
public class Model implements AnyModel {
    /**
     * The version of the model.
     */
    public static final int VERSION = 3;

    /**
     * The Diffusion server.
     */
    private Diffusion diffusion;

    /**
     * The REST services to poll.
     */
    List<Service> services;
}

package com.pushtechnology.adapters.rest.model.latest;

import java.util.List;

import com.pushtechnology.adapters.rest.model.AnyModel;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Value;

/**
 * Configuration model. Version 4.
 *
 * @author Push Technology Limited
 */
@Value
@Builder
@AllArgsConstructor
public class Model implements AnyModel {
    /**
     * The version of the model.
     */
    public static final int VERSION = 4;

    /**
     * The Diffusion server.
     */
    private Diffusion diffusion;

    /**
     * The REST services to poll.
     */
    List<Service> services;
}

Correct the version number of the lastest model.


package com.wakatime.android.support.log;

import android.util.Log;

import com.crashlytics.android.Crashlytics;

import timber.log.Timber;

/**
 * @author Joao Pedro Evangelista
 */
public class CrashlyticsTree extends Timber.Tree {
    private static String formatMessage(String message, Throwable throwable) {
        String traceAsString = Log.getStackTraceString(throwable);
        return String.format("%s. Nested exception is: %s", message, traceAsString);
    }

    @Override
    protected void log(int priority, String tag, String message, Throwable t) {
        if (priority == Log.ERROR) {
            Crashlytics.log(priority, tag, formatMessage(message, t));
        } else {
            Log.println(priority, tag, formatMessage(message, t));
        }
    }
}

package com.wakatime.android.support.log;

import android.util.Log;

import com.crashlytics.android.Crashlytics;

import timber.log.Timber;

/**
 * @author Joao Pedro Evangelista
 */
public class CrashlyticsTree extends Timber.Tree {
    private static String formatMessage(String message, Throwable throwable) {
        String traceAsString = Log.getStackTraceString(throwable);
        return String.format("%s. Nested exception is: %s", message, traceAsString);
    }

    @Override
    protected void log(int priority, String tag, String message, Throwable t) {
        if (priority == Log.ERROR) {
            Crashlytics.log(priority, tag, formatMessage(message, t));
        }
    }
}

Make Crashlytics Tree handle only errors


package com.jmb.springfactory.service.productionschedule;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jmb.springfactory.dao.GenericMySQLService;
import com.jmb.springfactory.dao.productionschedule.ProductionScheduleMySQLService;
import com.jmb.springfactory.model.bo.BusinessObjectBase;
import com.jmb.springfactory.model.dto.ProductionScheduleDto;
import com.jmb.springfactory.model.entity.ProductionSchedule;
import com.jmb.springfactory.service.GenericServiceImpl;

@Service
public class ProductionScheduleServiceImpl extends GenericServiceImpl<ProductionSchedule, ProductionScheduleDto,
  BusinessObjectBase, Integer> implements ProductionScheduleService {

  @Autowired
  private ProductionScheduleMySQLService productionScheduleMySQLService;

  @Override
  public GenericMySQLService<ProductionSchedule, Integer> genericDao() {
    return productionScheduleMySQLService;
  }

  @Override
  public Class<? extends ProductionSchedule> getClazz() {
    return ProductionSchedule.class;
  }

  @Override
  public Class<? extends ProductionScheduleDto> getDtoClazz() {
    return ProductionScheduleDto.class;
  }

  @Override
  public Class<? extends BusinessObjectBase> getBoClazz() {
    return BusinessObjectBase.class;
  }

}

package com.jmb.springfactory.service.productionschedule;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jmb.springfactory.dao.GenericMySQLService;
import com.jmb.springfactory.dao.productionschedule.ProductionScheduleMySQLService;
import com.jmb.springfactory.exceptions.ServiceLayerException;
import com.jmb.springfactory.model.bo.BusinessObjectBase;
import com.jmb.springfactory.model.dto.ProductionScheduleDto;
import com.jmb.springfactory.model.entity.ProductionSchedule;
import com.jmb.springfactory.model.enumeration.ProductionScheduleStateEnum;
import com.jmb.springfactory.service.GenericServiceImpl;

@Service
public class ProductionScheduleServiceImpl extends GenericServiceImpl<ProductionSchedule, ProductionScheduleDto,
  BusinessObjectBase, Integer> implements ProductionScheduleService {

  @Autowired
  private ProductionScheduleMySQLService productionScheduleMySQLService;

  @Override
  public GenericMySQLService<ProductionSchedule, Integer> genericDao() {
    return productionScheduleMySQLService;
  }

  @Override
  public Class<? extends ProductionSchedule> getClazz() {
    return ProductionSchedule.class;
  }

  @Override
  public Class<? extends ProductionScheduleDto> getDtoClazz() {
    return ProductionScheduleDto.class;
  }

  @Override
  public Class<? extends BusinessObjectBase> getBoClazz() {
    return BusinessObjectBase.class;
  }

  @Override
  public ProductionScheduleDto save(ProductionScheduleDto schedule) throws ServiceLayerException {
    schedule.setState(ProductionScheduleStateEnum.OPEN.name());
    return super.save(schedule);
  }

}

Set schedule status as OPEN when it is created


package com.github.valfirst.jbehave.junit.monitoring;

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

import static org.junit.Assert.assertTrue;

/**
 * Class IgnoredTestsTest.
 *
 * The purpose of this class is to see how an IDE behaves when there is a unit test that passes and a test is ignored.
 *
 * The result in IntelliJ 2017.2.5 Community Edition is that there are two lines of info reported about test outcomes:
 * (OK) IgnoredTestsTest
 *      (OK) shouldPass
 *
 * This implies to me that the jbehave-junit-runner should behave similarly that even if there are stories/scenarios
 * that are ignored (via meta tag filtering) then the highest level node should show (OK) and not (Pending).
 */
public class IgnoredTestsTest {

	@Test
	public void shouldPass() {
		// Nothing to do. Wish this test to pass.
		assertTrue(true);
	}

	@Ignore
	public void shouldBeIgnored() {
		// Nothing to do. Wish this test to be ignored.
		assertTrue(false);
	}
}

package com.github.valfirst.jbehave.junit.monitoring;

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

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

/**
 * Class IgnoredTestsTest.
 *
 * The purpose of this class is to see how an IDE behaves when there is a unit test that passes and a test is ignored.
 *
 * The result in IntelliJ 2017.2.5 Community Edition is that there are two lines of info reported about test outcomes:
 * (OK) IgnoredTestsTest
 *      (OK) shouldPass
 *
 * This implies to me that the jbehave-junit-runner should behave similarly that even if there are stories/scenarios
 * that are ignored (via meta tag filtering) then the highest level node should show (OK) and not (Pending).
 */
public class IgnoredTestsTest {

	@Test
	public void shouldPass() {
		// Nothing to do. Wish this test to pass.
		assertTrue(true);
	}

	@Ignore
	public void shouldBeIgnored() {
		// Nothing to do. Wish this test to be ignored.
		fail();
	}
}

Use Assert.fail instead of Assert.assertTrue(false)


package com.fincatto.documentofiscal.nfe400.classes;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

import com.fincatto.documentofiscal.DFBase;

@Root(name = "protNFe")
public class NFProtocolo extends DFBase {
    private static final long serialVersionUID = -784305871769382618L;

    @Attribute(name = "versao", required = true)
    private String versao;

    @Element(name = "infProt", required = true)
    private NFProtocoloInfo protocoloInfo;

    public void setVersao(final String versao) {
        this.versao = versao;
    }

    public void setProtocoloInfo(final NFProtocoloInfo protocoloInfo) {
        this.protocoloInfo = protocoloInfo;
    }

    public NFProtocoloInfo getProtocoloInfo() {
        return this.protocoloInfo;
    }

    public String getVersao() {
        return this.versao;
    }
}

package com.fincatto.documentofiscal.nfe400.classes;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

import com.fincatto.documentofiscal.DFBase;

@Root(name = "protNFe")
public class NFProtocolo extends DFBase {
    private static final long serialVersionUID = -784305871769382618L;

    @Attribute(name = "versao", required = false)
    private String versao;

    @Element(name = "infProt", required = true)
    private NFProtocoloInfo protocoloInfo;

    public void setVersao(final String versao) {
        this.versao = versao;
    }

    public void setProtocoloInfo(final NFProtocoloInfo protocoloInfo) {
        this.protocoloInfo = protocoloInfo;
    }

    public NFProtocoloInfo getProtocoloInfo() {
        return this.protocoloInfo;
    }

    public String getVersao() {
        return this.versao;
    }
}

Remove obrigatoriedade da versão para retorno da SEFAZ MG


import parse.GreetParser;

public class App {
  public String getGreeting() {
    return "Hello world.";
  }

  /**
   * Main entry point to G2Tutorial.
   *
   * @param  args commandline arguments
   */
  public static void main(String[] args) {
    if (args.length > 0 && args[0].equals("greet")) {
      GreetParser p = new GreetParser(args);
      p.parse();
    } else {
      System.out.println("Available commands:\n\tgreet");
      System.exit(1);
    }
  }
}

import backend.Core;
import java.io.IOException;
import parse.GreetParser;

public class App {
  public String getGreeting() {
    return "Hello world.";
  }

  /**
   * Main entry point to G2Tutorial.
   *
   * @param  args commandline arguments
   */
  public static void main(String[] args) {
    if (args.length < 1) {
      System.out.println("Available commands:\n\tgreet");
      System.exit(1);
    }

    if (args[0].equals("greet")) {
      // Greet just exists as a template for parsing
      GreetParser p = new GreetParser(args);
      p.parse();
    } else if (args[0].equals("init")) {
      // Initializes an empty git repo
      try {
        Core.initCore();
      } catch (IOException e) {
        System.err.println("Could not init g2t");
        e.printStackTrace();
      }
      System.exit(0);
    } else {
      System.out.println("Available commands:\n"
          + "\tgreet, init");
      System.exit(1);
    }
  }
}

Add init as a command


/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
package com.facebook.react.fabric;

// This is a wrapper for the ReactNativeConfig object in C++
public interface ReactNativeConfig {
  boolean getBool(String param);
  int getInt64(String param);
  String getString(String param);
  double getDouble(String param);
}

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
package com.facebook.react.fabric;

// This is a wrapper for the ReactNativeConfig object in C++
public interface ReactNativeConfig {
  /**
   * Get a boolean param by string name. Default should be false.
   *
   * @param param The string name of the parameter being requested.
   */
  boolean getBool(String param);

  /**
   * Get an integer param by string name. Default should be 0.
   *
   * @param param The string name of the parameter being requested.
   */
  int getInt64(String param);

  /**
   * Get a string param by string name. Default should be "", empty string.
   *
   * @param param The string name of the parameter being requested.
   */
  String getString(String param);

  /**
   * Get a double param by string name. Default should be 0.
   *
   * @param param The string name of the parameter being requested.
   */
  double getDouble(String param);
}

Enable support for using new MobileConfigNativeModule in RN Core/Fabric C++


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

import com.google.common.net.HostAndPort;
import org.testcontainers.containers.MongoDBContainer;

import java.io.Closeable;

public class MongoServer
        implements Closeable
{
    private static final int MONGO_PORT = 27017;

    private final MongoDBContainer dockerContainer;

    public MongoServer()
    {
        this("3.4.0");
    }

    public MongoServer(String mongoVersion)
    {
        this.dockerContainer = new MongoDBContainer("mongo:" + mongoVersion)
                .withEnv("MONGO_INITDB_DATABASE", "tpch")
                .withCommand("--bind_ip 0.0.0.0");
        this.dockerContainer.start();
    }

    public HostAndPort getAddress()
    {
        return HostAndPort.fromParts(dockerContainer.getContainerIpAddress(), dockerContainer.getMappedPort(MONGO_PORT));
    }

    @Override
    public void close()
    {
        dockerContainer.close();
    }
}

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

import com.google.common.net.HostAndPort;
import org.testcontainers.containers.MongoDBContainer;

import java.io.Closeable;

public class MongoServer
        implements Closeable
{
    private static final int MONGO_PORT = 27017;

    private final MongoDBContainer dockerContainer;

    public MongoServer()
    {
        this("3.4.0");
    }

    public MongoServer(String mongoVersion)
    {
        this.dockerContainer = new MongoDBContainer("mongo:" + mongoVersion)
                .withStartupAttempts(3)
                .withEnv("MONGO_INITDB_DATABASE", "tpch")
                .withCommand("--bind_ip 0.0.0.0");
        this.dockerContainer.start();
    }

    public HostAndPort getAddress()
    {
        return HostAndPort.fromParts(dockerContainer.getContainerIpAddress(), dockerContainer.getMappedPort(MONGO_PORT));
    }

    @Override
    public void close()
    {
        dockerContainer.close();
    }
}

Increase startup attempts from 1 to 3 in MongoDB container


package com.sys1yagi.databindingsample.databinding;

import com.squareup.picasso.Picasso;
import com.sys1yagi.databindingsample.tools.RoundedCornerTransformation;

import android.content.Context;
import android.databinding.BindingAdapter;
import android.widget.ImageView;

public class ImageLoadAdapter {

    @BindingAdapter({"imageUrl"})
    public static void bindImage(ImageView view, String url) {
        Picasso.with(view.getContext()).load(url).into(view);
    }

    @BindingAdapter({"imageUrl", "corner"})
    public static void bindImage(ImageView view, String url, int corner) {
        Context context = view.getContext();
        Picasso.with(context).load(url)
                .transform(new RoundedCornerTransformation(corner))
                .into(view);
    }
}

package com.sys1yagi.databindingsample.databinding;

import com.squareup.picasso.Picasso;
import com.sys1yagi.databindingsample.tools.RoundedCornerTransformation;

import android.content.Context;
import android.databinding.BindingAdapter;
import android.widget.ImageView;

public class ImageLoadAdapter {

    @BindingAdapter({"bind:imageUrl"})
    public static void bindImage(ImageView view, String url) {
        Picasso.with(view.getContext()).load(url).into(view);
    }

    @BindingAdapter({"bind:imageUrl", "bind:corner"})
    public static void bindImage(ImageView view, String url, int corner) {
        Context context = view.getContext();
        Picasso.with(context).load(url)
                .transform(new RoundedCornerTransformation(corner))
                .into(view);
    }
}

Revert namespace. Should write to distinguish the android namespace.


/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The SF 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.
 */
/**
 * Contains in implementation of a SlingRepository based on Apache Oak.
 * The package is not exported.
 */
package org.apache.sling.oak.server;

Add missing license headers to org.apache.sling.jcr.oak.server


package zero.zd.zquestionnaire;

import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;

import java.io.File;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = MainActivity.class.getSimpleName();

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

        // create a folder
        File folder = new File(Environment.getExternalStorageDirectory().getPath() + "/ZQuestionnaire/");
        if (!folder.exists()) {
            if (!folder.mkdirs()) {
                Log.e(TAG, "Failed on creating folders.");
            }
        }
    }

    public void onClickAnswer(View view) {
        startActivity(LoadQnaActivity.getStartIntent(MainActivity.this));
    }

    public void onClickBuilder(View view) {
        startActivity(QnaBuilderActivity.getStartIntent(MainActivity.this));
    }

}

package zero.zd.zquestionnaire;

import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;

import java.io.File;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = MainActivity.class.getSimpleName();

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

        // create a folder
        File folder = new File(Environment.getExternalStorageDirectory().getPath() + "/ZQuestionnaire/");
        if (!folder.exists()) {
            if (!folder.mkdirs()) Log.e(TAG, "Failed on creating folders.");
        }
    }

    public void onClickAnswer(View view) {
        startActivity(LoadQnaActivity.getStartIntent(MainActivity.this));
    }

    public void onClickBuilder(View view) {
        startActivity(QnaBuilderActivity.getStartIntent(MainActivity.this));
    }

}

Add Logs on Files Creation of Folders


package net.safedata.springboot.training.d02.s04.exceptions;

import net.safedata.springboot.training.d02.s04.dto.MessageDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * The most common exception handlers
 *
 * @author bogdan.solga
 */
@ControllerAdvice
public class ExceptionHandlers {

    private final static Logger LOGGER = LoggerFactory.getLogger(ExceptionHandlers.class);

    @ExceptionHandler(NotFoundException.class)
    @ResponseStatus(value = HttpStatus.NOT_FOUND)
    @ResponseBody
    public MessageDTO notFoundException(final NotFoundException e) {
        return new MessageDTO(e.getMessage());
    }

    @ExceptionHandler(IllegalArgumentException.class)
    @ResponseStatus(value = HttpStatus.BAD_REQUEST)
    @ResponseBody
    public MessageDTO illegalArgumentException(final IllegalArgumentException e) {
        return new MessageDTO(e.getMessage());
    }

    @ExceptionHandler(Exception.class)
    @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
    @ResponseBody
    public MessageDTO internalServerError(final Exception e) {
        LOGGER.error(e.getMessage(), e);

        return new MessageDTO("Oops!");
    }
}

package net.safedata.springboot.training.d02.s04.exceptions;

import net.safedata.springboot.training.d02.s04.dto.MessageDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * The most common exception handlers
 *
 * @author bogdan.solga
 */
@ControllerAdvice
public class ExceptionHandlers {

    private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionHandlers.class);

    @ExceptionHandler(NotFoundException.class)
    @ResponseStatus(value = HttpStatus.NOT_FOUND)
    @ResponseBody
    public MessageDTO notFoundException(final NotFoundException e) {
        return new MessageDTO(e.getMessage());
    }

    @ExceptionHandler(IllegalArgumentException.class)
    @ResponseStatus(value = HttpStatus.BAD_REQUEST)
    @ResponseBody
    public MessageDTO illegalArgumentException(final IllegalArgumentException e) {
        return new MessageDTO(e.getMessage());
    }

    @ExceptionHandler(Exception.class)
    @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
    @ResponseBody
    public MessageDTO internalServerError(final Exception e) {
        LOGGER.error(e.getMessage(), e);

        return new MessageDTO("Oops!");
    }
}

Use the specifiers in the JCC order


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

import com.google.android.exoplayer2.upstream.DataSink;

/**
 * A {@link DataSink.Factory} that produces {@link CacheDataSink}.
 */
public final class CacheDataSinkFactory implements DataSink.Factory {

  private final Cache cache;
  private final long maxCacheFileSize;

  /**
   * @see CacheDataSink#CacheDataSink(Cache, long)
   */
  public CacheDataSinkFactory(Cache cache, long maxCacheFileSize) {
    this.cache = cache;
    this.maxCacheFileSize = maxCacheFileSize;
  }

  @Override
  public DataSink createDataSink() {
    return new CacheDataSink(cache, maxCacheFileSize);
  }

}

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

import com.google.android.exoplayer2.upstream.DataSink;

/**
 * A {@link DataSink.Factory} that produces {@link CacheDataSink}.
 */
public final class CacheDataSinkFactory implements DataSink.Factory {

  private final Cache cache;
  private final long maxCacheFileSize;

  /**
   * @see CacheDataSink#CacheDataSink(Cache, long)
   */
  public CacheDataSinkFactory(Cache cache, long maxCacheFileSize) {
    this.cache = cache;
    this.maxCacheFileSize = maxCacheFileSize;
  }

  @Override
  public DataSink createDataSink() {
    return new CacheDataSink(cache, maxCacheFileSize);
  }

}

Change Sink to Source in license header


package bogush;

import java.io.*;
import java.nio.file.Path;

class LineCounter {
    static int count(Path file) throws IOException {
        try (InputStream is = new BufferedInputStream(new FileInputStream(file.toFile()))) {
            boolean empty = true;
            byte bytes[] = new byte[1024];
            int readChars;
            int count = 0;
            while ((readChars = is.read(bytes)) != -1) {
                empty = false;
                for (int i = 0; i < readChars; ++i) {
                    if (bytes[i] == '\n') {
                        ++count;
                    }
                }
            }
            return (count == 0 && !empty) ? 1 : count;
        }
    }
}

package bogush;

import java.io.*;
import java.nio.file.Path;

class LineCounter {
    static int count(Path file) throws IOException {
        try (InputStream is = new BufferedInputStream(new FileInputStream(file.toFile()))) {
            boolean empty = true;
            byte bytes[] = new byte[1024];
            int readChars;
            int count = 1;
            while ((readChars = is.read(bytes)) != -1) {
                empty = false;
                for (int i = 0; i < readChars; ++i) {
                    if (bytes[i] == '\n') {
                        ++count;
                    }
                }
            }
            if (empty) {
                return 0;
            } else {
                return count;
            }
        }
    }
}

Fix to count 0 on empty files and (amount of line-breaks + 1) on non-empty files


package com.rt2zz.reactnativecontacts;

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.Arrays;
import java.util.Collections;
import java.util.List;

public class ReactNativeContacts implements ReactPackage {

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

        modules.add(new ContactsManager(reactContext));
        return modules;
    }

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

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

package com.rt2zz.reactnativecontacts;

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.Arrays;
import java.util.Collections;
import java.util.List;

public class ReactNativeContacts implements ReactPackage {

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

        modules.add(new ContactsManager(reactContext));
        return modules;
    }

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

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

Fix Compilation Error in React Native 0.47.0


/*
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.yangtools.concepts;

public interface Registration<T> extends AutoCloseable {

    T getInstance();

    /**
     * Unregisters object
     *
     */
    @Override
    public void close() throws Exception;
}

/*
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.yangtools.concepts;

/**
 * Class representing a registration of an object. Such a registration is
 * a proper resource and should be cleaned up when no longer required, so
 * references to the object can be removed. This mechanism lies above the
 * usual Java reference mechanism, as the entity where the object is
 * registered may reside outside of the Java Virtual Machine.
 */
public interface Registration<T> extends AutoCloseable {
    /**
     * Return the object instance.
     *
     * @return Registered object.
     */
    T getInstance();

    /**
     * Unregisters the object. This operation is required not to invoke
     * blocking operations. Implementations which require interaction
     * with outside world must provide guarantees that any work is done
     * behind the scenes and the unregistration process looks as if it
     * has already succeeded once this method returns.
     */
    @Override
    void close() throws Exception;
}

Add registration interface contract definition


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

package co.phoenixlab.discord.api.endpoints;

import co.phoenixlab.discord.api.entities.SelfUser;
import co.phoenixlab.discord.api.request.EditProfileRequest;

import java.awt.image.BufferedImage;

public interface UsersEndpoint {

    BufferedImage getAvatar(long userId, String avatar)
            throws ApiException;

    SelfUser editProfile(EditProfileRequest request)
            throws ApiException;

}

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

package co.phoenixlab.discord.api.endpoints;

import co.phoenixlab.discord.api.entities.Presence;
import co.phoenixlab.discord.api.entities.SelfUser;
import co.phoenixlab.discord.api.request.EditProfileRequest;

import java.awt.image.BufferedImage;

public interface UsersEndpoint {

    BufferedImage getAvatar(long userId, String avatar)
            throws ApiException;

    SelfUser editProfile(EditProfileRequest request)
            throws ApiException;

    void updatePresence(Presence request)
            throws ApiException;

}

Add endpoint for updating own presence


package flyway.asdistats;

import fi.nls.oskari.domain.map.view.Bundle;
import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;
import org.oskari.helpers.AppSetupHelper;

/**
 * Add statsgrid bundle to views that don't have it.
 */
public class V1_0__add_statsgrid_to_geoportal extends BaseJavaMigration {

    public void migrate(Context context) throws Exception {
        AppSetupHelper.addBundleToDefaultAndUserApps(
                context.getConnection(), new Bundle("statsgrid"));
    }
}

package flyway.asdistats;

import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;
import org.oskari.helpers.AppSetupHelper;

/**
 * Add statsgrid bundle to views that don't have it.
 */
public class V1_0__add_statsgrid_to_geoportal extends BaseJavaMigration {

    public void migrate(Context context) throws Exception {
        AppSetupHelper.addBundleToApps(context.getConnection(), "statsgrid");
    }
}

Use string version so we dont need import


package org.spoofax.jsglr2.testset;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Scanner;

import org.spoofax.jsglr2.testset.testinput.TestInput;

public abstract class TestSetInput<ContentType, Input extends TestInput<ContentType>> {

    public enum Type {
        SINGLE, // A single file from the org.spoofax.jsglr2.integration samples resources directory
        INCREMENTAL, // Multiple revisions of a single file, from a folder in the same samples resources directory
        MULTIPLE, // All files with a certain extension from an absolute path
        SIZED // Custom input string of dynamic size based on given argument
    }

    public final Type type;

    protected abstract Input getInput(String filename, ContentType input);

    public abstract List<Input> getInputs() throws IOException;

    protected TestSetInput(Type type) {
        this.type = type;
    }

    protected String getFileAsString(String filename) throws IOException {
        InputStream inputStream = getClass().getResourceAsStream("/samples/" + filename);

        return inputStreamAsString(inputStream);
    }

    protected String inputStreamAsString(InputStream inputStream) throws IOException {
        try(Scanner s = new Scanner(inputStream)) {
            s.useDelimiter("\\A");

            return s.hasNext() ? s.next() : "";
        }
    }

}

package org.spoofax.jsglr2.testset;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Scanner;

import org.spoofax.jsglr2.testset.testinput.TestInput;

public abstract class TestSetInput<ContentType, Input extends TestInput<ContentType>> {

    public enum Type {
        SINGLE, // A single file from the org.spoofax.jsglr2.integration samples resources directory
        INCREMENTAL, // Multiple revisions of a single file, from a folder in the same samples resources directory
        MULTIPLE, // All files with a certain extension from an absolute path
        SIZED // Custom input string of dynamic size based on given argument
    }

    public final Type type;

    protected abstract Input getInput(String filename, ContentType input);

    public abstract List<Input> getInputs() throws IOException;

    protected TestSetInput(Type type) {
        this.type = type;
    }

    protected String getFileAsString(String filename) throws IOException {
        InputStream inputStream = getClass().getResourceAsStream("/samples/" + filename);

        return inputStreamAsString(inputStream);
    }

    protected String inputStreamAsString(InputStream inputStream) throws IOException {
        try(Scanner s = new Scanner(inputStream)) {
            s.useDelimiter("\\A");

            // Replace all characters with codepoint value > 255 with a question mark to avoid parse failures,
            // assuming that they only appear in places where any character is allowed (strings, comments, ...)
            return s.hasNext() ? s.next().replaceAll("[^\\x00-\\xFF]", "?") : "";
        }
    }

}

Replace unicode characters in benchmark data


package org.cyclops.cyclopscore.metadata;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.ForgeRegistries;

/**
 * Item translation key exporter.
 */
public class RegistryExportableItemTranslationKeys implements IRegistryExportable {

    @Override
    public JsonObject export() {
        JsonObject element = new JsonObject();

        JsonArray elements = new JsonArray();
        element.add("items", elements);
        for (ResourceLocation key : ForgeRegistries.ITEMS.getKeys()) {
            Item value = ForgeRegistries.ITEMS.getValue(key);
            ItemStack itemStack = new ItemStack(value);
            String translationKey = itemStack.getTranslationKey();
            if (!translationKey.endsWith(".name")) {
                translationKey += ".name";
            }

            JsonObject object = new JsonObject();
            object.addProperty("translationKey", translationKey);
            object.add("item", IRegistryExportable.serializeItemStack(itemStack));
            elements.add(object);
        }

        return element;
    }

    @Override
    public String getName() {
        return "item_translation_keys";
    }

}

package org.cyclops.cyclopscore.metadata;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.ForgeRegistries;

/**
 * Item translation key exporter.
 */
public class RegistryExportableItemTranslationKeys implements IRegistryExportable {

    @Override
    public JsonObject export() {
        JsonObject element = new JsonObject();

        JsonArray elements = new JsonArray();
        element.add("items", elements);
        for (ResourceLocation key : ForgeRegistries.ITEMS.getKeys()) {
            Item value = ForgeRegistries.ITEMS.getValue(key);
            ItemStack itemStack = new ItemStack(value);
            String translationKey = itemStack.getTranslationKey();

            JsonObject object = new JsonObject();
            object.addProperty("translationKey", translationKey);
            object.add("item", IRegistryExportable.serializeItemStack(itemStack));
            elements.add(object);
        }

        return element;
    }

    @Override
    public String getName() {
        return "item_translation_keys";
    }

}

Fix incorrect translation key metadata export


/*-
 * Copyright 2016 Diamond Light Source Ltd.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.eclipse.dawnsci.analysis.api.processing;

import java.util.List;

/**
 * Interface to set up an operation processing run
 */
public interface IOperationBean {

	public void setDataKey(String dataKey);

	public void setFilePath(String fileName);

	public void setOutputFilePath(String outputFilePath);

	public void setDatasetPath(String datasetPath);

	public void setSlicing(String slicing);

	public void setPersistencePath(String persistencePath);

	public void setAxesNames(List<String>[] axesNames);

	public void setDeletePersistenceFile(boolean deletePersistenceFile);

	public void setXmx(String xmx);

	public void setDataDimensions(int[] dataDimensions);

	public void setReadable(boolean readable);

	public void setName(String name);

	public void setRunDirectory(String visitDir);

	public void setParallelizable(boolean parallelizable);

}

/*-
 * Copyright 2016 Diamond Light Source Ltd.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.eclipse.dawnsci.analysis.api.processing;

import java.util.List;

/**
 * Interface to set up an operation processing run
 */
public interface IOperationBean {

	public void setDataKey(String dataKey);

	public void setFilePath(String fileName);

	public void setOutputFilePath(String outputFilePath);

	public void setDatasetPath(String datasetPath);

	public void setSlicing(String slicing);

	public void setProcessingPath(String persistencePath);

	public void setAxesNames(List<String>[] axesNames);

	public void setDeleteProcessingFile(boolean deletePersistenceFile);

	public void setXmx(String xmx);

	public void setDataDimensions(int[] dataDimensions);

	public void setReadable(boolean readable);

	public void setName(String name);

	public void setRunDirectory(String visitDir);

	public void setParallelizable(boolean parallelizable);

}

Change persistence to processing for clarity


package com.mangopay.entities.subentities;

import com.mangopay.core.Dto;
import com.mangopay.core.interfaces.IPayInPaymentDetails;
import com.mangopay.core.enumerations.DirectDebitType;

/**
 * Class representing the Direct-Debit type for mean of payment in PayIn entity.
 */
public class PayInPaymentDetailsDirectDebit extends Dto implements IPayInPaymentDetails {

    /**
     * Direct debit type.
     */
    public DirectDebitType DirectDebitType;

    /**
     * Mandate identifier.
     */
    public String MandateId;
}

package com.mangopay.entities.subentities;

import com.mangopay.core.Dto;
import com.mangopay.core.interfaces.IPayInPaymentDetails;
import com.mangopay.core.enumerations.DirectDebitType;

/**
 * Class representing the Direct-Debit type for mean of payment in PayIn entity.
 */
public class PayInPaymentDetailsDirectDebit extends Dto implements IPayInPaymentDetails {

    /**
     * Direct debit type.
     */
    public DirectDebitType DirectDebitType;

    /**
     * Mandate identifier.
     */
    public String MandateId;

    /**
     * An optional value to be specified on the user's bank statement
     */
    public String StatementDescriptor;
}

Add StatementDescriptor field for direct debits


package in.twizmwaz.cardinal.module.modules.appliedRegion.type;

import in.twizmwaz.cardinal.module.modules.appliedRegion.AppliedRegion;
import in.twizmwaz.cardinal.module.modules.filter.FilterModule;
import in.twizmwaz.cardinal.module.modules.filter.FilterState;
import in.twizmwaz.cardinal.module.modules.regions.RegionModule;
import in.twizmwaz.cardinal.module.modules.regions.type.BlockRegion;
import in.twizmwaz.cardinal.util.ChatUtils;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;

public class UseRegion extends AppliedRegion {

    public UseRegion(RegionModule region, FilterModule filter, String message) {
        super(region, filter, message);
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        if (event.getClickedBlock() == null) return;
        if (region.contains(new BlockRegion(null, event.getClickedBlock().getLocation().toVector())) && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) && filter.evaluate(event.getPlayer(), event.getClickedBlock(), event).equals(FilterState.DENY)) {
            event.setCancelled(true);
            ChatUtils.sendWarningMessage(event.getPlayer(), message);
        }
    }
}

package in.twizmwaz.cardinal.module.modules.appliedRegion.type;

import in.twizmwaz.cardinal.module.modules.appliedRegion.AppliedRegion;
import in.twizmwaz.cardinal.module.modules.filter.FilterModule;
import in.twizmwaz.cardinal.module.modules.filter.FilterState;
import in.twizmwaz.cardinal.module.modules.regions.RegionModule;
import in.twizmwaz.cardinal.module.modules.regions.type.BlockRegion;
import in.twizmwaz.cardinal.util.ChatUtils;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;

public class UseRegion extends AppliedRegion {

    public UseRegion(RegionModule region, FilterModule filter, String message) {
        super(region, filter, message);
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        if (event.getClickedBlock() == null || (event.getItem() != null && event.getItem().getType().isBlock())) return;
        if (region.contains(new BlockRegion(null, event.getClickedBlock().getLocation().toVector())) && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) && filter.evaluate(event.getPlayer(), event.getClickedBlock(), event).equals(FilterState.DENY)) {
            event.setCancelled(true);
            ChatUtils.sendWarningMessage(event.getPlayer(), message);
        }
    }
}

Fix use regions cancelling interaction with blocks


package org.broadinstitute.sting.gatk.walkers.CNV;

import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.Test;

import java.util.Arrays;

public class SymbolicAllelesIntegrationTest extends WalkerTest {

    public static String baseTestString(String reference, String VCF) {
        return "-T CombineVariants" +
                " -R " + reference +
                " --variant:vcf " + validationDataLocation + VCF +
                " -filteredRecordsMergeType KEEP_IF_ANY_UNFILTERED" +
                " -genotypeMergeOptions REQUIRE_UNIQUE" +
                " -setKey null" +
                " -o %s" +
                " -NO_HEADER";
    }

    @Test
    public void test1() {
        WalkerTestSpec spec = new WalkerTestSpec(
                baseTestString(b36KGReference, "symbolic_alleles_1.vcf"),
                1,
                Arrays.asList("89a1c56f264ac27a2a4be81072473b6f"));
        executeTest("Test symbolic alleles", spec);
    }

    @Test
    public void test2() {
        WalkerTestSpec spec = new WalkerTestSpec(
                baseTestString(b36KGReference, "symbolic_alleles_2.vcf"),
                1,
                Arrays.asList("3008d6f5044bc14801e5c58d985dec72"));
        executeTest("Test symbolic alleles mixed in with non-symbolic alleles", spec);
    }
}

package org.broadinstitute.sting.gatk.walkers.CNV;

import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.Test;

import java.util.Arrays;

public class SymbolicAllelesIntegrationTest extends WalkerTest {

    public static String baseTestString(String reference, String VCF) {
        return "-T CombineVariants" +
                " -R " + reference +
                " --variant:vcf " + validationDataLocation + VCF +
                " -filteredRecordsMergeType KEEP_IF_ANY_UNFILTERED" +
                " -genotypeMergeOptions REQUIRE_UNIQUE" +
                " -setKey null" +
                " -o %s" +
                " -NO_HEADER";
    }

    @Test
    public void test1() {
        WalkerTestSpec spec = new WalkerTestSpec(
                baseTestString(b36KGReference, "symbolic_alleles_1.vcf"),
                1,
                Arrays.asList("89a1c56f264ac27a2a4be81072473b6f"));
        executeTest("Test symbolic alleles", spec);
    }

    @Test
    public void test2() {
        WalkerTestSpec spec = new WalkerTestSpec(
                baseTestString(b36KGReference, "symbolic_alleles_2.vcf"),
                1,
                Arrays.asList("6645babc8c7d46be0da223477c7b1291"));
        executeTest("Test symbolic alleles mixed in with non-symbolic alleles", spec);
    }
}

Revert "Updating md5 for fixed file" because this was fixed properly in unstable (but will break SnpEff if put into Stable).


package devopsdistilled.operp.server.data.repo.items;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import devopsdistilled.operp.server.data.entity.items.Brand;
import devopsdistilled.operp.server.data.entity.items.Item;
import devopsdistilled.operp.server.data.entity.items.Product;

@Repository
public interface ItemRepository extends JpaRepository<Item, Long> {

	List<Item> findByProductAndBrand(Product product, Brand brand);

	List<Item> findByItemName(String itemName);

}

package devopsdistilled.operp.server.data.repo.items;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import devopsdistilled.operp.server.data.entity.items.Brand;
import devopsdistilled.operp.server.data.entity.items.Item;
import devopsdistilled.operp.server.data.entity.items.Product;

@Repository
public interface ItemRepository extends JpaRepository<Item, Long> {

	Item findByProductAndBrand(Product product, Brand brand);

	Item findByItemName(String itemName);

}

Change return type of declared method to new unique constraints


package com.nulabinc.backlog4j.internal.json;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.TimeZone;

/**
 * @author nulab-inc
 */
public abstract class AbstractJSONImplTest {

    protected InternalFactoryJSONImpl factory = new InternalFactoryJSONImpl();
    protected TimeZone timeZone = TimeZone.getTimeZone("Asia/Tokyo") ;

    protected String getJsonString(String resourceFilePath) throws IOException {
        String fileName = SpaceJSONImplTest.class.getClassLoader().getResource(resourceFilePath).getPath();

        byte[] fileContentBytes = Files.readAllBytes(Paths.get(fileName));
        String fileContentStr = new String(fileContentBytes, StandardCharsets.UTF_8);
        return fileContentStr;
    }
}

package com.nulabinc.backlog4j.internal.json;

import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TimeZone;

/**
 * @author nulab-inc
 */
public abstract class AbstractJSONImplTest {

    protected InternalFactoryJSONImpl factory = new InternalFactoryJSONImpl();
    protected TimeZone timeZone = TimeZone.getTimeZone("Asia/Tokyo");

    protected String getJsonString(String resourceFilePath) throws IOException {
        InputStreamReader r = null;
        try {
            r = new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceFilePath), "UTF-8");
            CharArrayWriter writer = new CharArrayWriter();
            char buff[] = new char[4096];
            int size;
            while ((size = r.read(buff)) > 0) {
                writer.write(buff, 0, size);
            }
            return writer.toString();
        } finally {
            if (r != null) {
                r.close();
            }
        }
    }
}

Fix to work in Windows


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

/**
 * @author David BRASSELY (brasseld at gmail.com)
 */
public class Member {

	/**
	 * The name of user member
	 */
    private String username;

    /**
     * The role give to the user
     */
    private TeamRole role;

    public TeamRole getRole() {
        return role;
    }

    public void setRole(TeamRole role) {
        this.role = role;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
}

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

import java.util.Date;

/**
 * @author David BRASSELY (brasseld at gmail.com)
 */
public class Member {

	/**
	 * The name of user member
	 */
    private String username;

    /**
     * The role give to the user
     */
    private TeamRole role;

    /**
     * The membership creation date
     */
    private Date createdAt;

    /**
     * The membership last updated date
     */
    private Date updatedAt;

    public TeamRole getRole() {
        return role;
    }

    public void setRole(TeamRole role) {
        this.role = role;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }
}

Add created_at and updated_at fields