package com.aemreunal.config.controller;

/*
 ***************************
 * Copyright (c) 2014      *
 *                         *
 * This code belongs to:   *
 *                         *
 * @author Ahmet Emre Ünal *
 * S001974                 *
 *                         *
 * aemreunal@gmail.com     *
 * emre.unal@ozu.edu.tr    *
 *                         *
 * aemreunal.com           *
 ***************************
 */

import java.nio.charset.Charset;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import com.aemreunal.controller.BeaconController;

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = { "com.aemreunal" })
//@ContextConfiguration(classes = { CoreTestConfig.class })
public class BeaconControllerTestConfig {
    public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(),
                                                                        MediaType.APPLICATION_JSON.getSubtype(),
                                                                        Charset.forName("utf8"));

    @Bean
    public BeaconController projectController() {
        return new BeaconController();
    }
}

package com.aemreunal.config.controller;

/*
 ***************************
 * Copyright (c) 2014      *
 *                         *
 * This code belongs to:   *
 *                         *
 * @author Ahmet Emre Ünal *
 * S001974                 *
 *                         *
 * aemreunal@gmail.com     *
 * emre.unal@ozu.edu.tr    *
 *                         *
 * aemreunal.com           *
 ***************************
 */

import java.nio.charset.Charset;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import com.aemreunal.controller.BeaconController;
import com.aemreunal.service.BeaconService;

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = { "com.aemreunal" })
//@ContextConfiguration(classes = { CoreTestConfig.class })
public class BeaconControllerTestConfig {
    public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(),
                                                                        MediaType.APPLICATION_JSON.getSubtype(),
                                                                        Charset.forName("utf8"));

    @Bean
    public BeaconController beaconController() {
        return new BeaconController();
    }

    @Bean
    public BeaconService beaconService() {
        return new BeaconService();
    }
}

Fix typo, add beacon service bean


package guitests;

import static seedu.ezdo.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import org.junit.Test;

import seedu.ezdo.logic.commands.SaveCommand;

public class SaveCommandTest extends EzDoGuiTest {

    private final String validDirectory = "./";
    private final String inexistentDirectory = "data/COWABUNGA";

    @Test
    public void save_validDirectory_success() {
        commandBox.runCommand("save " + validDirectory);
        assertResultMessage(String.format(SaveCommand.MESSAGE_SAVE_TASK_SUCCESS,
                validDirectory + SaveCommand.DATA_FILE_NAME));
    }

    @Test
    public void save_invalidFormat_failure() {
        commandBox.runCommand("save");
        assertResultMessage(String.format(MESSAGE_INVALID_COMMAND_FORMAT, SaveCommand.MESSAGE_USAGE));
    }

    @Test
    public void save_inexistentDirectory_failure() {
        commandBox.runCommand("save " + inexistentDirectory);
        assertResultMessage(String.format(SaveCommand.MESSAGE_DIRECTORY_PATH_DOES_NOT_EXIST));
    }

}

package guitests;

import static seedu.ezdo.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import org.junit.Test;

import seedu.ezdo.logic.commands.SaveCommand;

public class SaveCommandTest extends EzDoGuiTest {

    private final String validDirectory = "./";
    private final String inexistentDirectory = "data/COWABUNGA";

    @Test
    public void save_validDirectory_success() {
        commandBox.runCommand("save " + validDirectory);
        assertResultMessage(String.format(SaveCommand.MESSAGE_SAVE_TASK_SUCCESS,
                validDirectory + SaveCommand.DATA_FILE_NAME));
    }

    @Test
    public void save_shortCommand_success() {
        commandBox.runCommand("s " + validDirectory);
        assertResultMessage(String.format(SaveCommand.MESSAGE_SAVE_TASK_SUCCESS,
                validDirectory + SaveCommand.DATA_FILE_NAME));
    }

    @Test
    public void save_invalidFormat_failure() {
        commandBox.runCommand("save");
        assertResultMessage(String.format(MESSAGE_INVALID_COMMAND_FORMAT, SaveCommand.MESSAGE_USAGE));
    }

    @Test
    public void save_inexistentDirectory_failure() {
        commandBox.runCommand("save " + inexistentDirectory);
        assertResultMessage(String.format(SaveCommand.MESSAGE_DIRECTORY_PATH_DOES_NOT_EXIST));
    }

}

Add test for shortened save command


package com.jedrzejewski.slisp.interpreter.specialforms;

import com.jedrzejewski.slisp.TestUtils;
import com.jedrzejewski.slisp.interpreter.Interpreter;
import com.jedrzejewski.slisp.parser.lispobjects.Num;
import org.junit.Assert;
import org.junit.Test;

public class FnFormTest {

    @Test
    public void testBindAndCall() throws Exception {
        Interpreter interpreter = new Interpreter();
        TestUtils.evalString("(set! inc (fn [n] (+ n 1)))", interpreter);
        Assert.assertEquals(
                new Num(2),
                TestUtils.evalString("(inc 1)", interpreter)
        );
    }

    // TODO: add lexical binding test
}

package com.jedrzejewski.slisp.interpreter.specialforms;

import com.jedrzejewski.slisp.TestUtils;
import com.jedrzejewski.slisp.interpreter.Interpreter;
import com.jedrzejewski.slisp.parser.lispobjects.Num;
import org.junit.Assert;
import org.junit.Test;

public class FnFormTest {

    @Test
    public void testBindThenCall() throws Exception {
        Interpreter interpreter = new Interpreter();
        TestUtils.evalString("(set! inc (fn [n] (+ n 1)))", interpreter);
        Assert.assertEquals(
                new Num(2),
                TestUtils.evalString("(inc 1)", interpreter)
        );
    }

    @Test
    public void testDefineAndCall() throws Exception {
        Assert.assertEquals(
                new Num(6),
                TestUtils.evalString("((fn [a b] (* a b)) 3 2)")
        );
    }

    // TODO: add lexical binding test
}

Test calling just defined function


/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 *
 * 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.badlogic.gdx.tests.gwt.client;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
import com.badlogic.gdx.tests.AssetManagerTest;
import com.badlogic.gdx.tests.UITest;
import com.badlogic.gdx.tests.g3d.ModelTest;
import com.badlogic.gdx.tests.gwt.GwtTestWrapper;

public class GwtTestStarter extends GwtApplication {
	@Override
	public GwtApplicationConfiguration getConfig () {
		return new GwtApplicationConfiguration(480, 320);
	}

	@Override
	public ApplicationListener getApplicationListener () {
		return new AssetManagerTest();
	}
}

/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 *
 * 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.badlogic.gdx.tests.gwt.client;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
import com.badlogic.gdx.tests.AssetManagerTest;
import com.badlogic.gdx.tests.UITest;
import com.badlogic.gdx.tests.g3d.ModelTest;
import com.badlogic.gdx.tests.gwt.GwtTestWrapper;

public class GwtTestStarter extends GwtApplication {
	@Override
	public GwtApplicationConfiguration getConfig () {
		return new GwtApplicationConfiguration(480, 320);
	}

	@Override
	public ApplicationListener getApplicationListener () {
		return new GwtTestWrapper();
	}
}

Use GwtTestWrapper for GWT tests


/*
 * Copyright 2021 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.
 */
// @exportToFramework:skipFile()
package androidx.appsearch.app.cts;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.appsearch.app.AppSearchSession;
import androidx.appsearch.platformstorage.PlatformStorage;
import androidx.test.core.app.ApplicationProvider;

import com.google.common.util.concurrent.ListenableFuture;

public class AppSearchSchemaMigrationPlatformCtsTest extends AppSearchSchemaMigrationCtsTestBase{
    @Override
    protected ListenableFuture<AppSearchSession> createSearchSession(@NonNull String dbName) {
        Context context = ApplicationProvider.getApplicationContext();
        return PlatformStorage.createSearchSession(
                new PlatformStorage.SearchContext.Builder(context, dbName).build());
    }
}

/*
 * Copyright 2021 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.
 */
// @exportToFramework:skipFile()
package androidx.appsearch.app.cts;

import android.content.Context;
import android.os.Build;

import androidx.annotation.NonNull;
import androidx.appsearch.app.AppSearchSession;
import androidx.appsearch.platformstorage.PlatformStorage;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.filters.SdkSuppress;

import com.google.common.util.concurrent.ListenableFuture;

@SdkSuppress(minSdkVersion = Build.VERSION_CODES.S)
public class AppSearchSchemaMigrationPlatformCtsTest extends AppSearchSchemaMigrationCtsTestBase{
    @Override
    protected ListenableFuture<AppSearchSession> createSearchSession(@NonNull String dbName) {
        Context context = ApplicationProvider.getApplicationContext();
        return PlatformStorage.createSearchSession(
                new PlatformStorage.SearchContext.Builder(context, dbName).build());
    }
}

Add a missing SDK suppression for migration test on platform backend.


package uk.ac.ebi.quickgo.annotation;

import uk.ac.ebi.quickgo.annotation.service.search.SearchServiceConfig;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

/**
 *
 * The RESTful service configuration for Annotations
 *
 * @author Tony Wardell
 * Date: 26/04/2016
 * Time: 14:41
 * Created with IntelliJ IDEA.
 */
@SpringBootApplication(exclude = {SolrRepositoriesAutoConfiguration.class})
@ComponentScan({"uk.ac.ebi.quickgo.annotation.controller", "uk.ac.ebi.quickgo.rest","uk.ac.ebi.quickgo.common"})
@Import({SearchServiceConfig.class})
public class AnnotationREST {

    /**
     * Ensures that placeholders are replaced with property values
     */
    @Bean
    static PropertySourcesPlaceholderConfigurer propertyPlaceHolderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }

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

package uk.ac.ebi.quickgo.annotation;

import uk.ac.ebi.quickgo.annotation.service.search.SearchServiceConfig;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

/**
 *
 * The RESTful service configuration for Annotations
 *
 * @author Tony Wardell
 * Date: 26/04/2016
 * Time: 14:41
 * Created with IntelliJ IDEA.
 */
@SpringBootApplication(exclude = {SolrRepositoriesAutoConfiguration.class})
@ComponentScan({"uk.ac.ebi.quickgo.annotation.controller", "uk.ac.ebi.quickgo.rest"})
@Import({SearchServiceConfig.class})
public class AnnotationREST {

    /**
     * Ensures that placeholders are replaced with property values
     */
    @Bean
    static PropertySourcesPlaceholderConfigurer propertyPlaceHolderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }

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

Remove component scan for common package - not required obvs.


/*
 * Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
 */

package org.jsimpledb.cli.cmd;

import java.util.Map;

import org.jsimpledb.cli.CliSession;
import org.jsimpledb.parse.ParseException;
import org.jsimpledb.util.ParseContext;

public class SetSchemaVersionCommand extends AbstractCommand {

    public SetSchemaVersionCommand() {
        super("set-schema-version version:int");
    }

    @Override
    public String getHelpSummary() {
        return "Sets the expected schema version";
    }

    @Override
    public String getHelpDetail() {
        return "Sets the expected schema version version number. If no such schema version is recorded in the database,"
          + " and `set-allow-new-schema true' has been invoked, then the current schema will be recorded anew under the"
          + " specified version number.";
    }

    @Override
    public CliSession.Action getAction(CliSession session0, ParseContext ctx, boolean complete, Map<String, Object> params) {
        final int version = (Integer)params.get("version");
        if (version < 0)
            throw new ParseException(ctx, "invalid negative schema version");
        return session -> {
            session.setSchemaVersion(version);
            session.getWriter().println("Set schema version to " + version);
        };
    }
}

/*
 * Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
 */

package org.jsimpledb.cli.cmd;

import java.util.Map;

import org.jsimpledb.cli.CliSession;
import org.jsimpledb.parse.ParseException;
import org.jsimpledb.util.ParseContext;

public class SetSchemaVersionCommand extends AbstractCommand {

    public SetSchemaVersionCommand() {
        super("set-schema-version version:int");
    }

    @Override
    public String getHelpSummary() {
        return "Sets the expected schema version";
    }

    @Override
    public String getHelpDetail() {
        return "Sets the expected schema version version number. If no such schema version is recorded in the database,"
          + " and `set-allow-new-schema true' has been invoked, then the current schema will be recorded anew under the"
          + " specified version number.";
    }

    @Override
    public CliSession.Action getAction(CliSession session0, ParseContext ctx, boolean complete, Map<String, Object> params) {
        final int version = (Integer)params.get("version");
        if (version < -1)
            throw new ParseException(ctx, "invalid negative schema version");
        return session -> {
            session.setSchemaVersion(version);
            session.getWriter().println("Set schema version to " + version);
        };
    }
}

Allow setting schema version to -1.


package main.java.org.usfirst.frc.team1360.robot.autonomous;

import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.command.CommandGroup;
import main.java.org.usfirst.frc.team1360.robot.util.CommandData;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class AutonomousManager
{
    private static final String AUTONOMOUSPACKAGE = AutonomousManager.class.getCanonicalName().replace("AutonomousManager", "");

    public static Command getAction(String name, CommandData commandData)
    {
        Class<?> clazz;
        String path = AUTONOMOUSPACKAGE + name;
        if(!name.contains("groups.") && !name.contains("actions."))
            path = AUTONOMOUSPACKAGE + "actions." + name;

        try
        {
            clazz = Class.forName(path);
            Constructor<?> constructor = clazz.getConstructor(CommandData.class);
            return (Command) constructor.newInstance(commandData);
        }
        catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e)
        {
            e.printStackTrace();
        }
        return null;
    }

    public static CommandGroup getGroup(String name, CommandData commandData)
    {
        return (CommandGroup) getAction("groups." + name, commandData);
    }

}

package org.usfirst.frc.team1360.robot.autonomous;

import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.command.CommandGroup;
import org.usfirst.frc.team1360.robot.util.CommandData;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class AutonomousManager
{
    private static final String AUTONOMOUSPACKAGE = AutonomousManager.class.getCanonicalName().replace("AutonomousManager", "");

    public static Command getAction(String name, CommandData commandData)
    {
        Class<?> clazz;
        String path = AUTONOMOUSPACKAGE + name;
        if(!name.contains("groups.") && !name.contains("actions."))
            path = AUTONOMOUSPACKAGE + "actions." + name;

        try
        {
            clazz = Class.forName(path);
            Constructor<?> constructor = clazz.getConstructor(CommandData.class);
            return (Command) constructor.newInstance(commandData);
        }
        catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e)
        {
            e.printStackTrace();
        }
        return null;
    }

    public static CommandGroup getGroup(String name, CommandData commandData)
    {
        return (CommandGroup) getAction("groups." + name, commandData);
    }

}

Fix ethan's eclipse package issues; Jamie ETHAN - NO MORE ECLIPSE. EVER.


package org.foxbpm.web.model;

import lombok.Data;

/**
 * 业务数据定义
 *
 * @author MEL
 * @date 2014-06-04
 */
@Data
public class BizInfo {
	private String id = "";
	private String name = "";
	private String comment = "";
}

package org.foxbpm.web.model;

import lombok.Data;

/**
 * 业务数据定义
 *
 * @author MEL
 * @date 2014-06-04
 */
public class BizInfo {
	private String id = "";
	private String name = "";
	private String comment = "";

	public String getId() {
		return id;
	}

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

	public String getName() {
		return name;
	}

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

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}
}

DELETE @Data annotation DELETED BY MAENLIANG AT 2014-06-09


/*
 * Copyright 2012 Research Studios Austria Forschungsges.m.b.H. 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 won.owner.camel.routes.fixed;

import org.apache.camel.LoggingLevel;
import org.apache.camel.builder.RouteBuilder;

/**
 * User: LEIH-NB Date: 10.10.13
 */
// TODO: change to asyncronous processing maybe
public class AmqpToJms extends RouteBuilder {
    @Override
    public void configure() {
        from("seda:outgoingMessages?concurrentConsumers=5").routeId("Owner2NodeRoute").choice()
                        .when(header("remoteBrokerEndpoint").isNull())
                        .log(LoggingLevel.ERROR, "could not route message: remoteBrokerEndpoint is null")
                        .throwException(new IllegalArgumentException(
                                        "could not route message: remoteBrokerEndpoint is null"))
                        .otherwise().recipientList(header("remoteBrokerEndpoint"));
    }
}

/*
 * Copyright 2012 Research Studios Austria Forschungsges.m.b.H. 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 won.owner.camel.routes.fixed;

import org.apache.camel.LoggingLevel;
import org.apache.camel.builder.RouteBuilder;

/**
 * User: LEIH-NB Date: 10.10.13
 */
// TODO: change to asyncronous processing maybe
public class AmqpToJms extends RouteBuilder {
    @Override
    public void configure() {
        from("seda:outgoingMessages?concurrentConsumers=1").routeId("Owner2NodeRoute").choice()
                        .when(header("remoteBrokerEndpoint").isNull())
                        .log(LoggingLevel.ERROR, "could not route message: remoteBrokerEndpoint is null")
                        .throwException(new IllegalArgumentException(
                                        "could not route message: remoteBrokerEndpoint is null"))
                        .otherwise().recipientList(header("remoteBrokerEndpoint"));
    }
}

Reduce number of concurrent consumers


package com.codeaffine.extras.imageviewer.internal;

public class ImageViewerPlugin {

  public static final String ID = "com.codeaffine.extras.imageviewer";
  public static final String IMAGE_CONTENT_TYPE_ID = "com.codeaffine.extras.imageviewer.ImageContentType";
}

package com.codeaffine.extras.imageviewer.internal;

public class ImageViewerPlugin {

  public static final String ID = "com.codeaffine.extras.imageviewer";
  public static final String IMAGE_CONTENT_TYPE_ID = "com.codeaffine.extras.imageviewer.ImageContentType";

  private ImageViewerPlugin() { }
}

Add private default constructor to avoid accidential instantiation


package org.talend.dataprep.transformation.pipeline.node;

import java.util.function.Function;
import java.util.function.Predicate;

import org.talend.dataprep.api.dataset.DataSetRow;
import org.talend.dataprep.api.dataset.RowMetadata;

public class FilteredNode extends BasicNode {

    private final Function<RowMetadata, Predicate<DataSetRow>> filter;

    private Predicate<DataSetRow> instance;

    public FilteredNode(Function<RowMetadata, Predicate<DataSetRow>> filter) {
        this.filter = filter;
    }

    @Override
    public void receive(DataSetRow row, RowMetadata metadata) {
        synchronized (filter) {
            if (instance == null) {
                instance = filter.apply(metadata);
            }
        }
        if (instance.test(row)) {
            super.receive(row, metadata);
        }
    }

}

package org.talend.dataprep.transformation.pipeline.node;

import java.util.Collections;
import java.util.function.Function;
import java.util.function.Predicate;

import org.talend.dataprep.api.dataset.DataSetRow;
import org.talend.dataprep.api.dataset.RowMetadata;
import org.talend.dataprep.transformation.pipeline.Signal;

public class FilteredNode extends BasicNode {

    private final Function<RowMetadata, Predicate<DataSetRow>> filter;

    private Predicate<DataSetRow> instance;

    private boolean hasMatchedFilter = false;

    private RowMetadata lastRowMetadata;

    public FilteredNode(Function<RowMetadata, Predicate<DataSetRow>> filter) {
        this.filter = filter;
    }

    @Override
    public void receive(DataSetRow row, RowMetadata metadata) {
        synchronized (filter) {
            if (instance == null) {
                instance = filter.apply(metadata);
            }
        }
        if (instance.test(row)) {
            hasMatchedFilter = true;
            super.receive(row, metadata);
        } else {
            lastRowMetadata = metadata;
        }
    }

    @Override
    public void signal(Signal signal) {
        if (signal == Signal.END_OF_STREAM && !hasMatchedFilter) {
            // Ensure next steps at least receives metadata information.
            final DataSetRow row = new DataSetRow(lastRowMetadata, Collections.emptyMap());
            super.receive(row, lastRowMetadata);
        }
        super.signal(signal);
    }
}

Fix issue in filter out node for empty content


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

package org.gradle.composite.internal;

import org.gradle.api.tasks.TaskReference;

public class IncludedBuildTaskReference implements TaskReference {
    private final String buildName;
    private final String taskPath;

    public IncludedBuildTaskReference(String buildName, String taskPath) {
        this.buildName = buildName;
        this.taskPath = taskPath;
    }

    @Override
    public String getName() {
        return buildName + ":" + taskPath;
    }

    public String getBuildName() {
        return buildName;
    }

    public String getTaskPath() {
        return taskPath;
    }
}

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

package org.gradle.composite.internal;

import org.gradle.api.tasks.TaskReference;

public class IncludedBuildTaskReference implements TaskReference {
    private final String buildName;
    private final String taskPath;

    public IncludedBuildTaskReference(String buildName, String taskPath) {
        this.buildName = buildName;
        this.taskPath = taskPath;
    }

    @Override
    public String getName() {
        return "_" + buildName + taskPath.replace(':', '_');
    }

    public String getBuildName() {
        return buildName;
    }

    public String getTaskPath() {
        return taskPath;
    }
}

Use '_' instead of ':' in synthetic delegate task name


package model;

/**
 * Top-level player container.
 *
 * @author Eli Skeggs
 */
public class PlayerModel {
  public Level level = null;
  public Move move = new Move();
  public int counter = 0;
  public int score = 0;
  public int levelnum;

  public Variation variation = null;
  public PlayerState playerState = PlayerState.NONE;

  public PlayerProgress progress = null;

  /**
   * Create a new player model.
   */
  public PlayerModel() {}

  /**
   * Create a player model from a builder model to enable previews.
   */
  public PlayerModel(BuilderModel model) {
    level = model.level;
  }

  public void discardLevel() {
    // discard the board
    if (level != null) {
      level.discardBoard();
    }
  }

  public void realizeLevel() {
    level.realizeBoard();
    counter = level.rules.initialCounter;
    score = 0;
    variation = level.rules.variation;
  }

  // TODO: be specific, what are we resetting?
  public void reset() {
    playerState = PlayerState.NONE;
    move = null;
  }
}

package model;

/**
 * Top-level player container.
 *
 * @author Eli Skeggs
 */
public class PlayerModel {
  public Level level = null;
  public Move move = new Move();
  public int counter = 0;
  public int score = 0;
  public int levelnum = 0;

  public Variation variation = null;
  public PlayerState playerState = PlayerState.NONE;

  public PlayerProgress progress = null;

  /**
   * Create a new player model.
   */
  public PlayerModel() {}

  /**
   * Create a player model from a builder model to enable previews.
   */
  public PlayerModel(BuilderModel model) {
    level = model.level;
  }

  public void discardLevel() {
    // discard the board
    if (level != null) {
      level.discardBoard();
    }
  }

  public void realizeLevel() {
    level.realizeBoard();
    counter = level.rules.initialCounter;
    score = 0;
    variation = level.rules.variation;
  }

  // TODO: be specific, what are we resetting?
  public void reset() {
    playerState = PlayerState.NONE;
    move = null;
  }
}

Initialize levelnum, just in case


/**
 * Project ElGamal Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Mar 19, 2014.
 */
package com.m4gik;

/**
 * TODO COMMENTS MISSING!
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class ElGamal {

    public Boolean sign() {
        // TODO Auto-generated method stub
        return null;
    }

    public Boolean verify() {
        // TODO Auto-generated method stub
        return null;
    }

}

/**
 * Project ElGamal Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Mar 19, 2014.
 */
package com.m4gik;

import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Random;

/**
 * This class represents implementation of ElGamal algorithm. This class contain
 * operations to sign and verify documents.
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class ElGamal {

    /**
     * The object to code/decode public key.
     */
    private BigInteger alpha;

    /**
     * The filed to keep probable prime value.
     */
    private BigInteger p;

    /**
     * The variable keeping the public key.
     */
    private BigInteger publicKey;

    /**
     * The variable keeping the private key.
     */
    private BigInteger secretKey;

    /**
     * The random instance for generating secure random values.
     */
    private Random secureRandom = new SecureRandom();

    /**
     * The constructor for {@link ElGamal} class, which creates the instance.
     *
     * @param secretKey
     *            The private key.
     */
    public ElGamal(String secretKey) {
        setPrivateKey(secretKey);
        generatePublicKey(this.secretKey);

    }

    /**
     * This method generates public key from private key.
     *
     * @param secretKey
     */
    private void generatePublicKey(BigInteger secretKey) {
        this.p = BigInteger.probablePrime(64, this.secureRandom);
        this.alpha = new BigInteger(Integer.toString(secureRandom.nextInt()));
        this.publicKey = alpha.modPow(secretKey, p);
    }

    /**
     * @param secretKey
     */
    private void setPrivateKey(String secretKey) {
        this.secretKey = new BigInteger(secretKey);
    }

    /**
     *
     * @return
     */
    public Boolean sign(String message) {
        // TODO Auto-generated method stub
        return null;
    }

    /**
     *
     * @return
     */
    public Boolean verify() {
        // TODO Auto-generated method stub
        return null;
    }

}

Create method for generating public key for given private key


package uk.ac.ebi.quickgo.index.annotation;

/**
 * A class for creating stubbed annotations, representing rows of data read from
 * annotation source files.
 *
 * Created 22/04/16
 * @author Edd
 */
class AnnotationMocker {
    static Annotation createValidAnnotation() {
        Annotation annotation = new Annotation();

        annotation.db = "IntAct";
        annotation.dbObjectId = "EBI-10043081";
        annotation.dbReferences = "PMID:12871976";
        annotation.qualifier = "enables";
        annotation.goId = "GO:0000977";
        annotation.interactingTaxonId = "taxon:12345";
        annotation.ecoId = "ECO:0000353";
        annotation.with = "GO:0036376,GO:1990573";
        annotation.assignedBy = "IntAct";
        annotation.annotationExtension = "occurs_in(CL:1000428)";
        annotation.annotationProperties = "go_evidence=IEA|taxon_id=35758|db_subset=TrEMBL|db_object_symbol=moeA5|db_object_type=protein|db_object_type=protein|target_set=BHF-UCL,Exosome,KRUK";
        annotation.annotationProperties = "go_evidence=IEA|taxon_id=35758|db_subset=TrEMBL|db_object_symbol=moeA5|db_object_type=protein|target_set=BHF-UCL,Exosome,KRUK";

        return annotation;
    }
}

package uk.ac.ebi.quickgo.index.annotation;

/**
 * A class for creating stubbed annotations, representing rows of data read from
 * annotation source files.
 *
 * Created 22/04/16
 * @author Edd
 */
class AnnotationMocker {
    static Annotation createValidAnnotation() {
        Annotation annotation = new Annotation();

        annotation.db = "IntAct";
        annotation.dbObjectId = "EBI-10043081";
        annotation.dbReferences = "PMID:12871976";
        annotation.qualifier = "enables";
        annotation.goId = "GO:0000977";
        annotation.interactingTaxonId = "taxon:12345";
        annotation.ecoId = "ECO:0000353";
        annotation.with = "GO:0036376,GO:1990573";
        annotation.assignedBy = "IntAct";
        annotation.annotationExtension = "occurs_in(CL:1000428)";
        annotation.annotationProperties = "go_evidence=IEA|taxon_id=35758|db_subset=TrEMBL|db_object_symbol=moeA5|db_object_type=protein|db_object_type=protein|target_set=BHF-UCL,Exosome,KRUK";
        return annotation;
    }
}

Fix broken merge from Master.


package sophomore.classfile;

import java.util.Iterator;
import java.util.NoSuchElementException;

abstract class Members <T> implements Iterable<T> {

	T[] elements;
	int currentIndex = 0;

	public Members() {}

	public int getSize() {
		return elements.length;
	}

	public void addElement(T element) {
		if(currentIndex == elements.length) {
			throw new ArrayIndexOutOfBoundsException();
		}
		elements[currentIndex++] = element;
	}

	@Override
	public Iterator<T> iterator() {
		return new Iterator<T>() {
			private int index = 0;
			@Override
			public boolean hasNext() {
				return index < elements.length;
			}

			@Override
			public T next() {
				if(hasNext()) {
					return elements[index++];
				}
				throw new NoSuchElementException("" + index);
			}
		};
	}

}

package sophomore.classfile;

import java.util.Iterator;
import java.util.NoSuchElementException;

abstract class Members <T> {

	T[] elements;
	int currentIndex = 0;

	public Members() {}

	public int getSize() {
		return elements.length;
	}

	public void addElement(T element) {
		if(currentIndex == elements.length) {
			throw new ArrayIndexOutOfBoundsException();
		}
		elements[currentIndex++] = element;
	}

	public T[] getElements() {
		return elements;
	}
}

Change to return array of elements instead of implementing iterable.


/*
 * Copyright 2000-2017 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.debugger.streams.trace.impl.handler.type;

import org.jetbrains.annotations.NotNull;

/**
 * @author Vitaliy.Bibaev
 */
public interface GenericType {
  @NotNull
  String getVariableTypeName();

  @NotNull
  String getGenericTypeName();

  GenericType BOOLEAN = new GenericTypeImpl("boolean", "java.lang.Boolean");
  GenericType INT = new GenericTypeImpl("int", "java.lang.Integer");
  GenericType DOUBLE = new GenericTypeImpl("double", "java.lang.Double");
  GenericType LONG = new GenericTypeImpl("long", "java.lang.Long");
  GenericType OBJECT = new ClassTypeImpl("java.lang.Object");
  GenericType VOID = new GenericTypeImpl("void", "java.lang.Void");
}

/*
 * Copyright 2000-2017 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.debugger.streams.trace.impl.handler.type;

import com.intellij.psi.CommonClassNames;
import org.jetbrains.annotations.NotNull;

/**
 * @author Vitaliy.Bibaev
 */
public interface GenericType {
  @NotNull
  String getVariableTypeName();

  @NotNull
  String getGenericTypeName();

  GenericType BOOLEAN = new GenericTypeImpl("boolean", "java.lang.Boolean");
  GenericType INT = new GenericTypeImpl("int", "java.lang.Integer");
  GenericType DOUBLE = new GenericTypeImpl("double", "java.lang.Double");
  GenericType LONG = new GenericTypeImpl("long", "java.lang.Long");
  GenericType OBJECT = new ClassTypeImpl("java.lang.Object");
  GenericType VOID = new GenericTypeImpl("void", "java.lang.Void");

  GenericType OPTIONAL = new ClassTypeImpl(CommonClassNames.JAVA_UTIL_OPTIONAL);
  GenericType OPTIONAL_INT = new ClassTypeImpl("java.lang.OptionalInt");
  GenericType OPTIONAL_LONG = new ClassTypeImpl("java.lang.OptionalLong");
  GenericType OPTIONAL_DOUBLE = new ClassTypeImpl("java.lang.OptionalDouble");
}

Add generic types for an optional


package org.stagemonitor.core.instrument;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Properties;
import java.util.logging.Logger;

import org.stagemonitor.core.Stagemonitor;

/**
 * This is not a real Driver, it is just used to attach the stagemonitor agent as early in the lifecycle as possible.
 * Because the earlier the agent is attached, the less classes have to be retransformed, which is a expensive operation.
 *
 * Some application server as wildfly load all Driver implementations with a ServiceLoader at startup and even
 * before ServletContainerInitializer classes are loaded.
 */
public class StagemonitorRuntimeAgentAttacherDriver implements Driver {

	static  {
		Stagemonitor.init();
	}

	@Override
	public Connection connect(String url, Properties info) throws SQLException {
		return null;
	}

	@Override
	public boolean acceptsURL(String url) throws SQLException {
		return false;
	}

	@Override
	public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
		return new DriverPropertyInfo[0];
	}

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

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

	@Override
	public boolean jdbcCompliant() {
		return false;
	}

	@Override
	public Logger getParentLogger() throws SQLFeatureNotSupportedException {
		throw new SQLFeatureNotSupportedException();
	}
}

package org.stagemonitor.core.instrument;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Properties;
import java.util.logging.Logger;

import org.stagemonitor.core.Stagemonitor;

/**
 * This is not a real Driver, it is just used to attach the stagemonitor agent as early in the lifecycle as possible.
 * Because the earlier the agent is attached, the less classes have to be retransformed, which is a expensive operation.
 *
 * Some application server as wildfly load all Driver implementations with a ServiceLoader at startup and even
 * before ServletContainerInitializer classes are loaded.
 */
public class StagemonitorRuntimeAgentAttacherDriver implements Driver {

	static  {
		Stagemonitor.init();
	}

	@Override
	public Connection connect(String url, Properties info) throws SQLException {
		return null;
	}

	@Override
	public boolean acceptsURL(String url) throws SQLException {
		return false;
	}

	@Override
	public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
		return new DriverPropertyInfo[0];
	}

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

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

	@Override
	public boolean jdbcCompliant() {
		return false;
	}

	public Logger getParentLogger() throws SQLFeatureNotSupportedException {
		throw new SQLFeatureNotSupportedException();
	}
}

Remove @Override annotation from 1.7 added method


// "Fix all 'Constant conditions & exceptions' problems in file" "true"
import org.jetbrains.annotations.*;

import java.util.*;
import java.util.stream.Stream;

public class MethodReferenceConstantValue {
  @Contract(value = "!null -> false", pure = true)
  public boolean strangeMethod(String s) {
    return s == null ? new Random().nextBoolean() : false;
  }

  public void test(Optional<String> opt) {
    X x = (methodReferenceConstantValue, s) -> false;
    Boolean aBoolean = opt.map(s -> false)
      .map(o -> true)
      .map(o -> false)
      .orElse(false);
    if (opt.isPresent()) {
      Stream.generate(() -> true)
        .limit(10)
        .forEach(System.out::println);
    }
  }

  interface X {
    boolean action(@Nullable MethodReferenceConstantValue a, @NotNull String b);
  }
}

// "Fix all 'Constant conditions & exceptions' problems in file" "true"
import org.jetbrains.annotations.*;

import java.util.*;
import java.util.stream.Stream;

public class MethodReferenceConstantValue {
  @Contract(value = "!null -> false", pure = true)
  public boolean strangeMethod(String s) {
    return s == null ? new Random().nextBoolean() : false;
  }

  public void test(Optional<String> opt) {
    X x = (methodReferenceConstantValue, s1) -> false;
    Boolean aBoolean = opt.map(s -> false)
      .map(o1 -> true)
      .map(o -> false)
      .orElse(false);
    if (opt.isPresent()) {
      Stream.generate(() -> true)
        .limit(10)
        .forEach(System.out::println);
    }
  }

  interface X {
    boolean action(@Nullable MethodReferenceConstantValue a, @NotNull String b);
  }
}

Replace with trivial lambda default fixed after 2cfd1ece23


package org.spoofax.jsglr2.measure.parsing;

import org.spoofax.jsglr2.parseforest.IDerivation;
import org.spoofax.jsglr2.parseforest.IParseForest;
import org.spoofax.jsglr2.parseforest.IParseNode;
import org.spoofax.jsglr2.parser.AbstractParseState;
import org.spoofax.jsglr2.stack.StackLink;
import org.spoofax.jsglr2.stack.basic.BasicStackNode;

class StandardParserMeasureObserver
//@formatter:off
   <ParseForest extends IParseForest,
    Derivation  extends IDerivation<ParseForest>,
    ParseNode   extends IParseNode<ParseForest, Derivation>>
//@formatter:on
    extends
    ParserMeasureObserver<ParseForest, Derivation, ParseNode, BasicStackNode<ParseForest>, AbstractParseState<?, BasicStackNode<ParseForest>>> {

    @Override int stackNodeLinkCount(BasicStackNode<ParseForest> stackNode) {
        int linksOutCount = 0;

        for(StackLink<?, ?> link : stackNode.getLinks())
            linksOutCount++;

        return linksOutCount;
    }

}

package org.spoofax.jsglr2.measure.parsing;

import org.spoofax.jsglr2.parseforest.IDerivation;
import org.spoofax.jsglr2.parseforest.IParseForest;
import org.spoofax.jsglr2.parseforest.IParseNode;
import org.spoofax.jsglr2.parser.AbstractParseState;
import org.spoofax.jsglr2.stack.StackLink;
import org.spoofax.jsglr2.stack.hybrid.HybridStackNode;

class StandardParserMeasureObserver
//@formatter:off
   <ParseForest extends IParseForest,
    Derivation  extends IDerivation<ParseForest>,
    ParseNode   extends IParseNode<ParseForest, Derivation>>
//@formatter:on
    extends
    ParserMeasureObserver<ParseForest, Derivation, ParseNode, HybridStackNode<ParseForest>, AbstractParseState<?, HybridStackNode<ParseForest>>> {

    @Override int stackNodeLinkCount(HybridStackNode<ParseForest> stackNode) {
        int linksOutCount = 0;

        for(StackLink<?, ?> link : stackNode.getLinks())
            linksOutCount++;

        return linksOutCount;
    }

}

Fix stack node types mismatch


package net.serverpeon.discord.internal;

import net.serverpeon.discord.DiscordClient;
import org.junit.Test;

public class JavaCompatTest {
    @Test
    public void testBuilderAccess() {
        DiscordClient client = DiscordClient.Companion.newBuilder().build();
    }
}

package net.serverpeon.discord.internal;

import net.serverpeon.discord.DiscordClient;
import org.junit.Test;

public class JavaCompatTest {
    @Test
    public void testBuilderAccess() {
        DiscordClient.Companion.newBuilder().token("hello").build();
    }
}

Make the java test actually succeed


/* Copyright 2018 Telstra Open Source
 *
 *   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.openkilda.northbound.dto.switches;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Value;

@Value
public class PortDto {

    @JsonProperty("switch_id")
    private String switchId;

    @JsonProperty("port_no")
    private int portNo;

    @JsonProperty("success")
    private Boolean success;

    @JsonProperty("message")
    private String message;

    public PortDto(@JsonProperty("switch_id") String switchId, @JsonProperty("port_id") int portNo,
                     @JsonProperty("success") Boolean success, @JsonProperty("message") String message) {
        this.switchId = switchId;
        this.portNo = portNo;
        this.success = success;
        this.message = message;
    }
}

/* Copyright 2018 Telstra Open Source
 *
 *   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.openkilda.northbound.dto.switches;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Value;

@Value
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PortDto {

    @JsonProperty("switch_id")
    private String switchId;

    @JsonProperty("port_no")
    private int portNo;

    @JsonProperty("success")
    private Boolean success;

    @JsonProperty("message")
    private String message;

    public PortDto(@JsonProperty("switch_id") String switchId, @JsonProperty("port_id") int portNo,
                     @JsonProperty("success") Boolean success, @JsonProperty("message") String message) {
        this.switchId = switchId;
        this.portNo = portNo;
        this.success = success;
        this.message = message;
    }
}

Exclude non-null properties in response.


package com.lloydtorres.stately.dto;

/**
 * Created by Lloyd on 2016-07-24.
 * A holder for data in the main nation overview card.
 */
public class NationOverviewCardData {
    public String category;
    public String region;
    public String inflDesc;
    public int inflScore;
    public String population;
    public String motto;
    public String established;
    public String lastSeen;

    public NationOverviewCardData() { super(); }
}

package com.lloydtorres.stately.dto;

/**
 * Created by Lloyd on 2016-07-24.
 * A holder for data in the main nation overview card.
 */
public class NationOverviewCardData {
    public String category;
    public String region;
    public String inflDesc;
    public int inflScore;
    public String population;
    public String motto;
    public String established;

    public String waState;
    public String endorsements;
    public String gaVote;
    public String scVote;

    public NationOverviewCardData() { super(); }
}

Add WA parameters to nation overview card DTO


package com.codicesoftware.plugins.hudson.commands;

import com.codicesoftware.plugins.hudson.util.MaskedArgumentListBuilder;

public class UndoCheckoutCommand implements Command {

    private final String workspacePath;

    public UndoCheckoutCommand(String workspacePath) {
        this.workspacePath = workspacePath;
    }

    @Override
    public MaskedArgumentListBuilder getArguments() {
        MaskedArgumentListBuilder arguments = new MaskedArgumentListBuilder();

        arguments.add("unco");
        arguments.add("--all");
        arguments.add(workspacePath);

        return arguments;
    }
}

package com.codicesoftware.plugins.hudson.commands;

import com.codicesoftware.plugins.hudson.util.MaskedArgumentListBuilder;

public class UndoCheckoutCommand implements Command {

    private final String workspacePath;

    public UndoCheckoutCommand(String workspacePath) {
        this.workspacePath = workspacePath;
    }

    @Override
    public MaskedArgumentListBuilder getArguments() {
        MaskedArgumentListBuilder arguments = new MaskedArgumentListBuilder();

        arguments.add("unco");
        arguments.add("--all");
        arguments.add("--silent");
        arguments.add(workspacePath);

        return arguments;
    }
}

Make the 'cm undo' command silent to avoid interactive behavior


/*
 *    Copyright (c) 2008-2011 Graham Allan
 *
 *   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.mutabilitydetector.locations;

public interface CodeLocation<T extends CodeLocation<T>> extends Comparable<T> {

    String typeName();

    public abstract String prettyPrint();

    public final static class UnknownCodeLocation implements CodeLocation<UnknownCodeLocation> {

        public static final UnknownCodeLocation UNKNOWN = new UnknownCodeLocation();

        private UnknownCodeLocation() { }

        @Override
        public int compareTo(UnknownCodeLocation o) {
            return 0; // There can be only one.
        }

        @Override
        public String typeName() {
            return "unknown code location";
        }

        @Override
        public String prettyPrint() {
            return "[Unknown code location]";
        }

    }

}

/*
 *    Copyright (c) 2008-2011 Graham Allan
 *
 *   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.mutabilitydetector.locations;

public interface CodeLocation<T extends CodeLocation<T>> extends Comparable<T> {

    String typeName();

    public abstract String prettyPrint();

    public final static class UnknownCodeLocation implements CodeLocation<UnknownCodeLocation> {

        public static final UnknownCodeLocation UNKNOWN = new UnknownCodeLocation();

        private UnknownCodeLocation() { }

        @Override
        public int compareTo(UnknownCodeLocation o) {
            return 0; // There can be only one.
        }

        @Override
        public boolean equals(Object obj) {
            return obj == UNKNOWN;
        }

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

        @Override
        public String typeName() {
            return "unknown code location";
        }

        @Override
        public String prettyPrint() {
            return "[Unknown code location]";
        }

    }

}

Remove warnings by implementing equals/hashcode.


package beaform.entities;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Label;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Transaction;

import beaform.Type;

public class Formula {
	private final Type type;
	private final Label label;
	private final String name;
	private final String description;

	public Formula(String name, String description) {
		this.type = Type.FORMULA;
		this.label = this.type.getLabel();

		this.name = name;
		this.description = description;
	}

	public Label getLabel() {
		return this.label;
	}

	public String getName() {
		return this.name;
	}

	public String getDescription() {
		return this.description;
	}

	/**
	 * Store the Formula in the graph database.
	 *
	 * @param graphDb a handle to the graph database.
	 * @return the newly created node
	 */
	public Node persist(GraphDatabaseService graphDb) {
		Node thisNode;

		try ( Transaction tx = graphDb.beginTx()) {
			thisNode = graphDb.createNode(this.label);
			thisNode.setProperty( "name", this.name );
			thisNode.setProperty( "description", this.description );

			tx.success();
		}

		return thisNode;
	}

}

package beaform.entities;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Label;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Transaction;

import beaform.Type;

public class Formula {
	private final Type type;
	private final Label label;
	private final String name;
	private final String description;

	public Formula(String name, String description) {
		this.type = Type.FORMULA;
		this.label = this.type.getLabel();

		this.name = name;
		this.description = description;
	}

	public Label getLabel() {
		return this.label;
	}

	public String getName() {
		return this.name;
	}

	public String getDescription() {
		return this.description;
	}

	/**
	 * Store the Formula in the graph database.
	 *
	 * @param graphDb a handle to the graph database.
	 * @return the newly created node
	 */
	public Node persist(GraphDatabaseService graphDb) {
		Node thisNode;

		try ( Transaction tx = graphDb.beginTx()) {
			thisNode = graphDb.createNode(this.label);
			thisNode.setProperty( "name", this.name );
			thisNode.setProperty( "description", this.description );

			tx.success();
		}

		return thisNode;
	}

	@Override
	public String toString() {
		return this.type + " name: " + this.name + " desc: " + this.description;
	}

}

Add toString method for formulas


package com.karateca.ddescriber.toolWindow;

import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.karateca.ddescriber.Hierarchy;
import com.karateca.ddescriber.JasmineFinder;

/**
 * @author Andres Dominguez.
 */
public class JasminFile {

  private final VirtualFile virtualFile;
  private Hierarchy hierarchy;

  public JasminFile(VirtualFile virtualFile) {
    this.virtualFile = virtualFile;
  }

  public Hierarchy createHierarchy(Project project) {
    FileDocumentManager instance = FileDocumentManager.getInstance();
    Document document = instance.getDocument(virtualFile);

    JasmineFinder jasmineFinder = new JasmineFinder(project, document);
    jasmineFinder.findAll();
    hierarchy = new Hierarchy(document, jasmineFinder.getFindResults(), 0);

    return hierarchy;
  }

  @Override
  public String toString() {
    return virtualFile.getName();
  }

  public VirtualFile getVirtualFile() {
    return virtualFile;
  }
}

package com.karateca.ddescriber.toolWindow;

import com.intellij.openapi.editor.Document;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.karateca.ddescriber.ActionUtil;
import com.karateca.ddescriber.Hierarchy;
import com.karateca.ddescriber.JasmineFinder;

/**
 * @author Andres Dominguez.
 */
class JasminFile {

  private final VirtualFile virtualFile;

  public JasminFile(VirtualFile virtualFile) {
    this.virtualFile = virtualFile;
  }

  public Hierarchy createHierarchy(Project project) {
    Document document = ActionUtil.getDocument(virtualFile);

    JasmineFinder jasmineFinder = new JasmineFinder(project, document);
    jasmineFinder.findAll();
    Hierarchy hierarchy = new Hierarchy(document, jasmineFinder.getFindResults(), 0);

    return hierarchy;
  }

  @Override
  public String toString() {
    return virtualFile.getName();
  }

  public VirtualFile getVirtualFile() {
    return virtualFile;
  }
}

Use action util to get doc


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

package com.google.vinet.data;

/**
 * Any class that can be stored and loaded from Datastore. The implementing class must also provide
 * a constructor for loading an object from a Datastore entity.
 */
public interface Datastoreable {

  /**
   * Store this class instance to Datastore.
   *
   * @throws IllegalArgumentException                                     If the entity was incomplete.
   * @throws java.util.ConcurrentModificationException                    If the entity group to which the entity belongs was modified concurrently.
   * @throws com.google.appengine.api.datastore.DatastoreFailureException If any other datastore error occurs.
   */
  void toDatastore();
}

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

package com.google.vinet.data;

/**
 * Any class that can be stored and loaded from Datastore. The implementing class must also provide
 * a constructor for loading an object from a Datastore entity.
 */
public interface Datastoreable {

  /**
   * Store this class instance to Datastore.
<<<<<<< HEAD
   *
   * @throws IllegalArgumentException                                     If the entity was incomplete.
   * @throws java.util.ConcurrentModificationException                    If the entity group to which the entity belongs was modified concurrently.
   * @throws com.google.appengine.api.datastore.DatastoreFailureException If any other datastore error occurs.
=======
>>>>>>> Add interface for Datastore items
   */
  void toDatastore();
}

Add interface for Datastore items


package foodtruck.geolocation;

import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.sun.jersey.api.client.WebResource;

import org.codehaus.jettison.json.JSONObject;

import foodtruck.util.ServiceException;

/**
 * Extracting out the resource for easier testing
 * @author aviolette@gmail.com
 * @since 10/18/11
 */
public class YahooResource {
  private final WebResource resource;
  private String yahooId;

  @Inject
  public YahooResource(@YahooEndPoint WebResource resource, @Named("yahoo.app.id") String yahooId) {
    this.yahooId = yahooId;
    this.resource = resource;
  }

  /**
   * Calls the geolocation service and returns the JSON payload
   * @param location the location
   * @return the JSON Object
   * @throws ServiceException if an error occurs calling the service
   */
  public JSONObject findLocation(String location, boolean reverse) throws ServiceException {
    try {
      WebResource r = resource.queryParam("q", location)
          .queryParam("flags", "j")
          .queryParam("appid", yahooId);
      if (reverse) {
        r = r.queryParam("gflags", "R");
      }
      return r.header("Accept", "text/json; application/json")
          .get(JSONObject.class);
    } catch (RuntimeException rte) {
      throw new ServiceException(rte);
    }
  }
}

package foodtruck.geolocation;

import com.google.inject.Inject;
import com.sun.jersey.api.client.WebResource;

import org.codehaus.jettison.json.JSONObject;

import foodtruck.dao.ConfigurationDAO;
import foodtruck.util.ServiceException;

/**
 * Extracting out the resource for easier testing
 * @author aviolette@gmail.com
 * @since 10/18/11
 */
public class YahooResource {
  private final WebResource resource;
  private final ConfigurationDAO configDAO;

  @Inject
  public YahooResource(@YahooEndPoint WebResource resource, ConfigurationDAO configDAO) {
    this.configDAO = configDAO;
    this.resource = resource;
  }

  /**
   * Calls the geolocation service and returns the JSON payload
   * @param location the location
   * @return the JSON Object
   * @throws ServiceException if an error occurs calling the service
   */
  public JSONObject findLocation(String location, boolean reverse) throws ServiceException {
    try {
      WebResource r = resource.queryParam("q", location)
          .queryParam("flags", "j")
          .queryParam("appid", configDAO.find().getYahooAppId());
      if (reverse) {
        r = r.queryParam("gflags", "R");
      }
      return r.header("Accept", "text/json; application/json")
          .get(JSONObject.class);
    } catch (RuntimeException rte) {
      throw new ServiceException(rte);
    }
  }
}

Use configuration setting to determine Yahoo App ID


/* Copyright 2021 Telstra Open Source
 *
 *   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.openkilda.northbound.dto.v2.switches;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Builder.Default;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Set;

@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@Builder
public class LagPortRequest {
    private Set<Integer> portNumbers;
    @Default
    private Boolean lacpReply = true;
}

/* Copyright 2021 Telstra Open Source
 *
 *   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.openkilda.northbound.dto.v2.switches;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Set;

@Data
@NoArgsConstructor
public class LagPortRequest {
    @JsonProperty("port_numbers")
    private Set<Integer> portNumbers;

    @JsonProperty("lacp_reply")
    private Boolean lacpReply;

    @Builder
    @JsonCreator
    public LagPortRequest(
            @JsonProperty("port_numbers") Set<Integer> portNumbers,
            @JsonProperty("lacp_reply") Boolean lacpReply) {
        this.portNumbers = portNumbers;
        setLacpReply(lacpReply);
    }

    public void setLacpReply(Boolean lacpReply) {
        this.lacpReply = lacpReply == null ? true : lacpReply;
    }
}

Set lacp_reply to true if value is not specified


package net.straininfo2.grs.idloader.bioproject.domain;

import javax.persistence.*;

/**
 * Possible fields in which a project can be relevant.
 */
@Entity
public class ProjectRelevance {

    private long id;

    public enum RelevantField {
        AGRICULTURAL,
        MEDICAL,
        INDUSTRIAL,
        ENVIRONMENTAL,
        EVOLUTION,
        MODEL_ORGANISM,
        OTHER
    }

    private RelevantField relevantField;

    @Lob
    @Basic
    private String relevanceDescription;

    private BioProject bioProject;

    public ProjectRelevance() {

    }

    public ProjectRelevance(RelevantField field, String description) {
        this.relevantField = field;
        this.relevanceDescription = description;
    }

    @Id
    @GeneratedValue
    public long getId() {
        return id;
    }

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

    public RelevantField getRelevantField() {
        return relevantField;
    }

    public void setRelevantField(RelevantField relevantField) {
        this.relevantField = relevantField;
    }

    public String getRelevanceDescription() {
        return relevanceDescription;
    }

    public void setRelevanceDescription(String relevanceDescription) {
        this.relevanceDescription = relevanceDescription;
    }

    @ManyToOne(optional = false)
    public BioProject getBioProject() {
        return bioProject;
    }

    public void setBioProject(BioProject bioProject) {
        this.bioProject = bioProject;
    }
}

package net.straininfo2.grs.idloader.bioproject.domain;

import javax.persistence.*;

/**
 * Possible fields in which a project can be relevant.
 */
@Entity
public class ProjectRelevance {

    private long id;

    public enum RelevantField {
        AGRICULTURAL,
        MEDICAL,
        INDUSTRIAL,
        ENVIRONMENTAL,
        EVOLUTION,
        MODEL_ORGANISM,
        OTHER
    }

    private RelevantField relevantField;

    private String relevanceDescription;

    private BioProject bioProject;

    public ProjectRelevance() {

    }

    public ProjectRelevance(RelevantField field, String description) {
        this.relevantField = field;
        this.relevanceDescription = description;
    }

    @Id
    @GeneratedValue
    public long getId() {
        return id;
    }

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

    public RelevantField getRelevantField() {
        return relevantField;
    }

    public void setRelevantField(RelevantField relevantField) {
        this.relevantField = relevantField;
    }

    @Lob
    @Basic
    public String getRelevanceDescription() {
        return relevanceDescription;
    }

    public void setRelevanceDescription(String relevanceDescription) {
        this.relevanceDescription = relevanceDescription;
    }

    @ManyToOne(optional = false)
    public BioProject getBioProject() {
        return bioProject;
    }

    public void setBioProject(BioProject bioProject) {
        this.bioProject = bioProject;
    }
}

Fix location of persistence annotations


package com.alienvault.otx.connect.internal;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;

import java.io.IOException;
import java.net.URI;

/**
 * Internal utility class to set the authorization header used for the OTX API
 * authentication.
 */
public class HeaderSettingRequestFactory extends SimpleClientHttpRequestFactory {
    private static final String SDK_USER_AGENT = "OTX Java SDK/1.0/"+System.getProperty("java.version");
    private String apiKey;

    public HeaderSettingRequestFactory(String apiKey) {
        this.apiKey = apiKey;
    }

    @Override
    public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException {
        ClientHttpRequest request = super.createRequest(uri, httpMethod);
        request.getHeaders().add("X-OTX-API-KEY",apiKey);
        request.getHeaders().add(HttpHeaders.USER_AGENT,SDK_USER_AGENT);
        return request;
    }
}

package com.alienvault.otx.connect.internal;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;

import java.io.IOException;
import java.net.URI;

/**
 * Internal utility class to set the authorization header used for the OTX API
 * authentication.
 */
public class HeaderSettingRequestFactory extends SimpleClientHttpRequestFactory {
    private static final String SDK_USER_AGENT = String.format("%s/%s/%s",
            System.getProperty("otx.sdk.project", "OTX Java SDK"),
            System.getProperty("otx.sdk.version", "1.0"),
            System.getProperty("java.version"));
    private String apiKey;

    public HeaderSettingRequestFactory(String apiKey) {
        this.apiKey = apiKey;
    }

    @Override
    public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException {
        ClientHttpRequest request = super.createRequest(uri, httpMethod);
        request.getHeaders().add("X-OTX-API-KEY",apiKey);
        request.getHeaders().add(HttpHeaders.USER_AGENT,SDK_USER_AGENT);
        return request;
    }
}

Add system properties to allow override of SDK User Agent


package com.github.basking2.sdsai.itrex.packages;

import com.github.basking2.sdsai.itrex.functions.DictFunction;
import com.github.basking2.sdsai.itrex.functions.FunctionInterface;

import java.util.Map;

public class DictPackage {
    public static final FunctionInterface<Map<Object, Object>> dict = new DictFunction();
    public static final FunctionInterface<Object> dictGet = (args, ctx) -> {
        final Map<Object, Object> m = (Map<Object, Object>)args.next();
        return m.get(args.next());
    };
    public static final FunctionInterface<Map<Object, Object>> dictPut = (args, ctx) -> {
        final Map<Object, Object> m = (Map<Object, Object>)args.next();
        final Object key = args.next();
        final Object val = args.next();
        m.put(key, val);
        return m;
    };
}

package com.github.basking2.sdsai.itrex.packages;

import com.github.basking2.sdsai.itrex.functions.DictFunction;
import com.github.basking2.sdsai.itrex.functions.FunctionInterface;

import java.util.Map;

public class DictPackage {
    public static final FunctionInterface<Map<Object, Object>> dict = new DictFunction();
    public static final FunctionInterface<Object> dictGet = (args, ctx) -> {
        final Map<Object, Object> m = (Map<Object, Object>)args.next();

        final Object key = args.next();

        if (m.containsKey(key)) {
            return m.get(key);
        }
        else if (args.hasNext()) {
            return args.next();
        }
        else {
            return null;
        }
    };
    public static final FunctionInterface<Map<Object, Object>> dictPut = (args, ctx) -> {
        final Map<Object, Object> m = (Map<Object, Object>)args.next();
        final Object key = args.next();
        final Object val = args.next();
        m.put(key, val);
        return m;
    };
}

Allow dictGet to have a default value.


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

package com.ning.http.client.async.grizzly;

import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.async.ByteBufferCapacityTest;
import com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider;

public class GrizzlyByteBufferCapacityTest extends ByteBufferCapacityTest {

    @Override
    public AsyncHttpClient getAsyncHttpClient(AsyncHttpClientConfig config) {
        if (config == null) {
            config = new AsyncHttpClientConfig.Builder().build();
        }
        return new AsyncHttpClient(new GrizzlyAsyncHttpProvider(config), config);
    }

}

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

package com.ning.http.client.async.grizzly;

import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.AsyncHttpClientConfig;
import com.ning.http.client.async.ByteBufferCapacityTest;
import com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider;
import org.testng.annotations.Test;

public class GrizzlyByteBufferCapacityTest extends ByteBufferCapacityTest {

    @Override
    public AsyncHttpClient getAsyncHttpClient(AsyncHttpClientConfig config) {
        if (config == null) {
            config = new AsyncHttpClientConfig.Builder().build();
        }
        return new AsyncHttpClient(new GrizzlyAsyncHttpProvider(config), config);
    }

    @Test(groups = {"standalone", "default_provider"}, enabled=false)
    public void basicByteBufferTest() throws Throwable {
    }
}

Disable the test as it fail


package org.lodder.subtools.multisubdownloader.lib.control.subtitles.sorting.replacers;

import java.util.HashMap;
import org.junit.Before;
import org.junit.Test;
import org.lodder.subtools.sublibrary.model.Release;

import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class GroupReplacerTest {

  protected GroupReplacer replacer;

  @Before
  public void setUp() throws Exception {
    replacer = new GroupReplacer();
  }

  @Test
  public void test_it_replaces_the_keyword_group_to_a_releasename() throws Exception {
    Release release = mock(Release.class);
    when(release.getReleasegroup()).thenReturn("Acme");

    HashMap<String, Integer> definedWeights = new HashMap<>();
    definedWeights.put("%GROUP%",5);

    replacer.replace(release, definedWeights);

    /* check if the weight there is only one weight */
    assertEquals(1, definedWeights.size());

    /* check if the weight is acme */
    assertTrue(definedWeights.containsKey("acme"));
  }
}

package org.lodder.subtools.multisubdownloader.lib.control.subtitles.sorting.replacers;

import java.util.HashMap;
import org.junit.Before;
import org.junit.Test;
import org.lodder.subtools.sublibrary.model.Release;

import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class GroupReplacerTest {

  protected GroupReplacer replacer;

  @Before
  public void setUp() throws Exception {
    replacer = new GroupReplacer();
  }

  @Test
  public void test_it_replaces_the_keyword_group_to_a_releasename() throws Exception {
    Release release = mock(Release.class);
    when(release.getReleasegroup()).thenReturn("Acme");

    HashMap<String, Integer> definedWeights = new HashMap<>();
    definedWeights.put("%GROUP%",5);

    replacer.replace(release, definedWeights);

    /* check if the weight there is only one weight */
    assertEquals(1, definedWeights.size());

    /* check if the weight is acme */
    assertTrue(definedWeights.containsKey("acme"));
  }

  @Test
  public void testEmptyWeights() throws Exception {
    Release release = mock(Release.class);
    when(release.getReleasegroup()).thenReturn("Acme");

    HashMap<String, Integer> definedWeights = new HashMap<>();

    replacer.replace(release, definedWeights);

    /* check if the weight there is only one weight */
    assertEquals(0, definedWeights.size());

    /* check if the weight is acme */
    assertFalse(definedWeights.containsKey("acme"));
  }
}

Extend test for empty weights


package org.talend.dataprep.exception;

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

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;

class TDPException extends RuntimeException {

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

    private final Messages code;

    private final String message;

    private Throwable cause;

    public TDPException(Messages code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
        this.message = message;
        this.cause = cause;
    }

    public void writeTo(Writer writer) {
        try {
            JsonGenerator generator = (new JsonFactory()).createGenerator(writer);
            generator.writeStartObject();
            {
                generator.writeStringField("code", code.getProduct() + '_' + code.getGroup() + '_' + code.getCode()); //$NON-NLS-1$
                generator.writeStringField("message", message); //$NON-NLS-1$
                if (cause != null) {
                    generator.writeStringField("cause", cause.getMessage()); //$NON-NLS-1$
                }
            }
            generator.writeEndObject();
            generator.flush();
        } catch (IOException e) {
            LOGGER.error("Unable to write exception to " + writer + ".", e);
        }
    }
}

package org.talend.dataprep.exception;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;

class TDPException extends RuntimeException {

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

    private final Messages code;

    private final String message;

    private Throwable cause;

    public TDPException(Messages code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
        this.message = message;
        this.cause = cause;
    }

    public void writeTo(Writer writer) {
        try {
            JsonGenerator generator = (new JsonFactory()).createGenerator(writer);
            generator.writeStartObject();
            {
                generator.writeStringField("code", code.getProduct() + '_' + code.getGroup() + '_' + code.getCode()); //$NON-NLS-1$
                generator.writeStringField("message", message); //$NON-NLS-1$
                if (cause != null) {
                    generator.writeStringField("cause", cause.getMessage()); //$NON-NLS-1$
                    final StringWriter details = new StringWriter();
                    cause.printStackTrace(new PrintWriter(details));
                    generator.writeStringField("details", details.toString()); //$NON-NLS-1$
                }
            }
            generator.writeEndObject();
            generator.flush();
        } catch (IOException e) {
            LOGGER.error("Unable to write exception to " + writer + ".", e);
        }
    }
}

Include exception cause's stacktrace in JSON in case of error.


package SW9.abstractions;

import SW9.utility.colors.Color;

public enum QueryState {
    SUCCESSFUL(Color.GREEN, Color.Intensity.I700, "✓"),
    ERROR(Color.RED, Color.Intensity.I700, "✘"),
    RUNNING(Color.GREY_BLUE, Color.Intensity.I600, "···"),
    UNKNOWN(Color.GREY, Color.Intensity.I600, "?"),
    SYNTAX_ERROR(Color.RED, Color.Intensity.I700, "!");

    private final Color color;
    private final Color.Intensity colorIntensity;
    private final String indicator;

    QueryState(final Color color, final Color.Intensity colorIntensity, final String indicator) {
        this.color = color;
        this.colorIntensity = colorIntensity;
        this.indicator = indicator;
    }

    public Color getColor() {
        return color;
    }

    public Color.Intensity getColorIntensity() {
        return colorIntensity;
    }

    public String getIndicator() {
        return indicator;
    }
}

package SW9.abstractions;

import SW9.utility.colors.Color;

public enum QueryState {
    SUCCESSFUL(Color.GREEN, Color.Intensity.I700, "✓"),
    ERROR(Color.RED, Color.Intensity.I700, "✘"),
    RUNNING(Color.GREY_BLUE, Color.Intensity.I600, "···"),
    UNKNOWN(Color.GREY, Color.Intensity.I600, "?"),
    SYNTAX_ERROR(Color.PURPLE, Color.Intensity.I700, "!");

    private final Color color;
    private final Color.Intensity colorIntensity;
    private final String indicator;

    QueryState(final Color color, final Color.Intensity colorIntensity, final String indicator) {
        this.color = color;
        this.colorIntensity = colorIntensity;
        this.indicator = indicator;
    }

    public Color getColor() {
        return color;
    }

    public Color.Intensity getColorIntensity() {
        return colorIntensity;
    }

    public String getIndicator() {
        return indicator;
    }
}

Make query with syntax error purple


package com.qiniu.api.config;

/**
 * The Config class is a global configuration file for the sdk, used for serve
 * side only.
 */
public class Config {
	public static final String CHARSET = "utf-8";

	public static String USER_AGENT="qiniu java-sdk v6.1.2";

	/**
	 * You can get your accesskey from  https://dev.qiniutek.com
	 */
	public static String ACCESS_KEY = "<Please apply your access key>";

	/**
	 * You can get your accesskey from  https://dev.qiniutek.com
	 */
	public static String SECRET_KEY = "<Apply your secret key here, and keep it secret!>";

	public static String RS_HOST = "http://rs.qiniu.com";

	public static String UP_HOST = "http://up.qiniu.com";

	public static String RSF_HOST = "http://rsf.qiniu.com";

}

package com.qiniu.api.config;

/**
 * The Config class is a global configuration file for the sdk, used for serve
 * side only.
 */
public class Config {
	public static final String CHARSET = "utf-8";

	public static String USER_AGENT="qiniu java-sdk v6.0.0";

	/**
	 * You can get your accesskey from  https://dev.qiniutek.com
	 */
	public static String ACCESS_KEY = "<Please apply your access key>";

	/**
	 * You can get your accesskey from  https://dev.qiniutek.com
	 */
	public static String SECRET_KEY = "<Apply your secret key here, and keep it secret!>";

	public static String RS_HOST = "http://rs.qbox.me";

	public static String UP_HOST = "http://up.qbox.me";

	public static String RSF_HOST = "http://rsf.qbox.me";

}

Revert " 版本信息及地址qobx.me --> qiniu.com"


package redis.embedded.util;

import com.google.common.io.Files;
import com.google.common.io.Resources;
import org.apache.commons.io.FileUtils;
import redis.embedded.exceptions.*;

import java.io.File;
import java.io.IOException;

public class JarUtil {

    public static File extractExecutableFromJar(String executable) throws IOException {
        File tmpDir = Files.createTempDir();
        tmpDir.deleteOnExit();

        File command = new File(tmpDir, executable);
        FileUtils.copyURLToFile(Resources.getResource(executable), command);
        command.deleteOnExit();
        if (!command.setExecutable(true)) {
            //should not ever happen
            throw new RedisBuildingException("Cannot make file " + command.getName() + " executable.");
        }

        return command;
    }
}

package redis.embedded.util;

import com.google.common.io.Files;
import com.google.common.io.Resources;
import org.apache.commons.io.FileUtils;
import redis.embedded.exceptions.*;

import java.io.File;
import java.io.IOException;
import java.net.URL;

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

public class JarUtil {

    public static File extractExecutableFromJar(String executable) throws IOException {
        File tmpDir = Files.createTempDir();
        tmpDir.deleteOnExit();

        File copiedExecutable = new File(tmpDir, executable);
        URL resource = getResource(executable);

        FileUtils.copyURLToFile(resource, copiedExecutable);
        copiedExecutable.deleteOnExit();

        if (!copiedExecutable.setExecutable(true)) {
            //should not ever happen
            throw new RedisBuildingException("Cannot make file " + copiedExecutable.getName() + " executable.");
        }

        return copiedExecutable;
    }

    /**
     * Imported from guava to introduce a default {@link ClassLoader}.
     *

     * Returns a {@code URL} pointing to {@code resourceName} if the resource is
     * found using the {@linkplain Thread#getContextClassLoader() context class
     * loader}. In simple environments, the context class loader will find
     * resources from the class path. In environments where different threads can
     * have different class loaders, for example app servers, the context class
     * loader will typically have been set to an appropriate loader for the
     * current thread.
     *

     *
In the unusual case where the context class loader is null, the class
     * loader that loaded this class ({@code Resources}) will be used instead.
     *
     * @throws IllegalArgumentException if the resource is not found
     * @see Resources#getResource(String)
     */
    private static URL getResource(String resourceName) {
        URL url = null;
        ClassLoader loader = Thread.currentThread().getContextClassLoader();

        // Try in the current context class loader
        if (loader != null) {
            url = loader.getResource(resourceName);
        }

        // If nothing, try in this class ClassLoader
        if (url == null) {
            loader = JarUtil.class.getClassLoader();
            url = loader.getResource(resourceName);
        }

        // Not found ?
        checkArgument(url != null, "resource %s not found.", resourceName);

        return url;
    }
}

Modify the default class loader used to extract from jar


package com.heinrichreimersoftware.materialintro.app;

import android.support.v4.app.Fragment;

public class SlideFragment extends Fragment {

    public boolean canGoForward() {
        return true;
    }

    public boolean canGoBackward() {
        return true;
    }

    public void updateNavigation() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).lockSwipeIfNeeded();
        }
    }

    protected void nextSlide() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).nextSlide();
        }
    }

    protected void previousSlide() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).previousSlide();
        }
    }

}

package com.heinrichreimersoftware.materialintro.app;

import android.support.v4.app.Fragment;

public class SlideFragment extends Fragment {

    public boolean canGoForward() {
        return true;
    }

    public boolean canGoBackward() {
        return true;
    }

    public void updateNavigation() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).lockSwipeIfNeeded();
        }
    }

    public void addOnNavigationBlockedListener(OnNavigationBlockedListener listener) {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).addOnNavigationBlockedListener(listener);
        }
    }

    public void removeOnNavigationBlockedListener(OnNavigationBlockedListener listener) {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).removeOnNavigationBlockedListener(listener);
        }
    }

    protected void nextSlide() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).nextSlide();
        }
    }

    protected void previousSlide() {
        if (getActivity() instanceof IntroActivity) {
            ((IntroActivity) getActivity()).previousSlide();
        }
    }

}

Add helper method to get blocked listener in frag


package eu.netide.core.management.cli;

import eu.netide.core.api.IBackendManager;
import eu.netide.core.management.ManagementHandler;
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.console.OsgiCommandSupport;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * Created by arne on 04.02.16.
 */

@Command(scope = "netide", name = "loadComposition", description = "Load a composition XML file")
public class LoadComposition extends OsgiCommandSupport {

    @Argument(index = 0, name = "compositionFile", description = "The composition xml file to load", required = true, multiValued = false)
    String compositionFile;

    @Override
    protected Object doExecute() throws Exception {
        Path path = Paths.get(compositionFile).toAbsolutePath();
        String spec = new String(Files.readAllBytes(path));

        ManagementHandler.setConfigurationValue("eu.netide.core.caos", "compositionSpecification", spec);
        return null;
    }

}

package eu.netide.core.management.cli;

import eu.netide.core.api.IBackendManager;
import eu.netide.core.management.ManagementHandler;
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.console.OsgiCommandSupport;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * Created by arne on 04.02.16.
 */

@Command(scope = "netide", name = "loadComposition", description = "Load a composition XML file")
public class LoadComposition extends OsgiCommandSupport {

    @Argument(index = 0, name = "compositionFile", description = "The composition xml file to load", required = true, multiValued = false)
    String compositionFile;

    @Override
    protected Object doExecute() throws Exception {

        try {
            Path path = Paths.get(compositionFile).toAbsolutePath();
            String spec = new String(Files.readAllBytes(path));

            ManagementHandler.setConfigurationValue("eu.netide.core.caos", "compositionSpecification", spec);
        } catch (java.nio.file.NoSuchFileException nsf) {
            System.out.printf("Composititon file %s not found.\n", compositionFile);
        }
        return null;
    }

}

Print error if the composition file cannot be found


/*
 * Copyright (c) 2009 Openwave Systems Inc. All rights reserved.
 *
 * The copyright to the computer software herein is the property of
 * Openwave Systems Inc. The software may be used and/or copied only
 * with the written permission of Openwave Systems Inc. or in accordance
 * with the terms and conditions stipulated in the agreement/contract
 * under which the software has been supplied.
 *
 * $Id: $
 */
package me.prettyprint.cassandra.service.clock;

/**
 * Define common functionaly for ClockResolution Implementations.
 *
 * @author pechague
 *
 */
public abstract class AbstractClockResolution {

    protected long getSystemMilliseconds() {
      return System.currentTimeMillis();
    }

}

Remove Openwave header as it should not be there


package com.jenjinstudios.server.net;

import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.LinkedList;
import java.util.Timer;

/**
 * @author Caleb Brinkman
 */
public class ServerUpdateTaskTest
{
	@Test
	public void testGetAverageUPS() throws Exception {
		AuthServer authServer = Mockito.mock(AuthServer.class);
		Mockito.when(authServer.getUps()).thenReturn(10);
		Mockito.when(authServer.getSyncedTasks()).thenReturn(new LinkedList());
		Mockito.when(authServer.getRepeatedTasks()).thenReturn(new LinkedList());
		ServerUpdateTask serverUpdateTask = new ServerUpdateTask(authServer);
		Timer loopTimer = new Timer("Foo", false);
		loopTimer.scheduleAtFixedRate(serverUpdateTask, 0, 100);
		Thread.sleep(1500);
		Assert.assertEquals(serverUpdateTask.getAverageUPS(), 10, 0.1);
	}
}

package com.jenjinstudios.server.net;

import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.LinkedList;
import java.util.Timer;

/**
 * @author Caleb Brinkman
 */
public class ServerUpdateTaskTest
{
	@Test
	public void testGetAverageUPS() throws Exception {
		AuthServer authServer = Mockito.mock(AuthServer.class);
		Mockito.when(authServer.getUps()).thenReturn(10);
		Mockito.when(authServer.getSyncedTasks()).thenReturn(new LinkedList());
		Mockito.when(authServer.getRepeatedTasks()).thenReturn(new LinkedList());
		ServerUpdateTask serverUpdateTask = new ServerUpdateTask(authServer);
		Timer loopTimer = new Timer("Foo", false);
		loopTimer.scheduleAtFixedRate(serverUpdateTask, 0, 100);
		Thread.sleep(1500);
		Assert.assertEquals(serverUpdateTask.getAverageUPS(), 10, 1);
	}
}

Update test to be more tolerant.