package com.alexrnl.subtitlecorrector.correctionstrategy;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.logging.Logger;

import com.alexrnl.subtitlecorrector.service.SessionParameters;

/**
 * Abstract strategy implementation.<br />
 * Provide a basic body for the actual strategies. There is no logic in this class.
 * @author Alex
 */
public abstract class AbstractStrategy implements Strategy {
	/** Logger */
	private static final Logger	LG	= Logger.getLogger(AbstractStrategy.class.getName());

	@Override
	public void startSession (final SessionParameters parameters) {
		// Nothing to do here, override if strategy depends on session state
	}

	@Override
	public void stopSession () {
		// Nothing to do here, override if strategy depends on session state
	}

	@Override
	public List<Parameter<?>> getParameters () {
		return new ArrayList<>(0);
	}

	@Override
	public Parameter<?> getParameterByName (final String name) {
		Objects.requireNonNull(name);
		for (final Parameter<?> parameter : getParameters()) {
			if (parameter.getDescription().equals(name)) {
				return parameter;
			}
		}
		LG.info("No parameter with name " + name + " found");
		return null;
	}

}

package com.alexrnl.subtitlecorrector.correctionstrategy;

import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.logging.Logger;

import com.alexrnl.subtitlecorrector.service.SessionParameters;

/**
 * Abstract strategy implementation.<br />
 * Provide a basic body for the actual strategies. There is no logic in this class.
 * @author Alex
 */
public abstract class AbstractStrategy implements Strategy {
	/** Logger */
	private static final Logger	LG	= Logger.getLogger(AbstractStrategy.class.getName());

	@Override
	public void startSession (final SessionParameters parameters) {
		// Nothing to do here, override if strategy depends on session state
	}

	@Override
	public void stopSession () {
		// Nothing to do here, override if strategy depends on session state
	}

	@Override
	public List<Parameter<?>> getParameters () {
		return Collections.emptyList();
	}

	@Override
	public Parameter<?> getParameterByName (final String name) {
		Objects.requireNonNull(name);
		for (final Parameter<?> parameter : getParameters()) {
			if (parameter.getDescription().equals(name)) {
				return parameter;
			}
		}
		LG.info("No parameter with name " + name + " found");
		return null;
	}

}

Replace empty list creation with Collections.emptyList()


/*
 * This file is part of Nucleus, licensed under the MIT License (MIT). See the LICENSE.txt file
 * at the root of this project for more details.
 */
package io.github.nucleuspowered.nucleus.modules.admin.config;

import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;

@ConfigSerializable
public class AdminConfig {

    @Setting(value = "broadcast-message-template", comment = "config.broadcast.template")
    private BroadcastConfig broadcastMessage = new BroadcastConfig();

    // TODO: Make the default true in future versions?
    @Setting(value = "separate-gamemode-permissions", comment = "config.gamemode.separate")
    private boolean separateGamemodePermission = false;

    public BroadcastConfig getBroadcastMessage() {
        return broadcastMessage;
    }

    public boolean isSeparateGamemodePermission() {
        return separateGamemodePermission;
    }
}

/*
 * This file is part of Nucleus, licensed under the MIT License (MIT). See the LICENSE.txt file
 * at the root of this project for more details.
 */
package io.github.nucleuspowered.nucleus.modules.admin.config;

import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;

@ConfigSerializable
public class AdminConfig {

    @Setting(value = "broadcast-message-template", comment = "config.broadcast.template")
    private BroadcastConfig broadcastMessage = new BroadcastConfig();

    @Setting(value = "separate-gamemode-permissions", comment = "config.gamemode.separate")
    private boolean separateGamemodePermission = true;

    public BroadcastConfig getBroadcastMessage() {
        return broadcastMessage;
    }

    public boolean isSeparateGamemodePermission() {
        return separateGamemodePermission;
    }
}

Set separate game mode permissions default to true.


package com.theaccountant.accountabilityhack.processor;

import com.theaccountant.accountabilityhack.data.SchoolEntry;
import com.theaccountant.accountabilityhack.data.SchoolRegistry;

import java.io.IOException;

public final class FteAantalProcessor implements Processor {

    public void process(final SchoolRegistry registry) throws IOException {
        final CsvReader reader = new CsvReader("02.-po-fte-owtype-bestuur-brin-functie.csv");
        while (reader.next()) {
            final String brin = reader.get("BRIN_NUMMER");
            final SchoolEntry entry;
            if (registry.isSchoolPresent(brin)) {
                entry = registry.getSchoolByBrin(brin);
            } else {
                entry = new SchoolEntry(brin);
                registry.addSchool(entry);
            }
            final String functie = reader.get("FUNCTIEGROEP");
            final String fte = reader.get("FTE'S 2016");
            switch (functie) {
            case "Directie":
                entry.setFteDirectie(fte);
                break;
            case "Onderwijsgevend personeel":
                entry.setFteLeerkrachten(fte);
                break;
            case "Onderwijsondersteunend personeel (OOP/OBP)":
                entry.setFteOndersteunend(fte);
                break;
            default:
                System.err.println("Unknown functie: " + functie);
                break;
            }
        }
    }
}

package com.theaccountant.accountabilityhack.processor;

import com.theaccountant.accountabilityhack.data.SchoolEntry;
import com.theaccountant.accountabilityhack.data.SchoolRegistry;

import java.io.IOException;

public final class FteAantalProcessor implements Processor {

    public void process(final SchoolRegistry registry) throws IOException {
        final CsvReader reader = new CsvReader("02.-po-fte-owtype-bestuur-brin-functie.csv");
        while (reader.next()) {
            final String brin = reader.get("BRIN_NUMMER");
            final SchoolEntry entry;
            if (registry.isSchoolPresent(brin)) {
                entry = registry.getSchoolByBrin(brin);
            } else {
                entry = SchoolEntry.builder().brin(brin).build();
                registry.addSchool(entry);
            }
            final String functie = reader.get("FUNCTIEGROEP");
            final String fte = reader.get("FTE'S 2016");
            switch (functie) {
            case "Directie":
                entry.setFteDirectie(fte);
                break;
            case "Onderwijsgevend personeel":
                entry.setFteLeerkrachten(fte);
                break;
            case "Onderwijsondersteunend personeel (OOP/OBP)":
                entry.setFteOndersteunend(fte);
                break;
            default:
                System.err.println("Unknown functie: " + functie);
                break;
            }
        }
    }
}

Use builder to create object.


/*******************************************************************************
 * Copyright (c) 2014 Codenvy, S.A.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Codenvy, S.A. - initial API and implementation
 *******************************************************************************/
package com.codenvy.flux.watcher.core.spi;

import java.nio.file.Path;

/**
 * @author Kevin Pollet
 */
public interface RepositoryWatchingService {
    void watch(String projectId, Path path);

    void unwatch(String projectId);

    boolean addRepositoryListener(RepositoryListener listener);

    boolean removeRepositoryListener(RepositoryListener listener);
}

/*******************************************************************************
 * Copyright (c) 2014 Codenvy, S.A.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Codenvy, S.A. - initial API and implementation
 *******************************************************************************/
package com.codenvy.flux.watcher.core.spi;

import java.nio.file.Path;

/**
 * @author Kevin Pollet
 */
public interface RepositoryWatchingService {
    void watch(Path path);

    void unwatch(Path path);

    boolean addRepositoryListener(RepositoryListener listener);

    boolean removeRepositoryListener(RepositoryListener listener);
}

Remove project parameter from watching service


package dk.in2isoft.onlineobjects.apps.reader.perspective;

public class StatementPerspective {
	private String text;
	private long id;
	private boolean found;

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public long getId() {
		return id;
	}

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

	public boolean isFound() {
		return found;
	}

	public void setFound(boolean found) {
		this.found = found;
	}
}

package dk.in2isoft.onlineobjects.apps.reader.perspective;

public class StatementPerspective {
	private String text;
	private long id;
	private boolean found;
	private int firstPosition;

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public long getId() {
		return id;
	}

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

	public boolean isFound() {
		return found;
	}

	public void setFound(boolean found) {
		this.found = found;
	}

	public int getFirstPosition() {
		return firstPosition;
	}

	public void setFirstPosition(int firstPosition) {
		this.firstPosition = firstPosition;
	}
}

Store first position of statements


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

/**
 * @author Matija Mazi <br>
 */
public enum HttpMethod {
    GET, POST, PUT, DELETE, HEAD
}

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

/**
 * @author Matija Mazi <br>
 */
public enum HttpMethod {
    GET, POST, PUT, DELETE, HEAD, OPTIONS
}

Add support for the OPTIONS method


package com.github.javiersantos.materialstyleddialogs;

import android.content.Context;
import android.os.Build;
import android.support.annotation.ColorRes;
import android.util.TypedValue;

class UtilsLibrary {

    static int getPrimaryColor(Context context) {
        TypedValue typedValue = new TypedValue();

        context.getTheme().resolveAttribute(R.attr.colorPrimary, typedValue, true);

        return typedValue.data;
    }

    static int dpToPixels(Context context, int dp) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dp * scale + 0.5f);
    }

    /**
     * Returns a color associated with a particular resource ID
     * <p/>
     * Starting in {@link android.os.Build.VERSION_CODES#M}, the returned
     * color will be styled for the specified Context's theme.
     *
     * @param colorId The desired resource identifier, as generated by the aapt
     *                tool. This integer encodes the package, type, and resource
     *                entry. The value 0 is an invalid identifier.
     * @return A single color value in the form 0xAARRGGBB.
     */
    static int getColor(Context context, @ColorRes int colorId) {
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
            // Noinspection deprecation
            return context.getResources().getColor(colorId);
        } else {
            return context.getColor(colorId);
        }
    }

    static boolean checkApiGreaterThan(int api) {
        return Build.VERSION.SDK_INT >= api;
    }

}

package com.github.javiersantos.materialstyleddialogs;

import android.content.Context;
import android.os.Build;
import android.support.annotation.ColorRes;
import android.support.v4.content.ContextCompat;
import android.util.TypedValue;

class UtilsLibrary {

    static int getPrimaryColor(Context context) {
        TypedValue typedValue = new TypedValue();

        context.getTheme().resolveAttribute(R.attr.colorPrimary, typedValue, true);

        return typedValue.data;
    }

    static int dpToPixels(Context context, int dp) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dp * scale + 0.5f);
    }

    static int getColor(Context context, @ColorRes int colorId) {
        return ContextCompat.getColor(context, colorId);
    }

    static boolean checkApiGreaterThan(int api) {
        return Build.VERSION.SDK_INT >= api;
    }

}

Update method to get color


//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.

package org.uma.jmetal.util.solutionattribute.impl;

import org.junit.Test;
import org.uma.jmetal.solution.DoubleSolution;

import static org.junit.Assert.*;

/**
 * @author Antonio J. Nebro <antonio@lcc.uma.es>
 */
public class GenericSolutionAttributeTest {
  @Test
  public void shouldDefaultConstructorCreateASolutionAttributedWithAnIdentifierEqualToTheClassName() {

    GenericSolutionAttribute<DoubleSolution, Integer> genericSolutionAttribute ;
    genericSolutionAttribute = new GenericSolutionAttribute<>() ;

    assertEquals(genericSolutionAttribute.getClass(), genericSolutionAttribute.getAttributeID());
  }

}

Add copyrigth comments to some classes


/**
 * Copyright (C) 2015 android10.org. All rights reserved.
 * @author Fernando Cejas (the android10 coder)
 */
package com.fernandocejas.android10.rx.sample.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import butterknife.ButterKnife;
import com.fernandocejas.android10.rx.sample.R;
import rx.Subscription;
import rx.subscriptions.Subscriptions;

public class SampleActivityObservableTransfor extends Activity {

  private Subscription subscription;

  public static Intent getCallingIntent(Context context) {
    return new Intent(context, SampleActivityObservableTransfor.class);
  }

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

    ButterKnife.inject(this);
    initialize();
  }

  @Override
  protected void onDestroy() {
    this.subscription.unsubscribe();
    super.onDestroy();
  }

  private void initialize() {
    this.subscription = Subscriptions.empty();
  }
}

/**
 * Copyright (C) 2015 android10.org. All rights reserved.
 * @author Fernando Cejas (the android10 coder)
 */
package com.fernandocejas.android10.rx.sample.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import com.fernandocejas.android10.rx.sample.R;
import com.fernandocejas.android10.rx.sample.data.DataManager;
import rx.Subscription;
import rx.subscriptions.Subscriptions;

public class SampleActivityObservableTransfor extends Activity {

  @InjectView(R.id.btn_flatMap) Button btn_flatMap;
  @InjectView(R.id.btn_concatMap) Button btn_concatMap;

  private DataManager dataManager;

  private Subscription subscription;

  public static Intent getCallingIntent(Context context) {
    return new Intent(context, SampleActivityObservableTransfor.class);
  }

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

    ButterKnife.inject(this);
    initialize();
  }

  @Override
  protected void onDestroy() {
    this.subscription.unsubscribe();
    super.onDestroy();
  }

  private void initialize() {
    this.subscription = Subscriptions.empty();
  }

  @OnClick(R.id.btn_flatMap) void onFlatMapClick() {

  }

  @OnClick(R.id.btn_concatMap) void onConcatMapClick() {

  }
}

Add click events for buttons.


/*
 * Copyright 2016 SEARCH-The National Consortium for Justice Information and Statistics
 *
 * 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.search.nibrs.route;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class NibrsRouteApplicationTests {

	@Test
	public void contextLoads() {
	}

}

/*
 * Copyright 2016 SEARCH-The National Consortium for Justice Information and Statistics
 *
 * 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.search.nibrs.route;

import org.apache.camel.CamelContext;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.search.nibrs.fbi.service.NibrsFbiServiceApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.Assert;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = NibrsFbiServiceApplication.class)
public class NibrsRouteApplicationTests {

	@Autowired
	CamelContext context;
	@Test
	public void contextLoads() {
		Assert.notNull(context, "the camel context should not be null");
	}

}

Test the Autowired bean of context.


package com.yuzhouwan.site.service.rpc.core;

import com.yuzhouwan.site.api.rpc.service.IRPCService;
import com.yuzhouwan.site.api.rpc.service.Server;
import com.yuzhouwan.site.service.rpc.service.RPCServiceImpl;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Copyright @ 2017 yuzhouwan.com
 * All right reserved.
 * Function: RPC Tester
 *
 * @author Benedict Jin
 * @since 2016/9/1
 */
public class RPCTest {

    @Test
    public void rpc() throws Exception {

        Server server = new RPC.RPCServer();
        server.register(IRPCService.class, RPCServiceImpl.class);
        server.start();
        Thread.sleep(100);

        IRPCService testServiceImpl = RPC.getProxy(IRPCService.class, "localhost", server.getPort());
        assertEquals("Hello, Benedict!", testServiceImpl.printHello("Benedict"));
        server.stop();  // System.exit(0);
    }
}

package com.yuzhouwan.site.service.rpc.core;

import com.yuzhouwan.site.api.rpc.service.IRPCService;
import com.yuzhouwan.site.api.rpc.service.Server;
import com.yuzhouwan.site.service.rpc.service.RPCServiceImpl;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Copyright @ 2017 yuzhouwan.com
 * All right reserved.
 * Function: RPC Tester
 *
 * @author Benedict Jin
 * @since 2016/9/1
 */
public class RPCTest {

    @Test
    public void rpc() throws Exception {

        Server server = new RPC.RPCServer();
        server.register(IRPCService.class, RPCServiceImpl.class);
        server.start();

        int count = 0, max = 5;
        while (!server.isRunning() && count < max) {
            Thread.sleep(10);
            count++;
        }
        IRPCService testServiceImpl = RPC.getProxy(IRPCService.class, "localhost", server.getPort());
        assertEquals("Hello, Benedict!", testServiceImpl.printHello("Benedict"));
        server.stop();  // System.exit(0);
    }
}

Add retry strategy for RPC server


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

import org.apache.camel.Exchange;
import org.apache.camel.Message;

public final class AwsExchangeUtil {

    private AwsExchangeUtil() {
    }

    public static Message getMessageForResponse(final Exchange exchange) {
        if (exchange.getPattern().isOutCapable()) {
            return exchange.getOut();
        }
        return exchange.getIn();
    }
}

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

import org.apache.camel.Exchange;
import org.apache.camel.Message;

public final class AwsExchangeUtil {

    private AwsExchangeUtil() {
    }

    public static Message getMessageForResponse(final Exchange exchange) {
        if (exchange.getPattern().isOutCapable()) {
            Message out = exchange.getOut();
            out.copyFrom(exchange.getIn());
            return out;
        }
        return exchange.getIn();
    }
}

Revert "Fix over writing previous addToResult calls"


package org.demyo.dao;

import org.demyo.model.IModel;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.NoRepositoryBean;

/**
 * Base interface for manipulation of models.
 *
 * @param <M> The model type (an {@link IModel}).
 */
@NoRepositoryBean
public interface IModelRepo<M extends IModel> extends JpaRepository<M, Long> {
	// TODO: figure out how to return slices. We can't override JpaRepository's findAll to return a slice
	//Slice<M> findAll(Pageable pageable);
}

package org.demyo.dao;

import java.util.List;

import org.demyo.model.IModel;

import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.NoRepositoryBean;

/**
 * Base interface for manipulation of models. This doesn't inherit from JpaRepository, in order to be free to
 * define exactly what we need.
 *
 * @param <M> The model type (an {@link IModel}).
 */
@NoRepositoryBean
public interface IModelRepo<M extends IModel> extends CrudRepository<M, Long> {
	@Override
	List<M> findAll();

	/**
	 * Returns a {@link Slice} of entities meeting the paging restriction provided in the {@code Pageable} object.
	 *
	 * @param pageable
	 * @return a page of entities
	 */
	Slice<M> findAll(Pageable pageable);
}

Return Slices rather than Pages.


package io.appium.android.bootstrap.utils;

import java.nio.charset.Charset;

public class UnicodeEncoder {
  private static final Charset M_UTF7 = Charset.forName("x-IMAP-mailbox-name");
  private static final Charset ASCII  = Charset.forName("US-ASCII");

  public static String encode(final String text) {
    byte[] encoded = text.getBytes(M_UTF7);
    return new String(encoded, ASCII);
  }

  public static boolean needsEncoding(final String text) {
    char[] chars = text.toCharArray();
    for (int i = 0; i < chars.length; i++) {
      int cp = Character.codePointAt(chars, i);
      if (cp > 0x7F || cp == '&') {
        // Selenium uses a Unicode PUA to cover certain special characters
        // see https://code.google.com/p/selenium/source/browse/java/client/src/org/openqa/selenium/Keys.java
        // these should juse be passed through as is.
        return !(cp >= 0xE000 && cp <= 0xE040);
      }
    }
    return false;
  }
}

package io.appium.android.bootstrap.utils;

import java.nio.charset.Charset;

import io.appium.android.bootstrap.Logger;

public class UnicodeEncoder {
  private static final Charset M_UTF7 = Charset.forName("x-IMAP-mailbox-name");
  private static final Charset ASCII  = Charset.forName("US-ASCII");

  public static String encode(final String text) {
    byte[] encoded = text.getBytes(M_UTF7);
    String ret = new String(encoded, ASCII);
    if (ret.charAt(ret.length()-1) != text.charAt(text.length()-1) && !ret.endsWith("-")) {
      // in some cases there is a problem and the closing tag is not added
      // to the encoded text (for instance, with `ü`)
      Logger.debug("Closing tag missing. Adding.");
      ret = ret + "-";
    }
    return ret;
  }

  public static boolean needsEncoding(final String text) {
    char[] chars = text.toCharArray();
    for (int i = 0; i < chars.length; i++) {
      int cp = Character.codePointAt(chars, i);
      if (cp > 0x7F || cp == '&') {
        // Selenium uses a Unicode PUA to cover certain special characters
        // see https://code.google.com/p/selenium/source/browse/java/client/src/org/openqa/selenium/Keys.java
        // these should juse be passed through as is.
        return !(cp >= 0xE000 && cp <= 0xE040);
      }
    }
    return false;
  }
}

Make sure encoding closes correctly


/*
 * Zed Attack Proxy (ZAP) and its related class files.
 *
 * ZAP is an HTTP/HTTPS proxy for assessing web application security.
 *
 * Copyright 2019 The ZAP Development Team
 *
 * 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.zaproxy.zap.extension.wappalyzer;

import static org.junit.jupiter.api.Assertions.fail;

import java.io.IOException;
import org.junit.jupiter.api.Test;

public class WappalyzerAppsJsonParseUnitTest {

    @Test
    public void test() throws IOException {
        // When - there's a parse exception, fail
        WappalyzerJsonParser parser =
                new WappalyzerJsonParser(
                        (pattern, e) -> fail("Regular expression with errors: " + e));
        parser.parseDefaultAppsJson();
    }
}

/*
 * Zed Attack Proxy (ZAP) and its related class files.
 *
 * ZAP is an HTTP/HTTPS proxy for assessing web application security.
 *
 * Copyright 2019 The ZAP Development Team
 *
 * 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.zaproxy.zap.extension.wappalyzer;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.Test;

public class WappalyzerAppsJsonParseUnitTest {

    @Test
    public void test() throws IOException {
        // Given
        List<String> errs = new ArrayList<>();
        // When
        WappalyzerJsonParser parser =
                new WappalyzerJsonParser((pattern, e) -> errs.add(e.toString()));
        parser.parseDefaultAppsJson();
        // Then
        assertEquals(Collections.emptyList(), errs);
    }
}

Tweak UnitTest to collect all failing patterns


package eu.europa.esig.dss.validation.process.qmatrix;

import java.util.Date;

import javax.xml.bind.DatatypeConverter;

public final class EIDASUtils {

	private EIDASUtils() {
	}

	/**
	 * Start date of the eIDAS regulation
	 */
	private final static Date EIDAS_DATE = DatatypeConverter.parseDateTime("2016-07-01T00:00:00.000Z").getTime();

	/**
	 * End of the grace period for eIDAS regulation
	 */
	private final static Date EIDAS_GRACE_DATE = DatatypeConverter.parseDateTime("2017-07-01T00:00:00.000Z").getTime();

	public static boolean isPostEIDAS(Date date) {
		return date != null && date.compareTo(EIDAS_DATE) >= 0;
	}

	public static boolean isPreEIDAS(Date date) {
		return date != null && date.compareTo(EIDAS_DATE) < 0;
	}

	public static boolean isPostGracePeriod(Date date) {
		return date != null && date.compareTo(EIDAS_GRACE_DATE) >= 0;
	}

}

package eu.europa.esig.dss.validation.process.qmatrix;

import java.util.Date;

import javax.xml.bind.DatatypeConverter;

public final class EIDASUtils {

	private EIDASUtils() {
	}

	/**
	 * Start date of the eIDAS regulation
	 *
	 * Regulation was signed in Brussels : 1st of July 00:00 Brussels = 30th of June 22:00 UTC
	 */
	private final static Date EIDAS_DATE = DatatypeConverter.parseDateTime("2016-06-30T22:00:00.000Z").getTime();

	/**
	 * End of the grace period for eIDAS regulation
	 */
	private final static Date EIDAS_GRACE_DATE = DatatypeConverter.parseDateTime("2017-06-30T22:00:00.000Z").getTime();

	public static boolean isPostEIDAS(Date date) {
		return date != null && date.compareTo(EIDAS_DATE) >= 0;
	}

	public static boolean isPreEIDAS(Date date) {
		return date != null && date.compareTo(EIDAS_DATE) < 0;
	}

	public static boolean isPostGracePeriod(Date date) {
		return date != null && date.compareTo(EIDAS_GRACE_DATE) >= 0;
	}

}

Fix eIDAS date (Brussels date is used)


/*
 * (C) Copyright 2015 Boni Garcia (http://bonigarcia.github.io/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */
package io.github.bonigarcia.wdm.test;

import org.junit.Before;
import org.junit.Ignore;
import org.openqa.selenium.firefox.FirefoxDriver;

import io.github.bonigarcia.wdm.base.BaseBrowserTst;

/**
 * Test with Firefox browser.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.0.0
 */
@Ignore
public class FirefoxTest extends BaseBrowserTst {

	@Before
	public void setup() {
		driver = new FirefoxDriver();
	}

}

/*
 * (C) Copyright 2015 Boni Garcia (http://bonigarcia.github.io/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */
package io.github.bonigarcia.wdm.test;

import org.junit.Before;
import org.openqa.selenium.firefox.FirefoxDriver;

import io.github.bonigarcia.wdm.base.BaseBrowserTst;

/**
 * Test with Firefox browser.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.0.0
 */
public class FirefoxTest extends BaseBrowserTst {

	@Before
	public void setup() {
		driver = new FirefoxDriver();
	}

}

Enable FirefoxText (WebDriver 2.53.1 is working again with Firefox 47.0.1)


package it.cosenonjaviste.daggermock.realworldapp;

import android.app.Activity;

import dagger.Binds;
import dagger.Module;
import dagger.android.ActivityKey;
import dagger.android.AndroidInjector;
import dagger.multibindings.IntoMap;
import it.cosenonjaviste.daggermock.realworldapp.main.MainActivity;
import it.cosenonjaviste.daggermock.realworldapp.main.MainActivityComponent;

@Module(subcomponents = {
        MainActivityComponent.class
})
abstract public class MainActivityBindingModule {

    @Binds
    @IntoMap
    @ActivityKey(MainActivity.class)
    abstract AndroidInjector.Factory<? extends Activity> mainActivityInjectorFactory(
            MainActivityComponent.Builder builder);
}

package it.cosenonjaviste.daggermock.realworldapp;

import dagger.Binds;
import dagger.Module;
import dagger.android.AndroidInjector;
import dagger.multibindings.ClassKey;
import dagger.multibindings.IntoMap;
import it.cosenonjaviste.daggermock.realworldapp.main.MainActivity;
import it.cosenonjaviste.daggermock.realworldapp.main.MainActivityComponent;

@Module(subcomponents = {
        MainActivityComponent.class
})
abstract public class MainActivityBindingModule {

    @Binds
    @IntoMap
    @ClassKey(MainActivity.class)
    abstract AndroidInjector.Factory<?> mainActivityInjectorFactory(
            MainActivityComponent.Builder builder);
}

Fix compilation error in RealWorldAppInjector


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

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

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

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

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

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

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

}

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

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

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

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

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

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

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

}

Fix query for oldest (un-swapped) project


package com.orientechnologies.orient.test.server.network.http;

import com.orientechnologies.orient.core.record.impl.ODocument;
import org.apache.http.HttpResponse;
import org.junit.Assert;
import org.junit.Test;

public class HttpServerTest extends BaseHttpDatabaseTest {
  @Test
  public void testGetServer() throws Exception {
    HttpResponse res = get("server").getResponse();
    Assert.assertEquals(res.getStatusLine().getStatusCode(), 200);

    ODocument payload = new ODocument().fromJSON(res.getEntity().getContent());

    Assert.assertTrue(payload.containsField("connections"));
  }

  @Test
  public void testGetConnections() throws Exception {
    HttpResponse res =
        setUserName("root").setUserPassword("root").get("connections/").getResponse();
    Assert.assertEquals(res.getStatusLine().getStatusCode(), 200);

    ODocument payload = new ODocument().fromJSON(res.getEntity().getContent());

    Assert.assertTrue(payload.containsField("connections"));
  }

  @Override
  protected String getDatabaseName() {
    return "server";
  }
}

package com.orientechnologies.orient.test.server.network.http;

import com.orientechnologies.orient.core.record.impl.ODocument;
import org.apache.http.HttpResponse;
import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

public class HttpServerTest extends BaseHttpDatabaseTest {
  @Test
  public void testGetServer() throws Exception {
    HttpResponse res = get("server").getResponse();
    Assert.assertEquals(res.getStatusLine().getStatusCode(), 200);

    ODocument payload = new ODocument().fromJSON(res.getEntity().getContent());

    Assert.assertTrue(payload.containsField("connections"));
  }

  @Test
  public void testGetConnections() throws Exception {
    HttpResponse res =
        setUserName("root").setUserPassword("root").get("connections/").getResponse();
    Assert.assertEquals(res.getStatusLine().getStatusCode(), 200);

    ODocument payload = new ODocument().fromJSON(res.getEntity().getContent());

    Assert.assertTrue(payload.containsField("connections"));
  }

  @Test
  public void testCreateDatabase() throws IOException {
    String dbName = getClass().getSimpleName()+"testCreateDatabase";
    HttpResponse res =
            setUserName("root")
                    .setUserPassword("root")
                    .post("servercommand")
                    .payload("{\"command\":\"create database "+dbName+" plocal\" }", CONTENT.JSON)
                    .getResponse();
    System.out.println(res.getStatusLine().getReasonPhrase());
    Assert.assertEquals(res.getStatusLine().getStatusCode(), 200);

    Assert.assertTrue(getServer().getContext().exists(dbName));
    getServer().getContext().drop(dbName);
  }

  @Override
  protected String getDatabaseName() {
    return "server";
  }
}

Add test cases for HTTP server-level commands


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

public interface EventTracker {

	/**
	 * This method is used to track events (log, action, exception etc) in the application.
	 *
	 * @param name
	 *            Name of event to be tracked
	 * @throws Exception
	 */
	public void track(String name) throws Exception;

	/**
	 * This method is used to track events from extension points given by their id and label
	 *
	 * @param id
	 *            Unique id
	 * @param label
	 *            Name
	 */
	public void track(String id, String label) throws Exception;
}

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

public interface EventTracker {

	/**
	 * This method is used to track events (log, action, exception etc) in the application.
	 *
	 * @param name
	 *            Name of event to be tracked
	 * @throws Exception
	 */
	public void track(String name) throws Exception;

	/**
	 * This method is used to track events from extension points given by their id and label
	 *
	 * @param id
	 *            Unique id
	 * @param label
	 *            Name
	 */
	public void track(String id, String label) throws Exception;

	/**
	 * This method is used to track tool creation events given a tool name. It will track the event name with the prefix
	 * "/Tool/"
	 *
	 * @param name
	 * @throws Exception
	 */
	public void trackToolEvent(String name) throws Exception;

	/**
	 * This method is used to track perspective launch events given a perspective name. It will track the event name
	 * with the prefix "/perspective/".
	 *
	 * @param name
	 * @throws Exception
	 */
	public void trackPerspectiveEvent(String name) throws Exception;

	/**
	 * This method is used to track action events like a user click on a "run" button given the action's name. It will
	 * track the event name with the prefix "/Action/".
	 *
	 * @param name
	 * @throws Exception
	 */
	public void trackActionEvent(String name) throws Exception;
}

Add new tracking methods to API


package org.wildfly.swarm.examples.jaxrs.cdi;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.wildfly.swarm.cdi.ConfigValue;

/**
 * @author Heiko Braun
 */
@ApplicationScoped
@Path("/app")
public class Controller {

    @Inject
    @ConfigValue("some.string.property")
    String stringProperty;

    @Inject
    @ConfigValue("some.integer.property")
    Integer intProperty;

    @Inject
    @ConfigValue("some.boolean.property")
    Boolean boolProperty;

    @GET
    @Path("/propertyString")
    @Produces(MediaType.TEXT_PLAIN)
    public String getStringProperty() {
        if(null==stringProperty) throw new RuntimeException("config property not initialised");
        return stringProperty;
    }

    @GET
    @Path("/propertyInteger")
    @Produces(MediaType.TEXT_PLAIN)
    public String getIntegerProperty() {
        if(null==intProperty) throw new RuntimeException("config property not initialised");
        return String.valueOf(intProperty);
    }

    @GET
    @Path("/propertyBoolean")
    @Produces(MediaType.TEXT_PLAIN)
    public String getBoolProperty() {
        if(null==boolProperty) throw new RuntimeException("config property not initialised");
        return String.valueOf(boolProperty);
    }
}

package org.wildfly.swarm.examples.jaxrs.cdi;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.wildfly.swarm.spi.runtime.annotations.ConfigurationValue;

/**
 * @author Heiko Braun
 */
@ApplicationScoped
@Path("/app")
public class Controller {

    @Inject
    @ConfigurationValue("some.string.property")
    String stringProperty;

    @Inject
    @ConfigurationValue("some.integer.property")
    Integer intProperty;

    @Inject
    @ConfigurationValue("some.boolean.property")
    Boolean boolProperty;

    @GET
    @Path("/propertyString")
    @Produces(MediaType.TEXT_PLAIN)
    public String getStringProperty() {
        if (null == stringProperty) throw new RuntimeException("config property not initialised");
        return stringProperty;
    }

    @GET
    @Path("/propertyInteger")
    @Produces(MediaType.TEXT_PLAIN)
    public String getIntegerProperty() {
        if (null == intProperty) throw new RuntimeException("config property not initialised");
        return String.valueOf(intProperty);
    }

    @GET
    @Path("/propertyBoolean")
    @Produces(MediaType.TEXT_PLAIN)
    public String getBoolProperty() {
        if (null == boolProperty) throw new RuntimeException("config property not initialised");
        return String.valueOf(boolProperty);
    }
}

Modify example as @ConfigurationValue package is now different


package com.jgeppert.struts2.jquery.components;

import org.apache.struts2.conversion.StrutsTypeConverterHolder;
import org.junit.jupiter.api.BeforeEach;

import com.opensymphony.xwork2.DefaultTextProvider;
import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
import com.opensymphony.xwork2.ognl.OgnlUtil;
import com.opensymphony.xwork2.ognl.OgnlValueStack;
import com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor;
import com.opensymphony.xwork2.util.ValueStack;

public abstract class AbstractComponentBaseTest {
    protected ValueStack valueStack;

    @BeforeEach
    void setUpValueStack() {
        valueStack = new TestOgnlValueStack();
    }

    static class TestOgnlValueStack extends OgnlValueStack {
        private static final long serialVersionUID = 1L;

        protected TestOgnlValueStack() {
            super(new TestXworkConverter(), new CompoundRootAccessor(), new DefaultTextProvider(), false);
            TestXworkConverter converter = new TestXworkConverter();
            converter.setTypeConverterHolder(new StrutsTypeConverterHolder());

            setXWorkConverter(converter);
            setOgnlUtil(new OgnlUtil(null, null));
        }

    }

    static class TestXworkConverter extends XWorkConverter {
    }
}

package com.jgeppert.struts2.jquery.components;

import com.opensymphony.xwork2.DefaultTextProvider;
import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
import com.opensymphony.xwork2.ognl.DefaultOgnlBeanInfoCacheFactory;
import com.opensymphony.xwork2.ognl.DefaultOgnlExpressionCacheFactory;
import com.opensymphony.xwork2.ognl.OgnlUtil;
import com.opensymphony.xwork2.ognl.OgnlValueStack;
import com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.conversion.StrutsTypeConverterHolder;
import org.junit.jupiter.api.BeforeEach;

public abstract class AbstractComponentBaseTest {
    protected ValueStack valueStack;

    @BeforeEach
    void setUpValueStack() {
        valueStack = new TestOgnlValueStack();
    }

    static class TestOgnlValueStack extends OgnlValueStack {
        private static final long serialVersionUID = 1L;

        protected TestOgnlValueStack() {
            super(new TestXworkConverter(), new CompoundRootAccessor(), new DefaultTextProvider(), false);
            TestXworkConverter converter = new TestXworkConverter();
            converter.setTypeConverterHolder(new StrutsTypeConverterHolder());

            setXWorkConverter(converter);
            setOgnlUtil(new OgnlUtil(new DefaultOgnlExpressionCacheFactory<>(), new DefaultOgnlBeanInfoCacheFactory<>()));
        }

    }

    static class TestXworkConverter extends XWorkConverter {
    }
}

Set default cache factories for ognl utils in integration tests


/**
 * Licensed to Apereo under one or more contributor license
 * agreements. See the NOTICE file distributed with this work
 * for additional information regarding copyright ownership.
 * Apereo licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License.  You may obtain a
 * copy of the License at the following location:
 *
 *   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.apereo.portal.portlets.backgroundpreference;

import javax.portlet.ActionRequest;
import javax.portlet.PortletRequest;

/**
 * Strategy for selecting different background image sets based on some criteria such as theme, user agent, etc.
 *
 * @author James Wennmacher, jwennmacher@unicon.net
 */

public interface BackgroundSetSelectionStrategy {

    String[] getImageSet(PortletRequest req);

    String[] getImageThumbnailSet(PortletRequest req);

    String[] getImageCaptions(PortletRequest req);

    String getSelectedImage(PortletRequest req);

    String getBackgroundContainerSelector(PortletRequest req);

    void setSelectedImage(ActionRequest req, String backgroundImage);

}

/**
 * Licensed to Apereo under one or more contributor license
 * agreements. See the NOTICE file distributed with this work
 * for additional information regarding copyright ownership.
 * Apereo licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License.  You may obtain a
 * copy of the License at the following location:
 *
 *   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.apereo.portal.portlets.backgroundpreference;

import javax.portlet.ActionRequest;
import javax.portlet.PortletRequest;

/**
 * Strategy for selecting different background image sets based on some criteria such as theme, user agent, etc.
 *
 * @author James Wennmacher, jwennmacher@unicon.net
 */

public interface BackgroundSetSelectionStrategy {

    String[] getImageSet(PortletRequest req);

    String[] getImageThumbnailSet(PortletRequest req);

    /**
     * @since 4.3.2
     */
    String[] getImageCaptions(PortletRequest req);

    String getSelectedImage(PortletRequest req);

    String getBackgroundContainerSelector(PortletRequest req);

    void setSelectedImage(ActionRequest req, String backgroundImage);

}

Add since annotation to getImageCaptions


package de.espend.idea.php.annotation.doctrine.action;

import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.jetbrains.php.codeInsight.PhpCodeInsightUtil;
import com.jetbrains.php.lang.psi.elements.PhpClass;
import com.jetbrains.php.lang.psi.elements.PhpPsiElement;
import de.espend.idea.php.annotation.doctrine.util.DoctrineUtil;
import de.espend.idea.php.annotation.util.PhpDocUtil;
import de.espend.idea.php.annotation.util.PhpElementsUtil;
import org.jetbrains.annotations.NotNull;

/**
 * @author Daniel Espendiller <daniel@espendiller.net>
 */
public class DoctrineEmbeddedClassAnnotationGenerateAction extends DoctrineClassGeneratorAction {
    @NotNull
    @Override
    protected String supportedClass() {
        return "Doctrine\\ORM\\Mapping\\Embedded";
    }

    protected void execute(@NotNull Editor editor, @NotNull PhpClass phpClass, @NotNull PsiFile psiFile) {
        // insert ORM alias
        PhpPsiElement scopeForUseOperator = PhpCodeInsightUtil.findScopeForUseOperator(phpClass.getFirstChild());
        if(scopeForUseOperator != null) {
            PhpElementsUtil.insertUseIfNecessary(scopeForUseOperator, DoctrineUtil.DOCTRINE_ORM_MAPPING, "ORM");
            PsiDocumentManager.getInstance(psiFile.getProject()).doPostponedOperationsAndUnblockDocument(editor.getDocument());
        }

        PhpDocUtil.addClassEmbeddedDocs(phpClass, editor.getDocument(), psiFile);
    }
}

package de.espend.idea.php.annotation.doctrine.action;

import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.jetbrains.php.codeInsight.PhpCodeInsightUtil;
import com.jetbrains.php.lang.psi.elements.PhpClass;
import com.jetbrains.php.lang.psi.elements.PhpPsiElement;
import de.espend.idea.php.annotation.doctrine.util.DoctrineUtil;
import de.espend.idea.php.annotation.util.PhpDocUtil;
import de.espend.idea.php.annotation.util.PhpElementsUtil;
import org.jetbrains.annotations.NotNull;

/**
 * @author Daniel Espendiller <daniel@espendiller.net>
 */
public class DoctrineEmbeddedClassAnnotationGenerateAction extends DoctrineClassGeneratorAction {
    @NotNull
    @Override
    protected String supportedClass() {
        return "Doctrine\\ORM\\Mapping\\Embeddable";
    }

    protected void execute(@NotNull Editor editor, @NotNull PhpClass phpClass, @NotNull PsiFile psiFile) {
        // insert ORM alias
        PhpPsiElement scopeForUseOperator = PhpCodeInsightUtil.findScopeForUseOperator(phpClass.getFirstChild());
        if(scopeForUseOperator != null) {
            PhpElementsUtil.insertUseIfNecessary(scopeForUseOperator, DoctrineUtil.DOCTRINE_ORM_MAPPING, "ORM");
            PsiDocumentManager.getInstance(psiFile.getProject()).doPostponedOperationsAndUnblockDocument(editor.getDocument());
        }

        PhpDocUtil.addClassEmbeddedDocs(phpClass, editor.getDocument(), psiFile);
    }
}

Insert Embeddable instead of Embedded annotation for class


package com.semperos.screwdriver.scripting.js;

import com.semperos.screwdriver.TestUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.ByteArrayOutputStream;
import java.io.File;

import static org.junit.Assert.assertEquals;

public class CoffeeScriptEvalIntegrationTest {
    @Before
    public void setup() throws Exception {
        TestUtil.deleteAssetDirectories();
    }

    @After
    public void tearDown() throws Exception {
        TestUtil.deleteAssetDirectories();
    }

    @Test
    public void testEvalFile() throws Exception {
        String expected = "THIS IS COFFEESCRIPT, outputDir is " + TestUtil.baseDirectoryPath();
        File f = new File(TestUtil.baseDirectoryPath(), "screwdriver_config.coffee");
        // Capture stdout and compare
        ByteArrayOutputStream baos = TestUtil.captureStdout();
        CoffeeScriptEval.evalFile(f);
        assertEquals(expected, baos.toString());
        TestUtil.restoreStdout();
    }
}

package com.semperos.screwdriver.scripting.js;

import com.semperos.screwdriver.TestUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.ByteArrayOutputStream;
import java.io.File;

import static org.junit.Assert.assertEquals;

public class CoffeeScriptEvalIntegrationTest {
    @Before
    public void setup() throws Exception {
        TestUtil.deleteAssetDirectories();
    }

    @After
    public void tearDown() throws Exception {
        TestUtil.deleteAssetDirectories();
    }

    @Test
    public void testEvalFile() throws Exception {
        String expected = "THIS IS COFFEESCRIPT, outputDir is " + TestUtil.baseDirectoryPath();
        File f = new File(TestUtil.baseDirectoryPath(), "screwdriver_build.coffee");
        // Capture stdout and compare
        ByteArrayOutputStream baos = TestUtil.captureStdout();
        CoffeeScriptEval.evalFile(f);
        assertEquals(expected, baos.toString());
        TestUtil.restoreStdout();
    }
}

Fix name of file in test for Clojure scripting


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

import org.apache.qpid.proton4j.amqp.Symbol;

/**
 * Implements the Anonymous SASL authentication mechanism.
 */
public class AnonymousMechanism extends AbstractMechanism {

    public static final Symbol ANONYMOUS = Symbol.valueOf("ANONYMOUS");

    @Override
    public Symbol getName() {
        return ANONYMOUS;
    }
}

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

import org.apache.qpid.proton4j.amqp.Symbol;
import org.apache.qpid.proton4j.buffer.ProtonBuffer;

/**
 * Implements the Anonymous SASL authentication mechanism.
 */
public class AnonymousMechanism extends AbstractMechanism {

    public static final Symbol ANONYMOUS = Symbol.valueOf("ANONYMOUS");

    @Override
    public Symbol getName() {
        return ANONYMOUS;
    }

    @Override
    public ProtonBuffer getInitialResponse() {
        return EMPTY;
    }
}

Add back the empty initial response for ANONYMOUS


package com.mitchellbosecke.pebble.boot.autoconfigure;

import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertyResolver;
import org.springframework.core.io.ResourceLoader;
import org.springframework.util.ClassUtils;

public class PebbleTemplateAvailabilityProvider implements TemplateAvailabilityProvider {

    @Override
    public boolean isTemplateAvailable(String view, Environment environment, ClassLoader classLoader,
            ResourceLoader resourceLoader) {
        if (ClassUtils.isPresent("com.mitchellbosecke.pebble.PebbleEngine", classLoader)) {
            PropertyResolver resolver = new RelaxedPropertyResolver(environment, "pebble.");
            String prefix = resolver.getProperty("prefix", PebbleProperties.DEFAULT_PREFIX);
            String suffix = resolver.getProperty("suffix", PebbleProperties.DEFAULT_SUFFIX);
            return resourceLoader.getResource(prefix + view + suffix).exists();
        } else {
            return false;
        }
    }

}

package com.mitchellbosecke.pebble.boot.autoconfigure;

import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertyResolver;
import org.springframework.core.io.ResourceLoader;
import org.springframework.util.ClassUtils;

public class PebbleTemplateAvailabilityProvider implements TemplateAvailabilityProvider {

    @Override
    public boolean isTemplateAvailable(String view, Environment environment, ClassLoader classLoader,
            ResourceLoader resourceLoader) {
        if (ClassUtils.isPresent("com.mitchellbosecke.pebble.PebbleEngine", classLoader)) {
            PropertyResolver resolver = new RelaxedPropertyResolver(environment, "pebble.");
            String prefix = resolver.getProperty("prefix", PebbleProperties.DEFAULT_PREFIX);
            String suffix = resolver.getProperty("suffix", PebbleProperties.DEFAULT_SUFFIX);
            return resourceLoader.getResource(ResourceLoader.CLASSPATH_URL_PREFIX + prefix + view + suffix).exists();
        } else {
            return false;
        }
    }

}

Fix issue with loading error templates for specific error codes.


package uk.co.automatictester.lightning.gradle.plugin;

import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.GradleRunner;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.io.File;

import static org.gradle.internal.impldep.org.hamcrest.MatcherAssert.assertThat;
import static org.gradle.internal.impldep.org.hamcrest.core.Is.is;
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS;

public class GradleCompatibilityTest {

    @Test(dataProvider = "getGradleVersions")
    public void checkGradleCompatibility(String gradleVersion) {
        BuildResult result = GradleRunner.create()
                .withGradleVersion(gradleVersion)
                .withProjectDir(new File("src/integrationTest/resources/build/complete"))
                .withArguments(":report")
                .withPluginClasspath()
                .build();

        assertThat(result.task(":report").getOutcome(), is(SUCCESS));
    }

    @DataProvider
    private Object[][] getGradleVersions() {
        return new Object[][] {
                new Object[] { "2.14.1" },
                new Object[] { "3.5" },
                new Object[] { "4.0" }
        };
    }
}

package uk.co.automatictester.lightning.gradle.plugin;

import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.GradleRunner;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.io.File;

import static org.gradle.internal.impldep.org.hamcrest.MatcherAssert.assertThat;
import static org.gradle.internal.impldep.org.hamcrest.core.Is.is;
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS;

public class GradleCompatibilityTest {

    @Test(dataProvider = "getGradleVersions")
    public void checkGradleCompatibility(String gradleVersion) {
        BuildResult result = GradleRunner.create()
                .withGradleVersion(gradleVersion)
                .withProjectDir(new File("src/integrationTest/resources/build/complete"))
                .withArguments(":report")
                .withPluginClasspath()
                .build();

        assertThat(result.task(":report").getOutcome(), is(SUCCESS));
    }

    @DataProvider
    private Object[][] getGradleVersions() {
        return new Object[][] {
                new Object[] { "2.14.1" },
                new Object[] { "3.5" }
        };
    }
}

Drop Gradle 4.0 compatibility test - we are using Gradle 4.8 wrapper anyway


/**
 * Copyright (c) 2011 RedEngine Ltd, http://www.RedEngine.co.nz. 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 co.nfigured.example.helloworld.v1;

import javax.jws.WebService;

@WebService
public interface CountingWorld {

  Integer count();

}

/**
 * Copyright (c) 2011 RedEngine Ltd, http://www.RedEngine.co.nz. 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 co.nfigured.example.helloworld.v1;

import javax.jws.WebService;

@WebService
public interface CountingWorld {

  Integer count();

  void stop();

  void start();

}

Include a stop and start to ensure client and server are really talking to each other


package ee.tuleva.onboarding.auth.session;

import java.io.Serializable;
import java.util.Optional;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

@Component
public class GenericSessionStore {

  public <T extends Serializable> void save(T sessionAttribute) {
    session().setAttribute(sessionAttribute.getClass().getName(), sessionAttribute);
  }

  public <T extends Serializable> Optional<T> get(Class clazz) {
    @SuppressWarnings("unchecked")
    T sessionAttribute = (T) session().getAttribute(clazz.getName());

    if (sessionAttribute == null) {
      return Optional.empty();
    }

    return Optional.of(sessionAttribute);
  }

  private static HttpSession session() {
    ServletRequestAttributes attr =
        (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
    boolean allowCreate = true;
    return attr.getRequest().getSession(allowCreate);
  }
}

package ee.tuleva.onboarding.auth.session;

import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

@Component
@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
public class GenericSessionStore implements Serializable {

  @Serial private static final long serialVersionUID = -648103071415508424L;

  private final Map<String, Object> sessionAttributes = new HashMap<>();

  public <T extends Serializable> void save(T sessionAttribute) {
    sessionAttributes.put(sessionAttribute.getClass().getName(), sessionAttribute);
  }

  public <T extends Serializable> Optional<T> get(Class clazz) {
    @SuppressWarnings("unchecked")
    T sessionAttribute = (T) sessionAttributes.get(clazz.getName());

    if (sessionAttribute == null) {
      return Optional.empty();
    }

    return Optional.of(sessionAttribute);
  }
}

Replace manual session handling with spring session scoped bean


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

package org.vaadin.addons.locationtextfield;

import java.io.Serializable;
import java.util.Collection;

/**
 * Inteface providing {@link GeocodedLocation}s based on an address
 */
public interface LocationProvider extends Serializable {
    Collection<GeocodedLocation> geocode(String address) throws GeocodingException;
}

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

package org.vaadin.addons.locationtextfield;

import java.io.Serializable;
import java.util.Collection;

/**
 * Inteface providing {@link GeocodedLocation}s based on an address
 */
public interface LocationProvider<T extends GeocodedLocation> extends Serializable {
    Collection<T> geocode(String address) throws GeocodingException;
}

Allow for specifying a subclass of GeocodedLocation


package com.codenvy.ide.ext.datasource.client.sqllauncher;

import com.google.gwt.i18n.client.Messages;

public interface SqlRequestLauncherConstants extends Messages {

    @DefaultMessage("Open SQL editor")
    String menuEntryOpenSqlEditor();

    @DefaultMessage("SQL editor")
    String sqlEditorWindowTitle();

    @DefaultMessage("Select datasource")
    String selectDatasourceLabel();

    @DefaultMessage("Result limit")
    String resultLimitLabel();

    @DefaultMessage("Execute")
    String executeButtonLabel();

    @DefaultMessage("{0} rows.")
    String updateCountMessage(int count);
}

package com.codenvy.ide.ext.datasource.client.sqllauncher;

import com.google.gwt.i18n.client.LocalizableResource.DefaultLocale;
import com.google.gwt.i18n.client.Messages;

@DefaultLocale("en")
public interface SqlRequestLauncherConstants extends Messages {

    @DefaultMessage("Open SQL editor")
    String menuEntryOpenSqlEditor();

    @DefaultMessage("SQL editor")
    String sqlEditorWindowTitle();

    @DefaultMessage("Select datasource")
    String selectDatasourceLabel();

    @DefaultMessage("Result limit")
    String resultLimitLabel();

    @DefaultMessage("Execute")
    String executeButtonLabel();

    @DefaultMessage("{0} rows.")
    @AlternateMessage({"one", "{0} row."})
    String updateCountMessage(@PluralCount int count);
}

Fix plural form for number of rows message


package org.tkirill.teamcity.bisectPlugin;

import jetbrains.buildServer.controllers.BaseFormXmlController;
import jetbrains.buildServer.serverSide.SBuildServer;
import jetbrains.buildServer.web.openapi.WebControllerManager;
import org.jdom.Element;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class BisectController extends BaseFormXmlController {
    public BisectController(SBuildServer server, WebControllerManager manager) {
        super(server);
        manager.registerController("/bisect/run.html", this);
    }

    @Override
    protected ModelAndView doGet(HttpServletRequest request, HttpServletResponse response) {
        return null;
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response, Element xmlResponse) {
        response.setStatus(200);
//        String buildId = request.getParameter("buildId");
//        if (buildId != null) {
//            if (storage.getValue("bisect-plugin-build-" + buildId) != null) {
//                response.setStatus(400);
//                return;
//            }
//            storage.putValue("bisect-plugin-build-" + buildId, "started");
//        }
    }
}

package org.tkirill.teamcity.bisectPlugin;

import jetbrains.buildServer.controllers.BaseFormXmlController;
import jetbrains.buildServer.serverSide.CustomDataStorage;
import jetbrains.buildServer.serverSide.SBuild;
import jetbrains.buildServer.serverSide.SBuildServer;
import jetbrains.buildServer.web.openapi.WebControllerManager;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class BisectController extends BaseFormXmlController {
    public BisectController(SBuildServer server, WebControllerManager manager) {
        super(server);
        manager.registerController("/bisect/run.html", this);
    }

    @Override
    protected ModelAndView doGet(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response) {
        return null;
    }

    @Override
    protected void doPost(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Element xmlResponse) {
        long buildId = Long.parseLong(request.getParameter("buildId"));
        SBuild build = myServer.findBuildInstanceById(buildId);
        if (build == null) {
            response.setStatus(404);
            return;
        }

        CustomDataStorage storage = build.getBuildType().getCustomDataStorage("bisectPlugin");
        storage.putValue(String.valueOf(buildId), "running");
        response.setStatus(200);
//        String buildId = request.getParameter("buildId");
//        if (buildId != null) {
//            if (storage.getValue("bisect-plugin-build-" + buildId) != null) {
//                response.setStatus(400);
//                return;
//            }
//            storage.putValue("bisect-plugin-build-" + buildId, "started");
//        }
    }
}

Store the flag designating that bisect is running.


package org.edx.mobile.module.db.impl;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

class DbOperationSingleValueByRawQuery<T> extends DbOperationBase<T> {

    private String sqlQuery;
    private String[] selectionArgs;
    private Class<T> columnType;

    DbOperationSingleValueByRawQuery(String sqlQuery, String[] selectionArgs, Class<T> valueType) {
        this.sqlQuery = sqlQuery;
        this.selectionArgs = selectionArgs;
        this.columnType = valueType;
    }

    @Override
    public T execute(SQLiteDatabase db) {
        Cursor c = db.rawQuery(sqlQuery, selectionArgs);

        if (c.moveToFirst()) {
            if (columnType == Long.class) {
                Long column = c.getLong(0);
                return (T) column;
            } else if (columnType == String.class) {
                String column = c.getString(0);
                return (T) column;
            } else if (columnType == Integer.class) {
                Integer column = c.getInt(0);
                return (T) column;
            } else {
                logger.warn("Class types does NOT match for: " + columnType);
            }
        }

        c.close();

        return null;
    }

}

package org.edx.mobile.module.db.impl;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

class DbOperationSingleValueByRawQuery<T> extends DbOperationBase<T> {

    private String sqlQuery;
    private String[] selectionArgs;
    private Class<T> columnType;

    DbOperationSingleValueByRawQuery(String sqlQuery, String[] selectionArgs, Class<T> valueType) {
        this.sqlQuery = sqlQuery;
        this.selectionArgs = selectionArgs;
        this.columnType = valueType;
    }

    @Override
    public T execute(SQLiteDatabase db) {
        Cursor c = db.rawQuery(sqlQuery, selectionArgs);

        T result = null;
        if (c.moveToFirst()) {
            if (columnType == Long.class) {
                Long column = c.getLong(0);
                result = (T) column;
            } else if (columnType == String.class) {
                String column = c.getString(0);
                result = (T) column;
            } else if (columnType == Integer.class) {
                Integer column = c.getInt(0);
                result = (T) column;
            } else {
                logger.warn("Class types does NOT match for: " + columnType);
            }
        }

        c.close();

        return result;
    }

}

Fix cursor not closed in database single value query


package org.csstudio.platform.model;

/**
 * Interface to a control system process variable with archive data source.
 * <p>
 *
 * @see IProcessVariableName
 * @see IArchiveDataSource
 * @author Jan Hatje and Helge Rickens
 *
 */
public interface IProcessVariableWithSample extends IProcessVariable {
	/**
	 * The global type id.
	 */
	String TYPE_ID = "css:processVariableWithSample"; //$NON-NLS-1$

	/**
	 *
	 *
	 * @return
	 */
	double[] getSampleValue();
	/**
	 *
	 *
	 * @return
	 */
	double[] getTimeStamp();
	/**
	 *
	 *
	 * @return
	 */
	String[] getStatus();
	/**
	 *
	 *
	 * @return
	 */
	String[] getSeverity();
	/**
	 *
	 *
	 * @return
	 */
	int getDBRTyp();
	/**
	 *
	 *
	 * @return
	 */
	String getEGU();
	/**
	 *
	 *
	 * @return
	 */
	int getPrecision();
	/**
	 *
	 *
	 * @return
	 */
	double getLow();
	/**
	 *
	 *
	 * @return
	 */
	double getHigh();

}

package org.csstudio.platform.model;

/**
 * Interface to a control system process variable with archive data source.
 * <p>
 *
 * @see IProcessVariableName
 * @see IArchiveDataSource
 * @author Jan Hatje and Helge Rickens
 *
 * TODO It's actually ... process variable with actual data.
 * TODO This is limited to double-type samples.
 * Use either DAL, or the intermediate Value from org.csstudio.utility.pv,
 * which supports more data types as well as their MetaData.
 */
public interface IProcessVariableWithSample extends IProcessVariable {
	/**
	 * The global type id.
	 */
	String TYPE_ID = "css:processVariableWithSample"; //$NON-NLS-1$

	/**
	 *
	 * @return
	 */
	double[] getSampleValue();
	/**
	 *
	 * TODO Use the Timestamp (ITimestamp) found elsewhere in this plugin.
	 * @return
	 */
	double[] getTimeStamp();
	/**
	 *
	 *
	 * @return
	 */
	String[] getStatus();
	/**
	 *
	 *
	 * @return
	 */
	String[] getSeverity();
	/**
	 *
	 *
	 * @return
	 */
	int getDBRTyp();
	/**
	 *
	 *
	 * @return
	 */
	String getEGU();
	/**
	 *
	 *
	 * @return
	 */
	int getPrecision();
	/**
	 *
	 *
	 * @return
	 */
	double getLow();
	/**
	 *
	 *
	 * @return
	 */
	double getHigh();

}

Replace with something that handles more than just 'double' ...


package com.github.thomasfischl.aihome.controller;

import java.io.File;

import com.github.thomasfischl.aihome.communication.sensor.SensorDataGroup;
import com.github.thomasfischl.aihome.controller.rule.RuleEngine;

public class SensorDataProcessorService extends AbstractPipelineService {

  private RuleEngine engine = new RuleEngine(new File("/tmp/rule.config"));

  public SensorDataProcessorService(AbstractPipelineService nextService) {
    super(nextService);
  }

  public void process(SensorDataGroup data) {
    SensorDataGroup newData = engine.evaluate(data);
    executeNextService(newData);
  }

}

package com.github.thomasfischl.aihome.controller;

import java.io.File;

import com.github.thomasfischl.aihome.communication.sensor.SensorDataGroup;
import com.github.thomasfischl.aihome.controller.rule.RuleEngine;

public class SensorDataProcessorService extends AbstractPipelineService {

  private RuleEngine engine = new RuleEngine(new File("/home/pi/aihome/rule.config"));

  public SensorDataProcessorService(AbstractPipelineService nextService) {
    super(nextService);
  }

  public void process(SensorDataGroup data) {
    SensorDataGroup newData = engine.evaluate(data);
    executeNextService(newData);
  }

}

Use other location for rule.config file


package io.github.mikesaelim.poleposition.persistence;

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

public interface ArticlePersistenceRepository extends JpaRepository<ArticlePersistence, String> {
}

package io.github.mikesaelim.poleposition.persistence;

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

@Repository
public interface ArticlePersistenceRepository extends JpaRepository<ArticlePersistence, String> {
}

Make IntelliJ stop crying by adding unnecessary @Repository annotation


// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.content.cluster;

import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
import com.yahoo.vespa.model.content.ResourceLimits;

import java.util.logging.Level;

/**
 * Builder for feed block resource limits.
 *
 * @author geirst
 */
public class DomResourceLimitsBuilder {

    public static ResourceLimits.Builder createBuilder(ModelElement contentXml, boolean hostedVespa, DeployLogger deployLogger) {
        ResourceLimits.Builder builder = new ResourceLimits.Builder();
        ModelElement resourceLimits = contentXml.child("resource-limits");
        if (resourceLimits == null) { return builder; }

        if (hostedVespa) {
            deployLogger.log(Level.WARNING, "Element " + resourceLimits + " is not allowed, default limits will be used");
            // TODO: Throw exception when we are sure nobody is using this
            //throw new IllegalArgumentException("Element " + element + " is not allowed to be set, default limits will be used");
            return builder;
        }
        if (resourceLimits.child("disk") != null) {
            builder.setDiskLimit(resourceLimits.childAsDouble("disk"));
        }
        if (resourceLimits.child("memory") != null) {
            builder.setMemoryLimit(resourceLimits.childAsDouble("memory"));
        }
        return builder;
    }

}

// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.content.cluster;

import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
import com.yahoo.vespa.model.content.ResourceLimits;

import java.util.logging.Level;

/**
 * Builder for feed block resource limits.
 *
 * @author geirst
 */
public class DomResourceLimitsBuilder {

    public static ResourceLimits.Builder createBuilder(ModelElement contentXml, boolean hostedVespa, DeployLogger deployLogger) {
        ResourceLimits.Builder builder = new ResourceLimits.Builder();
        ModelElement resourceLimits = contentXml.child("resource-limits");
        if (resourceLimits == null) { return builder; }

        if (hostedVespa) {
            deployLogger.logApplicationPackage(Level.WARNING, "Element " + resourceLimits +
                                                              " is not allowed, default limits will be used");
            // TODO: Throw exception when we are sure nobody is using this
            //throw new IllegalArgumentException("Element " + element + " is not allowed to be set, default limits will be used");
            return builder;
        }
        if (resourceLimits.child("disk") != null) {
            builder.setDiskLimit(resourceLimits.childAsDouble("disk"));
        }
        if (resourceLimits.child("memory") != null) {
            builder.setMemoryLimit(resourceLimits.childAsDouble("memory"));
        }
        return builder;
    }

}

Use logApplicationPackage so users might get a notification


package com.indeed.proctor.groups;

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

import static com.indeed.proctor.groups.UppercaseFirstCharacterGroups.Test.UPPERCASE_FIRST_CHARACTER_TEST;

/**
 *
 */
public class TestUppercaseFirstCharacterGroups {

    @Test
    public void testUppercaseFirstCharacter() {
        Assert.assertEquals("Uppercase_first_character_test", UPPERCASE_FIRST_CHARACTER_TEST.getName());
    }
}

package com.indeed.proctor.groups;

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

import static com.indeed.proctor.groups.UppercaseFirstCharacterGroups.Test.UPPERCASE_FIRST_CHARACTER_TEST;

/**
 * Test to ensure that Proctor tests that start with an uppercase character retain an unnormalized name in the
 * generated groups class.
 */
public class TestUppercaseFirstCharacterGroups {

    @Test
    public void testUppercaseFirstCharacter() {
        Assert.assertEquals("Uppercase_first_character_test", UPPERCASE_FIRST_CHARACTER_TEST.getName());
    }
}

Add a comment to explain the test


package com.mgaetan89.showsrage.fragment;

import com.google.gson.Gson;
import com.mgaetan89.showsrage.R;

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

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

import static org.assertj.core.api.Assertions.assertThat;

@RunWith(Parameterized.class)
public class ShowsSectionFragment_GetAdapterLayoutResourceTest {
	@Parameterized.Parameter(1)
	public int layoutId;

	@Parameterized.Parameter(0)
	public String preferedShowLayout;

	@Test
	public void getAdapterLayoutResource() {
		assertThat(ShowsSectionFragment.getAdapterLayoutResource(this.preferedShowLayout)).isEqualTo(this.layoutId);
	}

	@Parameterized.Parameters
	public static Collection<Object[]> data() {
		Gson gson = new Gson();

		return Arrays.asList(new Object[][]{
				{null, R.layout.adapter_shows_list_content_poster},
				{"", R.layout.adapter_shows_list_content_poster},
				{"banner", R.layout.adapter_shows_list_content_banner},
				{"fan_art", R.layout.adapter_shows_list_content_poster},
				{"poster", R.layout.adapter_shows_list_content_poster},
		});
	}
}

package com.mgaetan89.showsrage.fragment;

import com.mgaetan89.showsrage.R;

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

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

import static org.assertj.core.api.Assertions.assertThat;

@RunWith(Parameterized.class)
public class ShowsSectionFragment_GetAdapterLayoutResourceTest {
	@Parameterized.Parameter(1)
	public int layoutId;

	@Parameterized.Parameter(0)
	public String preferredShowLayout;

	@Test
	public void getAdapterLayoutResource() {
		assertThat(ShowsSectionFragment.getAdapterLayoutResource(this.preferredShowLayout)).isEqualTo(this.layoutId);
	}

	@Parameterized.Parameters
	public static Collection<Object[]> data() {
		return Arrays.asList(new Object[][]{
				{null, R.layout.adapter_shows_list_content_poster},
				{"", R.layout.adapter_shows_list_content_poster},
				{"banner", R.layout.adapter_shows_list_content_banner},
				{"fan_art", R.layout.adapter_shows_list_content_poster},
				{"poster", R.layout.adapter_shows_list_content_poster},
		});
	}
}

Remove unused variable and fix typo


package org.gemoc.sample.tfsm.design.services;

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

import org.gemoc.gemoc_language_workbench.extensions.sirius.services.AbstractGemocAnimatorServices;

public class TFSMAnimatorServices extends AbstractGemocAnimatorServices {

	@Override
	protected List<StringCouple> getRepresentationRefreshList() {
		final List<StringCouple> res = new ArrayList<StringCouple>();

		res.add(new StringCouple("TFSM", "Animator"));

		return res;
	}

}

package org.gemoc.sample.tfsm.design.services;

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

import org.gemoc.gemoc_language_workbench.extensions.sirius.services.AbstractGemocAnimatorServices;
import org.gemoc.gemoc_modeling_workbench.ui.debug.sirius.services.AbstractGemocDebuggerServices.StringCouple;

public class TFSMAnimatorServices extends AbstractGemocAnimatorServices {

	@Override
	protected List<StringCouple> getRepresentationRefreshList() {
		final List<StringCouple> res = new ArrayList<StringCouple>();

		res.add(new StringCouple("TrafficControl","Debug"));
		res.add(new StringCouple("Semaphore","Debug"));

		res.add(new StringCouple("TrafficControl","Animation"));
		res.add(new StringCouple("Semaphore","Animation"));

		//res.add(new StringCouple("TFSM","Animator"));

		return res;
	}

}

Fix content of the map.


/*
 *  (c) 2012 University of Bolton
 *
 *  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 uk.ac.bolton.spaws.model.util;

import org.json.JSONException;
import org.json.JSONObject;

import uk.ac.bolton.spaws.model.impl.Actor;

public class ActorFactory {

	public static Actor createActor(JSONObject document) throws JSONException{

		if (document.has("resource_data")){
			if (document.getJSONObject("resource_data").has("activity")){
				JSONObject activity = document.getJSONObject("resource_data").getJSONObject("activity");
				if (activity.has("actor")){
					Actor actor = new Actor();
					actor.setName(activity.getJSONObject("actor").getString("displayName"));
					actor.setUrl(activity.getJSONObject("actor").getString("url"));
					return actor;
				}
			}
		}
		return null;

	}

}

/*
 *  (c) 2012 University of Bolton
 *
 *  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 uk.ac.bolton.spaws.model.util;

import org.json.JSONException;
import org.json.JSONObject;

import uk.ac.bolton.spaws.model.impl.Actor;

public class ActorFactory {

	public static Actor createActor(JSONObject document) throws JSONException{

		if (document.has("resource_data")){
			if (document.getJSONObject("resource_data").has("activity")){
				JSONObject activity = document.getJSONObject("resource_data").getJSONObject("activity");
				if (activity.has("actor")){
					Actor actor = new Actor();
					JSONObject jsonActor = activity.getJSONObject("actor");
					actor.setName(jsonActor.getString("displayName"));
					if(jsonActor.has("url")){
						actor.setUrl(jsonActor.getString("url"));
					}
					return actor;
				}
			}
		}
		return null;

	}

}

Check for existence of URL when parsing actor info


package org.ovirt.engine.api.restapi.utils;

import org.ovirt.engine.core.compat.Guid;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class GuidUtils {

    private static final String MD5_SECURITY_ALGORITHM = "MD5";

    public static Guid asGuid(String id) {
        try {
            return new Guid(id);
        }catch (IllegalArgumentException e) {
            throw new MalformedIdException(e);
        }
    }

    /**
     * There are some business entities in the API, which are not regarded as business entities in the engine, and
     * therefore they don't have IDs. The API generates uniqute GUIDs for them, according to their attributes. This
     * method accepts one or more string attributes, concatenates them, and using Md5 hash to generate a unique Guid for
     * them.
     *
     * @param args
     *            one or more strings, guid will be generated from them
     * @return unique Guid generated from the given strings.
     */
    public static Guid generateGuidUsingMd5(String... args) {
        String id = "";
        for (String arg : args) {
            id = id + arg;
        }
        byte[] hash;
        try {
            hash = MessageDigest.getInstance(MD5_SECURITY_ALGORITHM).digest(id.getBytes());
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalStateException(e); // never happens, MD5 algorithm exists
        }
        return new Guid(hash, true);
    }
}

package org.ovirt.engine.api.restapi.utils;

import org.ovirt.engine.core.compat.Guid;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class GuidUtils {

    private static final String MD5_SECURITY_ALGORITHM = "MD5";

    public static Guid asGuid(String id) {
        try {
            return new Guid(id);
        }catch (IllegalArgumentException e) {
            throw new MalformedIdException(e);
        }
    }

    /**
     * There are some business entities in the API, which are not regarded as business entities in the engine, and
     * therefore they don't have IDs. The API generates uniqute GUIDs for them, according to their attributes. This
     * method accepts one or more string attributes, concatenates them, and using Md5 hash to generate a unique Guid for
     * them.
     *
     * @param args
     *            one or more strings, guid will be generated from them
     * @return unique Guid generated from the given strings.
     */
    public static Guid generateGuidUsingMd5(String... args) {
        StringBuilder builder = new StringBuilder();
        for (String arg : args) {
            builder.append(arg);
        }
        byte[] hash;
        try {
            hash = MessageDigest.getInstance(MD5_SECURITY_ALGORITHM).digest(builder.toString().getBytes());
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalStateException(e); // never happens, MD5 algorithm exists
        }
        return new Guid(hash, true);
    }
}

Use StringBuilder for String concatenation