package semanticanalysis;

import java.util.*;

public abstract class ErrorChecker
{
    private List<String> _errors = new ArrayList<String>();

    public List<String> getErrors()
    {
        return _errors;
    }

    protected void addError(String error, int line, int column)
    {
        _errors.add(formatError(error, line, column));
    }

    private String formatError(String error, int line, int column)
    {
        StringBuilder result = new StringBuilder(error);
        result.append(" at ");
        result.append(line);
        result.append(", character ");
        result.append(column);
        return result.toString();
    }
}

package semanticanalysis;

import java.util.*;

public abstract class ErrorChecker
{
    private List<String> _errors = new ArrayList<String>();

    public List<String> getErrors()
    {
        return _errors;
    }

    protected void addError(String error, int line, int column)
    {
        _errors.add(formatError(error, line, column));
    }

    private String formatError(String error, int line, int column)
    {
        StringBuilder result = new StringBuilder(error);
        result.append(" at line ");
        result.append(line);
        result.append(", character ");
        result.append(column);
        return result.toString();
    }
}

Fix small formatting bug in error messages


package de.retest.recheck.configuration;

import static de.retest.recheck.RecheckProperties.RETEST_FOLDER_NAME;

import java.nio.file.Path;
import java.util.Optional;

public class ProjectConfigurationUtil {

	private ProjectConfigurationUtil() {}

	public static Optional<Path> findProjectConfigurationFolder() {
		return ProjectRootFinderUtil.getProjectRoot().map( path -> path.resolve( RETEST_FOLDER_NAME ) );
	}

	public static Optional<Path> findProjectConfigurationFolder( final Path basePath ) {
		return ProjectRootFinderUtil.getProjectRoot( basePath ).map( path -> path.resolve( RETEST_FOLDER_NAME ) );
	}
}

package de.retest.recheck.configuration;

import static de.retest.recheck.RecheckProperties.RETEST_FOLDER_NAME;

import java.nio.file.Path;
import java.util.Optional;

public class ProjectConfigurationUtil {

	private ProjectConfigurationUtil() {}

	public static Optional<Path> findProjectConfigurationFolder() {
		return ProjectRootFinderUtil.getProjectRoot().map( path -> path.resolve( RETEST_FOLDER_NAME ) );
	}

	public static Optional<Path> findProjectConfigurationFolder( final Path basePath ) {
		return ProjectRootFinderUtil.getProjectRoot( basePath ).map( path -> path.resolve( RETEST_FOLDER_NAME ) );
	}

	public static Optional<Path> findSuiteConfigurationFolder( final Path basePath ) {
		return Optional.of( basePath.toAbsolutePath() );
	}
}

Add method to return optional path from absolute path of suite ignore


package me.itszooti.geojson;

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

public class GeoPolygon extends GeoGeometry {

	private List<GeoPosition> exterior;
	private List<List<GeoPosition>> interiors;

	public GeoPolygon(List<GeoPosition> exterior) {
		this.exterior = new ArrayList<GeoPosition>(exterior);
		this.interiors = new ArrayList<List<GeoPosition>>();
	}

	public GeoPolygon(List<GeoPosition> exterior, List<List<GeoPosition>> interiors) {
		this(exterior);
		for (List<GeoPosition> interior : interiors) {
			this.interiors.add(new ArrayList<GeoPosition>(interior));
		}
	}

	public int getNumInteriors() {
		return interiors.size();
	}

	public GeoPosition[] getInterior(int index) {
		List<GeoPosition> interior = interiors.get(index);
		return interior.toArray(new GeoPosition[interior.size()]);
	}

	public GeoPosition[] getExterior() {
		return exterior.toArray(new GeoPosition[exterior.size()]);
	}

}

package me.itszooti.geojson;

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

public class GeoPolygon extends GeoGeometry {

	private List<GeoPosition> exterior;
	private List<List<GeoPosition>> interiors;

	public GeoPolygon(List<GeoPosition> exterior) {
		this.exterior = new ArrayList<GeoPosition>(exterior);
		this.interiors = new ArrayList<List<GeoPosition>>();
	}

	public GeoPolygon(List<GeoPosition> exterior, List<List<GeoPosition>> interiors) {
		this(exterior);
		for (List<GeoPosition> interior : interiors) {
			this.interiors.add(new ArrayList<GeoPosition>(interior));
		}
	}

	public GeoPolygon(GeoPosition[] exterior) {
		this(Arrays.asList(exterior));
	}

	public GeoPolygon(GeoPosition[] exterior, GeoPosition[][] interiors) {
		this(Arrays.asList(exterior));
		for (int i = 0; i < interiors.length; i++) {
			this.interiors.add(Arrays.asList(interiors[i]));
		}
	}

	public int getNumInteriors() {
		return interiors.size();
	}

	public GeoPosition[] getInterior(int index) {
		List<GeoPosition> interior = interiors.get(index);
		return interior.toArray(new GeoPosition[interior.size()]);
	}

	public GeoPosition[] getExterior() {
		return exterior.toArray(new GeoPosition[exterior.size()]);
	}

}

Add array constructor to polygon

Add array constructor to polygon


package net.somethingdreadful.MAL;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.ContextThemeWrapper;

import com.actionbarsherlock.app.SherlockDialogFragment;

public class LogoutConfirmationDialogFragment extends SherlockDialogFragment {
    public LogoutConfirmationDialogFragment() {}

    public interface LogoutConfirmationDialogListener {
        void onLogoutConfirmed();
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.AlertDialog));

        builder.setPositiveButton(R.string.dialog_logout_label_confirm, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int whichButton) {
                ((Home) getActivity()).onLogoutConfirmed();
                dismiss();
            }
        })
        .setNegativeButton(R.string.dialog_label_cancel, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int whichButton) {
                dismiss();
            }
        })
        .setTitle(R.string.dialog_logout_title).setMessage(R.string.dialog_logout_message);

        return builder.create();
    }

    @Override
    public void onDismiss(DialogInterface dialog) {}

    @Override
    public void onCancel(DialogInterface dialog) {
        startActivity(new Intent(getActivity(), Home.class));
        this.dismiss();
    }

}

package net.somethingdreadful.MAL;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.ContextThemeWrapper;

import com.actionbarsherlock.app.SherlockDialogFragment;

public class LogoutConfirmationDialogFragment extends SherlockDialogFragment {
    public LogoutConfirmationDialogFragment() {}

    public interface LogoutConfirmationDialogListener {
        void onLogoutConfirmed();
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.AlertDialog));

        builder.setPositiveButton(R.string.dialog_logout_label_confirm, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int whichButton) {
                ((Home) getActivity()).onLogoutConfirmed();
                dismiss();
            }
        })
        .setNegativeButton(R.string.dialog_label_cancel, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int whichButton) {
                dismiss();
            }
        })
        .setTitle(R.string.dialog_logout_title).setMessage(R.string.dialog_logout_message);

        return builder.create();
    }

    @Override
    public void onDismiss(DialogInterface dialog) {}

    @Override
    public void onCancel(DialogInterface dialog) {
        //      startActivity(new Intent(getActivity(), Home.class)); //Relaunching Home without needing to, causes bad things
        this.dismiss();
    }

}

Fix Logout Dialog Recreating Home

Fix Logout Dialog Recreating Home

The logout dialog was launching a new instance of the home
activity every time it was dismissed by touching outside the
dialog instead of through the proper Cancel button. This
commit is just a quick fix to fix that.


package com.torodb.packaging;

import com.torodb.packaging.config.model.Config;
import com.torodb.packaging.config.model.backend.derby.Derby;
import com.torodb.packaging.config.model.generic.LogLevel;
import com.torodb.packaging.config.util.ConfigUtils;
import java.time.Clock;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.junit.Before;
import org.junit.Test;

/**
 *
 * @author gortiz
 */
public class ToroDBServerTest {

    private Config config;

    @Before
    public void setUp() {
        config = new Config();

        config.getProtocol().getMongo().setReplication(null);
        config.getBackend().setBackendImplementation(new Derby());
        config.getBackend().asDerby().setPassword("torodb");
        config.getGeneric().setLogLevel(LogLevel.TRACE);

        ConfigUtils.validateBean(config);
    }

    @Test
    public void testCreate() {
        ToroDBServer.create(config, Clock.systemUTC());
    }

    @Test
    public void testInitiate() throws TimeoutException {
        ToroDBServer server = ToroDBServer.create(config, Clock.systemUTC());

        server.startAsync();
        server.awaitRunning(5, TimeUnit.SECONDS);

        server.stopAsync();
        server.awaitTerminated(5, TimeUnit.SECONDS);
    }
}

package com.torodb.packaging;

import com.torodb.packaging.config.model.Config;
import com.torodb.packaging.config.model.backend.derby.Derby;
import com.torodb.packaging.config.model.generic.LogLevel;
import com.torodb.packaging.config.util.ConfigUtils;
import java.time.Clock;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.junit.Before;
import org.junit.Test;

/**
 *
 * @author gortiz
 */
public class ToroDBServerTest {

    private Config config;

    @Before
    public void setUp() {
        config = new Config();

        config.getProtocol().getMongo().setReplication(null);
        config.getBackend().setBackendImplementation(new Derby());
        config.getBackend().asDerby().setPassword("torodb");
        config.getGeneric().setLogLevel(LogLevel.TRACE);

        ConfigUtils.validateBean(config);
    }

    @Test
    public void testCreate() {
        ToroDBServer.create(config, Clock.systemUTC());
    }

    @Test
    public void testInitiate() throws TimeoutException {
        ToroDBServer server = ToroDBServer.create(config, Clock.systemUTC());

        server.startAsync();
        server.awaitRunning(10, TimeUnit.SECONDS);

        server.stopAsync();
        server.awaitTerminated(10, TimeUnit.SECONDS);
    }
}

Increase timeout time for "slow" systems


package org.stevewinfield.suja.idk.dedicated.commands.defaults;

import org.apache.log4j.Logger;
import org.stevewinfield.suja.idk.Bootloader;
import org.stevewinfield.suja.idk.dedicated.commands.IDedicatedServerCommand;

public class StopCommand implements IDedicatedServerCommand {

    @Override
    public void execute(String[] args, Logger logger) {
        logger.info("Stopping server...");
        Bootloader.exitServer(0);
    }

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

package org.stevewinfield.suja.idk.dedicated.commands.defaults;

import org.apache.log4j.Logger;
import org.stevewinfield.suja.idk.Bootloader;
import org.stevewinfield.suja.idk.dedicated.commands.IDedicatedServerCommand;
import org.stevewinfield.suja.idk.game.rooms.RoomInstance;
import org.stevewinfield.suja.idk.network.sessions.Session;

public class StopCommand implements IDedicatedServerCommand {

    @Override
    public void execute(String[] args, Logger logger) {
        logger.info("Stopping server...");
        int i = 0;
        for (final Session session : Bootloader.getSessionManager().getSessions()) {
            session.disconnect();
            i++;
        }
        logger.info(i + " User(s) was/were kicked.");
        i = 0;
        for (final RoomInstance room : Bootloader.getGame().getRoomManager().getLoadedRoomInstances()) {
            room.save();
            i++;
        }
        logger.info(i + " Room(s) was/were saved.");
        Bootloader.exitServer(0);
    }

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

Save users and rooms before exiting the Server.


package fr.unice.polytech.al.trafficlight.utils.enums;

/**
 * Created by nathael on 27/10/16.
 */
public class TrafficLightId {
    private final String id;

    public TrafficLightId(String id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof String)
            return id.equals((String) obj);
        else if (obj instanceof TrafficLightId) {
            return id.equals(((TrafficLightId) obj).id);
        }
        else return false;
    }

    @Override
    public String toString() {
        return "TL:"+id;
    }
}

package fr.unice.polytech.al.trafficlight.utils.enums;

/**
 * Created by nathael on 27/10/16.
 */
public class TrafficLightId {
    private final String id;

    public TrafficLightId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof String)
            return id.equals((String) obj);
        else if (obj instanceof TrafficLightId) {
            return id.equals(((TrafficLightId) obj).id);
        }
        else return false;
    }

    @Override
    public String toString() {
        return "TL:"+id;
    }
}

Add a getter to the id

Add a getter to the id


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

package io.sundr.builder.internal;

import javax.lang.model.element.TypeElement;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;

public class BuildableRepository {

    private final Set<TypeElement> buildables = new LinkedHashSet<>();

    public void register(TypeElement buildable) {
        buildables.add(buildable);
    }

    public Set<TypeElement> getBuildables() {
        return Collections.unmodifiableSet(buildables);
    }

    public boolean isBuildable(TypeElement buildable) {
        return buildable != null && buildables.contains(buildable.getQualifiedName().toString());
    }

    public void clear() {
        buildables.clear();
    }
}

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

package io.sundr.builder.internal;

import javax.lang.model.element.TypeElement;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;

public class BuildableRepository {

    private final Set<TypeElement> buildables = new LinkedHashSet<>();

    public void register(TypeElement buildable) {
        buildables.add(buildable);
    }

    public Set<TypeElement> getBuildables() {
        return Collections.unmodifiableSet(buildables);
    }

    public boolean isBuildable(TypeElement buildable) {
        return buildable != null && buildables.contains(buildable);
    }

    public void clear() {
        buildables.clear();
    }
}

Fix isBuildable() in buildable repository.


package com.rbmhtechnology.apidocserver.security;

import org.mitre.openid.connect.client.OIDCAuthenticationFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Profile;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;

@Configuration
@Profile("openid")
public class OpenIdConnectSecurityConfiguration extends WebSecurityConfigurerAdapter {

  private final AuthenticationEntryPoint authenticationEntryPoint;
  private final OIDCAuthenticationFilter authenticationFilter;

  public OpenIdConnectSecurityConfiguration(
      AuthenticationEntryPoint authenticationEntryPoint,
      @Lazy OIDCAuthenticationFilter authenticationFilter) {
    this.authenticationEntryPoint = authenticationEntryPoint;
    this.authenticationFilter = authenticationFilter;
  }

  @Bean
  @Override
  public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
  }

  @Override
  public void configure(HttpSecurity http) throws Exception {
    http
        .addFilterBefore(authenticationFilter, AbstractPreAuthenticatedProcessingFilter.class)
        .exceptionHandling().authenticationEntryPoint(authenticationEntryPoint)
        .and().authorizeRequests()
        .antMatchers("/health").permitAll()
        .anyRequest().authenticated();
  }
}

package com.rbmhtechnology.apidocserver.security;

import org.mitre.openid.connect.client.OIDCAuthenticationFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Profile;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;

@Configuration
@Profile("openid")
public class OpenIdConnectSecurityConfiguration extends WebSecurityConfigurerAdapter {

  private final AuthenticationEntryPoint authenticationEntryPoint;
  private final OIDCAuthenticationFilter authenticationFilter;

  public OpenIdConnectSecurityConfiguration(
      AuthenticationEntryPoint authenticationEntryPoint,
      @Lazy OIDCAuthenticationFilter authenticationFilter) {
    this.authenticationEntryPoint = authenticationEntryPoint;
    this.authenticationFilter = authenticationFilter;
  }

  @Bean
  @Override
  public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
  }

  @Override
  public void configure(HttpSecurity http) throws Exception {
    http
        .addFilterBefore(authenticationFilter, AbstractPreAuthenticatedProcessingFilter.class)
        .exceptionHandling().authenticationEntryPoint(authenticationEntryPoint)
        .and().authorizeRequests()
        .antMatchers("/actuator/health").permitAll()
        .anyRequest().authenticated();
  }
}

Exclude /actuator/health from the authenticated resources


package org.jeecqrs.commands.registry;

import java.util.Iterator;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import org.jeecqrs.commands.CommandHandler;

/**
 *
 */
public class AutoDiscoverCommandHandlerRegistry<C> extends AbstractCommandHandlerRegistry<C> {

    private Logger log = Logger.getLogger(AutoDiscoverCommandHandlerRegistry.class.getName());

    @Inject
    private Instance<CommandHandler> handlerInstances;

    @PostConstruct
    public void startup() {
        log.info("Scanning command handlers");
	Iterator<CommandHandler> it = handlerInstances.iterator();
        if (!it.hasNext()) {
            log.warning("No CommandHandlers found");
        }
	while (it.hasNext()) {
            CommandHandler h = it.next();
            log.fine("Discovered CommandHandler: "+ h);
            this.register(h.handledCommandType(), h);
	}
    }

}

package org.jeecqrs.commands.registry;

import java.util.Iterator;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import org.jeecqrs.commands.CommandHandler;

/**
 *
 */
public class AutoDiscoverCommandHandlerRegistry<C> extends AbstractCommandHandlerRegistry<C> {

    private Logger log = Logger.getLogger(AutoDiscoverCommandHandlerRegistry.class.getName());

    @Inject
    private Instance<CommandHandler<C>> handlerInstances;

    @PostConstruct
    public void startup() {
        log.info("Scanning command handlers");
	Iterator<CommandHandler<C>> it = select(handlerInstances);
        if (!it.hasNext())
            log.warning("No CommandHandlers found");
	while (it.hasNext()) {
            CommandHandler h = it.next();
            log.fine("Discovered CommandHandler: "+ h);
            this.register(h.handledCommandType(), h);
	}
    }

    protected Iterator<CommandHandler<C>> select(Instance<CommandHandler<C>> instances) {
        return instances.iterator();
    }

}

Add selection option for instances of CommandHandlers


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

public class CircuitBreakerConfig<Rejected extends Enum<Rejected>> {

    public final Rejected reason;
    public final Rejected forcedReason;
    public final int failurePercentageThreshold;
    public final long failureThreshold;
    public final long trailingPeriodMillis;
    public final long healthRefreshMillis;
    public final long backOffTimeMillis;
    public final long sampleSizeThreshold;

    public CircuitBreakerConfig(Rejected reason, Rejected forcedReason, long failureThreshold, int failurePercentageThreshold,
                                long trailingPeriodMillis, long healthRefreshMillis, long backOffTimeMillis,
                                long sampleSizeThreshold) {
        this.reason = reason;
        this.forcedReason = forcedReason;
        this.failureThreshold = failureThreshold;
        this.failurePercentageThreshold = failurePercentageThreshold;
        this.trailingPeriodMillis = trailingPeriodMillis;
        this.healthRefreshMillis = healthRefreshMillis;
        this.backOffTimeMillis = backOffTimeMillis;
        this.sampleSizeThreshold = sampleSizeThreshold;
    }
}

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

public class CircuitBreakerConfig<Rejected extends Enum<Rejected>> {

    public final Rejected reason;
    public final Rejected forcedReason;
    public final int failurePercentageThreshold;
    public final long failureThreshold;
    // TODO: Change these all to nanos to avoid computing millis time
    public final long trailingPeriodMillis;
    public final long healthRefreshMillis;
    public final long backOffTimeMillis;
    public final long sampleSizeThreshold;

    public CircuitBreakerConfig(Rejected reason, Rejected forcedReason, long failureThreshold, int failurePercentageThreshold,
                                long trailingPeriodMillis, long healthRefreshMillis, long backOffTimeMillis,
                                long sampleSizeThreshold) {
        this.reason = reason;
        this.forcedReason = forcedReason;
        this.failureThreshold = failureThreshold;
        this.failurePercentageThreshold = failurePercentageThreshold;
        this.trailingPeriodMillis = trailingPeriodMillis;
        this.healthRefreshMillis = healthRefreshMillis;
        this.backOffTimeMillis = backOffTimeMillis;
        this.sampleSizeThreshold = sampleSizeThreshold;
    }
}

Add comment about work to be completed

Add comment about work to be completed


package uk.ac.ebi.quickgo.indexer;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Process to index all the information in Solr
 *
 * @author cbonill
 *
 */
public class QuickGOIndexerProcess {

		static ApplicationContext appContext;
		static QuickGOIndexer quickGOIndexer;

		/**
		 * We can use this method for indexing the data in Solr for the moment
		 *
		 * @param args
		 */
		public static void main(String[] args) {

			appContext = new ClassPathXmlApplicationContext("common-beans.xml",	"indexing-beans.xml", "query-beans.xml");
			quickGOIndexer = (QuickGOIndexer) appContext.getBean("quickGOIndexer");
			String start = DateFormat.getInstance().format(Calendar.getInstance().getTime());
			System.out.println("================================================================");
			System.out.println("STARTED: " + start);
			System.out.println("================================================================");
			quickGOIndexer.index();
			System.out.println("================================================================");
			System.out.println("DONE: " + DateFormat.getInstance().format(Calendar.getInstance().getTime()));
			System.out.println("================================================================");
		}
}

package uk.ac.ebi.quickgo.indexer;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Process to index all the information in Solr
 *
 * @author cbonill
 */
public class QuickGOIndexerProcess {

	static ApplicationContext appContext;
	static QuickGOIndexer quickGOIndexer;

	final static Logger logger = LoggerFactory.getLogger(QuickGOIndexerProcess.class);

	/**
	 * We can use this method for indexing the data in Solr for the moment
	 *
	 * @param args
	 */
	public static void main(String[] args) {

		appContext = new ClassPathXmlApplicationContext("common-beans.xml", "indexing-beans.xml", "query-beans.xml");
		quickGOIndexer = (QuickGOIndexer) appContext.getBean("quickGOIndexer");
		String start = DateFormat.getInstance().format(Calendar.getInstance().getTime());
		logger.info("================================================================");
		logger.info("STARTED: " + start);
		logger.info("================================================================");
		quickGOIndexer.index();
		logger.info("================================================================");
		logger.info("DONE: " + DateFormat.getInstance().format(Calendar.getInstance().getTime()));
		logger.info("================================================================");
	}
}

Move from using Log4j to Simple Logging Facade For Java (SLF4J)


package org.realityforge.replicant.client.gwt;

import dagger.Module;
import dagger.Provides;
import javax.annotation.Nonnull;
import javax.inject.Singleton;
import org.realityforge.replicant.client.EntitySubscriptionManager;
import org.realityforge.replicant.client.EntitySubscriptionManagerImpl;
import org.realityforge.replicant.client.transport.CacheService;

/**
 * A simple Dagger module that defines the repository and change broker services.
 */
@Module
public class ReplicantDaggerModule
{
  @Nonnull
  @Provides
  @Singleton
  public static EntitySubscriptionManager provideEntitySubscriptionManager( @Nonnull final EntitySubscriptionManagerImpl service )
  {
    return service;
  }

  @Nonnull
  @Provides
  @Singleton
  public static CacheService provideCacheService( @Nonnull final LocalCacheService service )
  {
    return service;
  }
}

package org.realityforge.replicant.client.gwt;

import dagger.Module;
import dagger.Provides;
import javax.annotation.Nonnull;
import javax.inject.Singleton;
import org.realityforge.replicant.client.EntitySubscriptionManager;
import org.realityforge.replicant.client.EntitySubscriptionManagerImpl;
import org.realityforge.replicant.client.transport.CacheService;

/**
 * A simple Dagger module for replicant.
 */
@Module
public class ReplicantDaggerModule
{
  @Nonnull
  @Provides
  @Singleton
  public static EntitySubscriptionManager provideEntitySubscriptionManager( @Nonnull final EntitySubscriptionManagerImpl service )
  {
    return service;
  }

  @Nonnull
  @Provides
  @Singleton
  public static CacheService provideCacheService( @Nonnull final LocalCacheService service )
  {
    return service;
  }
}

Update docs to be less incorrect

Update docs to be less incorrect


/* $This file is distributed under the terms of the license in /doc/license.txt$ */

package edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;

public class IndividualSearchResult extends BaseIndividualSearchResult {

    private static final Log log = LogFactory.getLog(IndividualSearchResult.class);

    private static final String CORE = "http://vivoweb.org/ontology/core#";

    public IndividualSearchResult(Individual individual, VitroRequest vreq) {
    	super(individual, vreq);
    	log.info("Called Individual Search Result");
    }

    /* Access methods for templates */

    public String getPreferredTitle() {
    	log.info("Called get Title");
        return individual.getDataValue(CORE + "preferredTitle");
    }

    public String getEmail() {
    	log.info("Called get Email");
    	return individual.getDataValue(CORE + "email");
    }

}

/* $This file is distributed under the terms of the license in /doc/license.txt$ */

package edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;

public class IndividualSearchResult extends BaseIndividualSearchResult {

    private static final Log log = LogFactory.getLog(IndividualSearchResult.class);

    private static final String CORE = "http://vivoweb.org/ontology/core#";

    public IndividualSearchResult(Individual individual, VitroRequest vreq) {
    	super(individual, vreq);
    	log.debug("Called Individual Search Result");
    }

    /* Access methods for templates */

    public String getPreferredTitle() {
    	log.debug("Called get Title");
        return individual.getDataValue(CORE + "preferredTitle");
    }

    public String getEmail() {
    	log.debug("Called get Email");
    	return individual.getDataValue(CORE + "email");
    }

}

Remove superfluous noise from the log.

Remove superfluous noise from the log.


/**
 * An implementation of the NASDAQ MoldUDP64 1.0 protocol.
 *
 *
The implementation is based on the Java NIO API.

 *
 *
The underlying socket channels can be either blocking or non-blocking.
 * In both cases, data transmission always blocks.

 */
package org.jvirtanen.nassau.moldudp64;

/**
 * An implementation of the NASDAQ MoldUDP64 1.00 protocol.
 *
 *
The implementation is based on the Java NIO API.

 *
 *
The underlying socket channels can be either blocking or non-blocking.
 * In both cases, data transmission always blocks.

 */
package org.jvirtanen.nassau.moldudp64;

Fix NASDAQ MoldUDP64 version number

Fix NASDAQ MoldUDP64 version number


/**
*	NotificationService.java
*
*	@author Johan
*/

package se.chalmers.watchme.notifications;

import java.util.Calendar;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;

public class NotificationService extends Service {

	private final IBinder binder = new ServiceBinder();

	public class ServiceBinder extends Binder {
		NotificationService getService() {
			return NotificationService.this;
		}
	}

	@Override
	public IBinder onBind(Intent arg0) {
		return this.binder;
	}

	public int startCommand(Intent intent, int flags, int startID) {

		// This service is sticky - it runs until it's stopped.
		return START_STICKY;
	}

	public void setAlarm(Calendar c) {
		// Start a new task for the alarm on another thread (separated from the UI thread)
		new AlarmTask(this, c).run();
	}
}

/**
*	NotificationService.java
*
*	@author Johan
*/

package se.chalmers.watchme.notifications;

import java.util.Calendar;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;

public class NotificationService extends Service {

	private final IBinder binder = new ServiceBinder();

	public class ServiceBinder extends Binder {
		NotificationService getService() {
			return NotificationService.this;
		}
	}

	@Override
	public IBinder onBind(Intent arg0) {
		return this.binder;
	}

	@Override
	public int onStartCommand(Intent intent, int flags, int startID) {
		Log.i("Custom", "Received start id " + startID + ": " + intent);

		// This service is sticky - it runs until it's stopped.
		return START_STICKY;
	}

	public void setAlarm(Calendar c) {
		Log.i("Custom", "Set alarm");
		// Start a new task for the alarm on another thread (separated from the UI thread)
		new AlarmTask(this, c).run();
	}
}

Fix incorrect name of start command callback


package com.jedrzejewski.slisp.interpreter.primitives;

import com.jedrzejewski.slisp.lispobjects.LispObject;
import com.jedrzejewski.slisp.lispobjects.Num;
import java.util.List;

public abstract class NumPairTester extends Primitive {

    public boolean testSubsequentPairs(List<LispObject> args, DoublePairPredicate predicate) {
        double prevValue = ((Num) args.get(0)).getValue();
        for (LispObject arg : args.subList(1, args.size())) {
            double curValue = ((Num) arg).getValue();
            if (!predicate.test(prevValue, curValue)) {
                return false;
            } else {
                prevValue = curValue;
            }
        }
        return true;
    }

    public interface DoublePairPredicate {
        boolean test(double val1, double val2);
    }
}

package com.jedrzejewski.slisp.interpreter.primitives;

import com.jedrzejewski.slisp.interpreter.exceptions.InterpreterException;
import com.jedrzejewski.slisp.interpreter.exceptions.WrongNumberOfArgsException;
import com.jedrzejewski.slisp.lispobjects.LispObject;
import com.jedrzejewski.slisp.lispobjects.Num;
import java.util.List;

public abstract class NumPairTester extends Primitive {

    public boolean testSubsequentPairs(List<LispObject> args,
                                       DoublePairPredicate predicate)
            throws InterpreterException {
        validate(args);

        double prevValue = ((Num) args.get(0)).getValue();
        for (LispObject arg : args.subList(1, args.size())) {
            double curValue = ((Num) arg).getValue();
            if (!predicate.test(prevValue, curValue)) {
                return false;
            } else {
                prevValue = curValue;
            }
        }
        return true;
    }

    public void validate(List<LispObject> args) throws InterpreterException {
        if (args.size() <= 1) {
            throw WrongNumberOfArgsException.atLeast(2).is(args.size());
        }
        // TODO: check types.
    }

    public interface DoublePairPredicate {
        boolean test(double val1, double val2);
    }
}

Check no of args in comp primitives

Check no of args in comp primitives


/**
 * Components for accessing the Web API of a Wikibase website, such as wikidata.org.
 *
 * @author Markus Kroetzsch
 *
 */
package org.wikidata.wdtk.wikibaseapi;

/*
 * #%L
 * Wikidata Toolkit Wikibase API
 * %%
 * Copyright (C) 2014 Wikidata Toolkit Developers
 * %%
 * 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.
 * #L%
 */

Add license information to file.

Add license information to file.


package com.google.appengine.tools.cloudstorage.oauth;

import com.google.appengine.api.appidentity.AppIdentityService;
import com.google.appengine.api.appidentity.AppIdentityService.GetAccessTokenResult;
import com.google.appengine.api.appidentity.AppIdentityServiceFactory;
import com.google.appengine.api.utils.SystemProperty;

import java.util.List;

/**
 * Provider that uses the AppIdentityService for generating access tokens.
 */
final class AppIdentityAccessTokenProvider implements AccessTokenProvider {
  private final AppIdentityService appIdentityService;

  public AppIdentityAccessTokenProvider() {
    if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Development) {
      throw new IllegalStateException(
          "The access token from AppIdentity won't work in the development environment.");
    }
    this.appIdentityService = AppIdentityServiceFactory.getAppIdentityService();
  }

  @Override
  public GetAccessTokenResult getNewAccessToken(List<String> scopes) {
    return appIdentityService.getAccessToken(scopes);
  }
}

package com.google.appengine.tools.cloudstorage.oauth;

import com.google.appengine.api.appidentity.AppIdentityService;
import com.google.appengine.api.appidentity.AppIdentityService.GetAccessTokenResult;
import com.google.appengine.api.appidentity.AppIdentityServiceFactory;
import com.google.appengine.api.utils.SystemProperty;

import java.util.List;

/**
 * Provider that uses the AppIdentityService for generating access tokens.
 */
final class AppIdentityAccessTokenProvider implements AccessTokenProvider {
  private final AppIdentityService appIdentityService;

  public AppIdentityAccessTokenProvider() {
    this.appIdentityService = AppIdentityServiceFactory.getAppIdentityService();
  }

  @Override
  public GetAccessTokenResult getNewAccessToken(List<String> scopes) {
    if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Development) {
      throw new IllegalStateException(
          "The access token from AppIdentity won't work in the development environment.");
    }
    return appIdentityService.getAccessToken(scopes);
  }
}

Move check for development environment into the getNewAccessToken method.

Revision created by MOE tool push_codebase.
MOE_MIGRATION=7102


package devopsdistilled.operp.server;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.util.Properties;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import devopsdistilled.operp.server.context.AppContext;

public class ServerApp {

	public static void main(String[] args) {
		ApplicationContext context = new AnnotationConfigApplicationContext(
				AppContext.class);

		Properties hibernateProperties = new Properties();
		URL hibernatePropertiesFileUrl = ServerApp.class.getClassLoader()
				.getResource("server/hibernate.properties");
		File hibernatePropertiesFile = new File(
				hibernatePropertiesFileUrl.getFile());
		try {
			InputStream in = new FileInputStream(hibernatePropertiesFile);
			hibernateProperties.load(in);
			String hbm2dllKey = "hibernate.hbm2ddl.auto";
			String hbm2ddlValue = hibernateProperties.getProperty(hbm2dllKey);

			if (hbm2ddlValue.equalsIgnoreCase("create"))
				hibernateProperties.setProperty(hbm2dllKey, "update");

			in.close();
			OutputStream out = new FileOutputStream(hibernatePropertiesFile);
			hibernateProperties.store(out, null);

		} catch (IOException e) {
			System.err.println("hibernate.properties file not found!");
		}

		System.out.println(context);
	}
}

package devopsdistilled.operp.server;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.util.Properties;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import devopsdistilled.operp.server.context.AppContext;

public class ServerApp {

	public static void main(String[] args) {
		ApplicationContext context = new AnnotationConfigApplicationContext(
				AppContext.class);

		Properties hibernateProperties = new Properties();
		URL hibernatePropertiesFileUrl = ServerApp.class.getClassLoader()
				.getResource("server/hibernate.properties");
		File hibernatePropertiesFile = new File(
				hibernatePropertiesFileUrl.getFile());
		try {
			InputStream in = new FileInputStream(hibernatePropertiesFile);
			hibernateProperties.load(in);
			String hbm2dllKey = "hibernate.hbm2ddl.auto";
			String hbm2ddlValue = hibernateProperties.getProperty(hbm2dllKey);

			if (hbm2ddlValue.equalsIgnoreCase("create"))
				hibernateProperties.setProperty(hbm2dllKey, "update");

			in.close();
			OutputStream out = new FileOutputStream(hibernatePropertiesFile);
			hibernateProperties.store(out, null);

		} catch (IOException e) {
			System.err.println("hibernate.properties file not found!");
			e.printStackTrace();
		}

		System.out.println(context);
	}
}

Print stack trace upon error

Print stack trace upon error


/*
 * 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.stagingdata.service;

import org.search.nibrs.stagingdata.model.segment.ArrestReportSegment;
import org.search.nibrs.stagingdata.repository.segment.ArrestReportSegmentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Service to process Group B Arrest Report.
 *
 */
@Service
public class ArrestReportService {
	@Autowired
	ArrestReportSegmentRepository arrestReportSegmentRepository;

	public ArrestReportSegment saveArrestReportSegment(ArrestReportSegment arrestReportSegment){
		return arrestReportSegmentRepository.save(arrestReportSegment);
	}

	public ArrestReportSegment findArrestReportSegment(Integer id){
		return arrestReportSegmentRepository.findOne(id);
	}
}

/*
 * 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.stagingdata.service;

import javax.transaction.Transactional;

import org.search.nibrs.stagingdata.model.segment.ArrestReportSegment;
import org.search.nibrs.stagingdata.repository.segment.ArrestReportSegmentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Service to process Group B Arrest Report.
 *
 */
@Service
public class ArrestReportService {
	@Autowired
	ArrestReportSegmentRepository arrestReportSegmentRepository;

	@Transactional
	public ArrestReportSegment saveArrestReportSegment(ArrestReportSegment arrestReportSegment){
		return arrestReportSegmentRepository.save(arrestReportSegment);
	}

	public ArrestReportSegment findArrestReportSegment(Integer id){
		return arrestReportSegmentRepository.findOne(id);
	}
}

Add @Transactional to the save method.

Add @Transactional to the save method.


package tk.martijn_heil.kingdomessentials.playerclass.hooks;

import me.clip.placeholderapi.PlaceholderAPI;
import me.clip.placeholderapi.external.EZPlaceholderHook;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import tk.martijn_heil.kingdomessentials.playerclass.ModPlayerClass;
import tk.martijn_heil.kingdomessentials.playerclass.model.COnlinePlayer;

public class PlaceHolderApiHook
{
    private boolean usePlaceHolderApi;

    public PlaceHolderApiHook()
    {
        if (Bukkit.getPluginManager().isPluginEnabled("PlaceHolderAPI"))
        {
            ModPlayerClass.getInstance().getNinLogger().info("PlaceHolderAPI detected! Hooking in.");
            this.usePlaceHolderApi = true;
            new Hook(ModPlayerClass.getInstance());
        }
    }

    public String parse(Player p, String s)
    {
        return (this.usePlaceHolderApi) ? PlaceholderAPI.setPlaceholders(p, s) : s;
    }

    private class Hook extends EZPlaceholderHook
    {
        public Hook(Plugin plugin)
        {
            super(plugin, "kingdomess");
        }

        @Override
        public String onPlaceholderRequest(Player player, String s)
        {
            switch (s)
            {
                case ("class_display_name"):
                    return new COnlinePlayer(player).getPlayerClass().getDisplayName();

                case("class_id"):
                    return new COnlinePlayer(player).getPlayerClass().getId();
            }

            return null;
        }
    }
}

package tk.martijn_heil.kingdomessentials.playerclass.hooks;

import me.clip.placeholderapi.PlaceholderAPI;
import me.clip.placeholderapi.external.EZPlaceholderHook;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import tk.martijn_heil.kingdomessentials.playerclass.ModPlayerClass;
import tk.martijn_heil.kingdomessentials.playerclass.model.COnlinePlayer;

public class PlaceHolderApiHook
{
    private boolean usePlaceHolderApi;

    public PlaceHolderApiHook()
    {
        if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI"))
        {
            ModPlayerClass.getInstance().getNinLogger().info("PlaceholderAPI detected! Hooking in.");
            this.usePlaceHolderApi = true;
            new Hook(ModPlayerClass.getInstance());
        }
    }

    public String parse(Player p, String s)
    {
        return (this.usePlaceHolderApi) ? PlaceholderAPI.setPlaceholders(p, s) : s;
    }

    private class Hook extends EZPlaceholderHook
    {
        public Hook(Plugin plugin)
        {
            super(plugin, "kingdomess");
        }

        @Override
        public String onPlaceholderRequest(Player player, String s)
        {
            switch (s)
            {
                case ("class_display_name"):
                    return new COnlinePlayer(player).getPlayerClass().getDisplayName();

                case("class_id"):
                    return new COnlinePlayer(player).getPlayerClass().getId();
            }

            return null;
        }
    }
}

Fix PlaceholderAPI not being detected due to incorrect casing


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

package com.google.samples.quickstart.analytics;

import android.app.Application;

import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Logger;
import com.google.android.gms.analytics.Tracker;

/**
 * This is a subclass of {@link Application} used to provide shared objects for this app, such as
 * the {@link Tracker}.
 */
public class AnalyticsApplication extends Application {
  private Tracker mTracker;

  /**
   * Gets the default {@link Tracker} for this {@link Application}.
   * @return tracker
   */
  synchronized public Tracker getDefaultTracker() {
    if (mTracker == null) {
      GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
      analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
      mTracker = analytics.newTracker(R.xml.tracker);
    }
    return mTracker;
  }
}

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

package com.google.samples.quickstart.analytics;

import android.app.Application;

import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Logger;
import com.google.android.gms.analytics.Tracker;

/**
 * This is a subclass of {@link Application} used to provide shared objects for this app, such as
 * the {@link Tracker}.
 */
public class AnalyticsApplication extends Application {
  private Tracker mTracker;

  /**
   * Gets the default {@link Tracker} for this {@link Application}.
   * @return tracker
   */
  synchronized public Tracker getDefaultTracker() {
    if (mTracker == null) {
      GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
      analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
      mTracker = analytics.newTracker(R.xml.global_tracker);
    }
    return mTracker;
  }
}

Move to generated tracker name

Move to generated tracker name

Change-Id: I1ac24a9278fcfc3a0cc81add5fede9f2435c17ef


/*
 * Copyright © 2012 Sebastian Hoß <mail@shoss.de>
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
 */
package com.github.sebhoss.contract.verifier;

import com.github.sebhoss.contract.annotation.Clause;
import com.github.sebhoss.contract.annotation.SpEL;

import org.springframework.expression.EvaluationContext;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;

/**
 * SpEL-based implementation of the {@link ContractContextFactory}.
 */
@SpEL
public class SpELBasedContractContextFactory implements ContractContextFactory {

    @Override
    public ContractContext createContext(final Object instance, final Object[] arguments, final String[] parameterNames) {
        final ExpressionParser parser = new SpelExpressionParser();
        final EvaluationContext context = new StandardEvaluationContext();

        for (int index = 0; index < arguments.length; index++) {
            context.setVariable(parameterNames[index], arguments[index]);
        }
        context.setVariable(Clause.THIS, instance);

        return new SpELContractContext(parser, context);
    }

}

/*
 * Copyright © 2012 Sebastian Hoß <mail@shoss.de>
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
 */
package com.github.sebhoss.contract.verifier;

import com.github.sebhoss.contract.annotation.SpEL;

import org.springframework.expression.EvaluationContext;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;

/**
 * SpEL-based implementation of the {@link ContractContextFactory}.
 */
@SpEL
public class SpELBasedContractContextFactory implements ContractContextFactory {

    @Override
    public ContractContext createContext(final Object instance, final Object[] arguments, final String[] parameterNames) {
        final ExpressionParser parser = new SpelExpressionParser();
        final EvaluationContext context = new StandardEvaluationContext(instance);

        for (int index = 0; index < arguments.length; index++) {
            context.setVariable(parameterNames[index], arguments[index]);
        }

        return new SpELContractContext(parser, context);
    }

}

Set current instance as root object

Set current instance as root object

Signed-off-by: Sebastian Hoß <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@shoss.de>


package detective.common.httpclient;

import java.util.concurrent.TimeUnit;

import org.apache.http.conn.HttpClientConnectionManager;

public class IdleConnectionMonitorThread extends Thread {

  private final HttpClientConnectionManager connMgr;
  private volatile boolean shutdown;

  public IdleConnectionMonitorThread(HttpClientConnectionManager connMgr) {
    super();
    this.connMgr = connMgr;
  }

  @Override
  public void run() {
    try {
      while (!shutdown) {
        synchronized (this) {
          wait(5000);
          // Close expired connections
          connMgr.closeExpiredConnections();
          // Optionally, close connections
          // that have been idle longer than 30 sec
          connMgr.closeIdleConnections(30, TimeUnit.SECONDS);
        }
      }
    } catch (InterruptedException ex) {
      // terminate
    }
  }

  public void shutdown() {
    shutdown = true;
    synchronized (this) {
      notifyAll();
    }
  }

}

package detective.common.httpclient;

import java.util.concurrent.TimeUnit;

import org.apache.http.conn.HttpClientConnectionManager;

public class IdleConnectionMonitorThread extends Thread {

  private final HttpClientConnectionManager connMgr;
  private volatile boolean shutdown;

  public IdleConnectionMonitorThread(HttpClientConnectionManager connMgr) {
    super();
    this.connMgr = connMgr;

    this.setDaemon(true);
  }

  @Override
  public void run() {
    try {
      while (!shutdown) {
        synchronized (this) {
          wait(5000);
          // Close expired connections
          connMgr.closeExpiredConnections();
          // Optionally, close connections
          // that have been idle longer than 30 sec
          connMgr.closeIdleConnections(30, TimeUnit.SECONDS);
        }
      }
    } catch (InterruptedException ex) {
      // terminate
    }
  }

  public void shutdown() {
    shutdown = true;
    synchronized (this) {
      notifyAll();
    }
  }

}

Change the background thread to daemon thread so that a script closes all other threads closes as well


package org.pdxfinder.repositories;

import org.pdxfinder.dao.OntologyTerm;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Collection;

/**
 * Created by csaba on 07/06/2017.
 */
@Repository
public interface OntologyTermRepository extends PagingAndSortingRepository<OntologyTerm, Long>
{

    OntologyTerm findById();

    @Query("MATCH (o:OntologyTerm) WHERE toLower(o.label) = toLower({label}) return o")
    OntologyTerm findByLabel(@Param("label") String label);

    OntologyTerm findByUrl(String url);

    //AUTO-SUGGEST: Returns all OntologyTerms with mapped samples and all their ancestors
    @Query("MATCH (st:OntologyTerm)<-[*]-(ot:OntologyTerm) " +
            "MATCH (ot)-[m:MAPPED_TO]-(s:Sample) " +
            "RETURN ot,st")
    Collection<OntologyTerm> findAllWithMappings();

}

package org.pdxfinder.repositories;

import org.pdxfinder.dao.OntologyTerm;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.Set;

/**
 * Created by csaba on 07/06/2017.
 */
@Repository
public interface OntologyTermRepository extends PagingAndSortingRepository<OntologyTerm, Long>
{

    OntologyTerm findById();

    @Query("MATCH (o:OntologyTerm) WHERE toLower(o.label) = toLower({label}) return o")
    OntologyTerm findByLabel(@Param("label") String label);

    OntologyTerm findByUrl(String url);

    //AUTO-SUGGEST: Returns all OntologyTerms with mapped samples and all their ancestors
    @Query("MATCH (st:OntologyTerm)<-[*]-(ot:OntologyTerm) " +
            "MATCH (ot)-[m:MAPPED_TO]-(s:Sample) " +
            "RETURN ot,st")
    Collection<OntologyTerm> findAllWithMappings();

    @Query("MATCH (ot:OntologyTerm) RETURN ot")
    Collection<OntologyTerm> findAll();

    @Query("MATCH (st:OntologyTerm)<-[*]-(term:OntologyTerm) " +
            "WHERE st.label = {label} " +
            "RETURN sum(term.indirectMappedSamplesNumber)")
    int getIndirectMappingNumber(@Param("label") String label);

    @Query("MATCH (st:OntologyTerm)<-[*]-(term:OntologyTerm) " +
            "WHERE st.label = {label} " +
            "RETURN term, st")
    Set<OntologyTerm> getDistinctSubTreeNodes(@Param("label") String label);

}

Add findAll() and direct/indirect mapping number getter


// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision.zone;

import com.yahoo.config.provision.CloudName;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.SystemName;

/**
 * @author hakonhall
 */
public interface ZoneApi {

    SystemName getSystemName();

    ZoneId getId();

    /**
     * Returns the virtual ID of this zone. For ordinary zones this is the same as {@link ZoneApi#getId()}, for a
     * system represented as a zone this is a fixed ID that is independent of the actual zone ID.
     */
    default ZoneId getVirtualId() {
        return getId();
    }

    default Environment getEnvironment() { return getId().environment(); }

    default RegionName getRegionName() { return getId().region(); }

    CloudName getCloudName();

    /** Returns the region name within the cloud, e.g. 'us-east-1' in AWS */
    String getCloudNativeRegionName();

}

// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision.zone;

import com.yahoo.config.provision.CloudName;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.SystemName;

/**
 * @author hakonhall
 */
public interface ZoneApi {

    SystemName getSystemName();

    ZoneId getId();

    /** Returns the SYSTEM.ENVIRONMENT.REGION string. */
    default String getFullName() {
        return getSystemName().value() + "." + getEnvironment().value() + "." + getRegionName().value();
    }

    /**
     * Returns the virtual ID of this zone. For ordinary zones this is the same as {@link ZoneApi#getId()}, for a
     * system represented as a zone this is a fixed ID that is independent of the actual zone ID.
     */
    default ZoneId getVirtualId() {
        return getId();
    }

    default Environment getEnvironment() { return getId().environment(); }

    default RegionName getRegionName() { return getId().region(); }

    CloudName getCloudName();

    /** Returns the region name within the cloud, e.g. 'us-east-1' in AWS */
    String getCloudNativeRegionName();

}

Add method to get SystemName.Environment.RegionName


/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.master.file;

import java.io.Closeable;
import java.io.IOException;
import java.util.Collection;
import java.util.List;

/**
 * Interface for a class which gathers block deletion requests, then handles them during close.
 */
public interface BlockDeletionContext extends Closeable {
  /**
   * @param blockIds the blocks to be deleted when the context closes
   */
  default void registerBlocksForDeletion(Collection<Long> blockIds) {
    blockIds.forEach(id -> registerBlockForDeletion(id));
  }

  /**
   * @param blockId the block to be deleted when the context closes
   */
  void registerBlockForDeletion(long blockId);

  /**
   * Interface for block deletion listeners.
   */
  @FunctionalInterface
  interface BlockDeletionListener {
    /**
     * Processes block deletion.
     *
     * @param blocks the deleted blocks
     */
    void process(List<Long> blocks) throws IOException;
  }
}

/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.master.file;

import java.io.Closeable;
import java.io.IOException;
import java.util.Collection;
import java.util.List;

/**
 * Interface for a class which gathers block deletion requests, then handles them during close.
 */
public interface BlockDeletionContext extends Closeable {
  /**
   * @param blockIds the blocks to be deleted when the context closes
   */
  default void registerBlocksForDeletion(Collection<Long> blockIds) {
    blockIds.forEach(this::registerBlockForDeletion);
  }

  /**
   * @param blockId the block to be deleted when the context closes
   */
  void registerBlockForDeletion(long blockId);

  /**
   * Interface for block deletion listeners.
   */
  @FunctionalInterface
  interface BlockDeletionListener {
    /**
     * Processes block deletion.
     *
     * @param blocks the deleted blocks
     */
    void process(List<Long> blocks) throws IOException;
  }
}

Replace lambda with method reference

[SMALLFIX] Replace lambda with method reference

replace lambda with method reference in
/alluxio/core/server/master/src/main/java/alluxio/master/file/BlockDeletionContext.java#registerBlocksForDeletion

Change
blockIds.forEach(id -> registerBlockForDeletion(id));
to
blockIds.forEach(this::registerBlockForDeletion);

pr-link: Alluxio/alluxio#8883
change-id: cid-c34d06a869cf99cff05f90546b2b7f04bbe12250


/*
 * Copyright 2013 MovingBlocks
 *
 * 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.terasology.world.propagation;

import org.terasology.math.geom.Vector3i;
import org.terasology.world.block.Block;

/**
 * A view providing access to the world for batch propagation
 *
 */
public interface PropagatorWorldView {

    byte UNAVAILABLE = -1;

    /**
     * @param pos
     * @return The value of interest at pos, or UNAVAILABLE if out of bounds
     */
    byte getValueAt(Vector3i pos);

    /**
     * @param pos
     * @param value A new value at pos.
     */
    void setValueAt(Vector3i pos, byte value);

    /**
     * @param pos
     * @return The block at pos, or null if out of bounds
     */
    Block getBlockAt(Vector3i pos);

}

/*
 * Copyright 2013 MovingBlocks
 *
 * 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.terasology.world.propagation;

import org.terasology.math.geom.Vector3i;
import org.terasology.world.block.Block;

/**
 * A view providing access to the world specifically for batch propagation
 */
public interface PropagatorWorldView {

    byte UNAVAILABLE = -1;

    /**
     * @return The value of interest at pos, or {@link #UNAVAILABLE} if out of bounds
     */
    byte getValueAt(Vector3i pos);

    /**
     * @param value A new value at pos.
     */
    void setValueAt(Vector3i pos, byte value);

    /**
     * @return The block at pos, or null if out of bounds
     */
    Block getBlockAt(Vector3i pos);

}

Tweak javadoc for propogater world view interface


package com.voodoodyne.gstrap.gae.test;

import com.voodoodyne.gstrap.test.util.TestInfoContextAdapter;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;

/**
 */
public class GAEExtension implements BeforeEachCallback, AfterEachCallback {

	private static final Namespace NAMESPACE = Namespace.create(GAEExtension.class);

	@Override
	public void beforeEach(final ExtensionContext context) throws Exception {
		final GAEHelper helper = new GAEHelper();

		context.getStore(NAMESPACE).put(GAEHelper.class, helper);

		helper.setUp(new TestInfoContextAdapter(context));
	}

	@Override
	public void afterEach(final ExtensionContext context) throws Exception {
		final GAEHelper helper = context.getStore(NAMESPACE).get(GAEHelper.class, GAEHelper.class);
		helper.tearDown();
	}
}

package com.voodoodyne.gstrap.gae.test;

import com.voodoodyne.gstrap.test.util.TestInfoContextAdapter;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
import org.junit.jupiter.api.extension.ExtensionContext.Store;

/**
 */
public class GAEExtension implements BeforeEachCallback, AfterEachCallback {

	private static final Namespace NAMESPACE = Namespace.create(GAEExtension.class);

	/** Key in the store for the queue xml path. If not set, the maven default is used. */
	private static final String QUEUE_XML_PATH = "queueXmlPath";

	/** Optionally override the queue xml path for the GAEHelper */
	public static void setQueueXmlPath(final ExtensionContext context, final String path) {
		context.getStore(NAMESPACE).put(QUEUE_XML_PATH, path);
	}

	@Override
	public void beforeEach(final ExtensionContext context) throws Exception {
		final Store store = context.getStore(NAMESPACE);
		final String queueXmlPath = store.get(QUEUE_XML_PATH, String.class);

		final GAEHelper helper = queueXmlPath == null ? new GAEHelper() : new GAEHelper(queueXmlPath);

		store.put(GAEHelper.class, helper);

		helper.setUp(new TestInfoContextAdapter(context));
	}

	@Override
	public void afterEach(final ExtensionContext context) throws Exception {
		final GAEHelper helper = context.getStore(NAMESPACE).get(GAEHelper.class, GAEHelper.class);
		helper.tearDown();
	}
}

Allow queue xml path to be set by prior extensions


package com.hubspot.jackson.datatype.protobuf;

import com.google.protobuf.ExtensionRegistry;

public class ProtobufJacksonConfig {
  private final ExtensionRegistryWrapper extensionRegistry;
  private final boolean acceptLiteralFieldnames;

  private ProtobufJacksonConfig(ExtensionRegistryWrapper extensionRegistry, boolean acceptLiteralFieldnames) {
    this.extensionRegistry = extensionRegistry;
    this.acceptLiteralFieldnames = acceptLiteralFieldnames;
  }

  public static Builder builder() {
    return new Builder();
  }

  public ExtensionRegistryWrapper extensionRegistry() {
    return extensionRegistry;
  }

  public boolean acceptLiteralFieldnames() {
    return acceptLiteralFieldnames;
  }

  public static class Builder {
    private ExtensionRegistryWrapper extensionRegistry = ExtensionRegistryWrapper.empty();
    private boolean acceptLiteralFieldnames = true;

    private Builder() {}

    public Builder extensionRegistry(ExtensionRegistry extensionRegistry) {
      return extensionRegistry(ExtensionRegistryWrapper.wrap(extensionRegistry));
    }

    public Builder extensionRegistry(ExtensionRegistryWrapper extensionRegistry) {
      this.extensionRegistry = extensionRegistry;
      return this;
    }

    public Builder acceptLiteralFieldnames(boolean acceptLiteralFieldnames) {
      this.acceptLiteralFieldnames = acceptLiteralFieldnames;
      return this;
    }

    public ProtobufJacksonConfig build() {
      return new ProtobufJacksonConfig(extensionRegistry, acceptLiteralFieldnames);
    }
  }
}

package com.hubspot.jackson.datatype.protobuf;

import com.google.protobuf.ExtensionRegistry;

public class ProtobufJacksonConfig {
  private final ExtensionRegistryWrapper extensionRegistry;
  private final boolean acceptLiteralFieldnames;

  private ProtobufJacksonConfig(ExtensionRegistryWrapper extensionRegistry, boolean acceptLiteralFieldnames) {
    this.extensionRegistry = extensionRegistry;
    this.acceptLiteralFieldnames = acceptLiteralFieldnames;
  }

  public static Builder builder() {
    return new Builder();
  }

  public ExtensionRegistryWrapper extensionRegistry() {
    return extensionRegistry;
  }

  public boolean acceptLiteralFieldnames() {
    return acceptLiteralFieldnames;
  }

  public static class Builder {
    private ExtensionRegistryWrapper extensionRegistry = ExtensionRegistryWrapper.empty();
    private boolean acceptLiteralFieldnames = false;

    private Builder() {}

    public Builder extensionRegistry(ExtensionRegistry extensionRegistry) {
      return extensionRegistry(ExtensionRegistryWrapper.wrap(extensionRegistry));
    }

    public Builder extensionRegistry(ExtensionRegistryWrapper extensionRegistry) {
      this.extensionRegistry = extensionRegistry;
      return this;
    }

    public Builder acceptLiteralFieldnames(boolean acceptLiteralFieldnames) {
      this.acceptLiteralFieldnames = acceptLiteralFieldnames;
      return this;
    }

    public ProtobufJacksonConfig build() {
      return new ProtobufJacksonConfig(extensionRegistry, acceptLiteralFieldnames);
    }
  }
}

Change the default to false

Change the default to false


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

package com.google.gerrit.server.git.receive;

import com.google.common.annotations.VisibleForTesting;

public final class ReceiveConstants {
  public static final String PUSH_OPTION_SKIP_VALIDATION = "skip-validation";

  @VisibleForTesting
  public static final String ONLY_USERS_WITH_TOGGLE_WIP_STATE_PERM_CAN_MODIFY_WIP =
      "only users with Toogle-Wip-State permission can modify Work-in-Progress";

  static final String COMMAND_REJECTION_MESSAGE_FOOTER =
      "Contact an administrator to fix the permissions";

  static final String SAME_CHANGE_ID_IN_MULTIPLE_CHANGES =
      "same Change-Id in multiple changes.\n"
          + "Squash the commits with the same Change-Id or "
          + "ensure Change-Ids are unique for each commit";

  private ReceiveConstants() {}
}

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

package com.google.gerrit.server.git.receive;

import com.google.common.annotations.VisibleForTesting;

public final class ReceiveConstants {
  public static final String PUSH_OPTION_SKIP_VALIDATION = "skip-validation";

  @VisibleForTesting
  public static final String ONLY_USERS_WITH_TOGGLE_WIP_STATE_PERM_CAN_MODIFY_WIP =
      "only users with Toggle-Wip-State permission can modify Work-in-Progress";

  static final String COMMAND_REJECTION_MESSAGE_FOOTER =
      "Contact an administrator to fix the permissions";

  static final String SAME_CHANGE_ID_IN_MULTIPLE_CHANGES =
      "same Change-Id in multiple changes.\n"
          + "Squash the commits with the same Change-Id or "
          + "ensure Change-Ids are unique for each commit";

  private ReceiveConstants() {}
}

Fix typo in error message

Fix typo in error message

Change-Id: I20a8781d216e10cce7dda79831c08acfe1b64865


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

import java.awt.*;

import javax.swing.*;

public class ThemeSettingsMenuItem extends JMenuItem {

    public ThemeSettingsMenuItem(final String text) {
        super(text);
        setIcon(ThemeSettings.getInstance().getIcon());
        addActionListener(e -> ThemeSettings.showSettingsDialog(this));
    }
}

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

import javax.swing.*;

public class ThemeSettingsMenuItem extends JMenuItem {

    public ThemeSettingsMenuItem(final String text) {
        super(text);
        setIcon(ThemeSettings.getIcon());
        addActionListener(e -> ThemeSettings.showSettingsDialog(this));
    }
}

Remove static access on instance.

Remove static access on instance.


/*-
 * #%L
 * SciJava polyglot kernel for Jupyter.
 * %%
 * Copyright (C) 2017 Hadrien Mary
 * %%
 * 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.
 * #L%
 */

package org.scijava.notebook.converter;

import org.scijava.Priority;
import org.scijava.convert.Converter;
import org.scijava.notebook.converter.ouput.HTMLNotebookOutput;
import org.scijava.plugin.Plugin;

@Plugin(type = Converter.class, priority = Priority.LOW_PRIORITY)
public class StringToHTMLNotebookConverter
        extends NotebookOutputConverter<String, HTMLNotebookOutput> {

    @Override
    public Class<String> getInputType() {
        return String.class;
    }

    @Override
    public Class<HTMLNotebookOutput> getOutputType() {
        return HTMLNotebookOutput.class;
    }

    @Override
    public HTMLNotebookOutput convert(Object object) {
        return new HTMLNotebookOutput(HTMLNotebookOutput.getMimeType(),
                (String) object);
    }

}

/*-
 * #%L
 * SciJava polyglot kernel for Jupyter.
 * %%
 * Copyright (C) 2017 Hadrien Mary
 * %%
 * 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.
 * #L%
 */

package org.scijava.notebook.converter;

import org.apache.commons.lang3.StringEscapeUtils;
import org.scijava.Priority;
import org.scijava.convert.Converter;
import org.scijava.notebook.converter.ouput.HTMLNotebookOutput;
import org.scijava.plugin.Plugin;

@Plugin(type = Converter.class, priority = Priority.LOW_PRIORITY)
public class StringToHTMLNotebookConverter
        extends NotebookOutputConverter<String, HTMLNotebookOutput> {

    @Override
    public Class<String> getInputType() {
        return String.class;
    }

    @Override
    public Class<HTMLNotebookOutput> getOutputType() {
        return HTMLNotebookOutput.class;
    }

    @Override
    public HTMLNotebookOutput convert(Object object) {
        return new HTMLNotebookOutput(HTMLNotebookOutput.getMimeType(),
            StringEscapeUtils.escapeHtml4((String) object));
    }

}

Fix converter to escape HTML characters

Fix converter to escape HTML characters


package com.ferreusveritas.dynamictrees;

public class ModConstants {

	public static final String MODID = "dynamictrees";
	public static final String NAME = "Dynamic Trees";
	public static final String VERSIONDEV = "1.12.2-9.9.9z";
	public static final String VERSIONAUTO = "@VERSION@";
	public static final String VERSION = VERSIONDEV;

	public static final String AFTER = "after:";
	public static final String BEFORE = "before:";
	public static final String NEXT = ";";

	//Other mods can use this string to depend on the latest version of Dynamic Trees
	public static final String DYNAMICTREES_LATEST = MODID + "@[" + VERSION + ",)";

	//Other Mods
	public static final String DYNAMICTREESBOP = "dynamictreesbop";
	public static final String DYNAMICTREESTC = "dynamictreestc";

	//Other Mods
	public static final String DYNAMICTREESBOP_VER = "@[1.3.1b,)";
	public static final String DYNAMICTREESTC_VER = "@[1.0,)";

	public static final String DEPENDENCIES
		= BEFORE + DYNAMICTREESBOP + DYNAMICTREESBOP_VER
		+ NEXT
		+ BEFORE + DYNAMICTREESTC + DYNAMICTREESTC_VER
		;

}

package com.ferreusveritas.dynamictrees;

public class ModConstants {

	public static final String MODID = "dynamictrees";
	public static final String NAME = "Dynamic Trees";
	public static final String VERSIONDEV = "1.12.2-9.9.9z";
	public static final String VERSIONAUTO = "@VERSION@";
	public static final String VERSION = VERSIONAUTO;

	public static final String AFTER = "after:";
	public static final String BEFORE = "before:";
	public static final String NEXT = ";";

	//Other mods can use this string to depend on the latest version of Dynamic Trees
	public static final String DYNAMICTREES_LATEST = MODID + "@[" + VERSION + ",)";

	//Other Mods
	public static final String DYNAMICTREESBOP = "dynamictreesbop";
	public static final String DYNAMICTREESTC = "dynamictreestc";

	//Other Mods
	public static final String DYNAMICTREESBOP_VER = "@[1.3.1b,)";
	public static final String DYNAMICTREESTC_VER = "@[1.0,)";

	public static final String DEPENDENCIES
		= BEFORE + DYNAMICTREESBOP + DYNAMICTREESBOP_VER
		+ NEXT
		+ BEFORE + DYNAMICTREESTC + DYNAMICTREESTC_VER
		;

}

Change version to "auto" mode

Change version to "auto" mode


package jltools.frontend;

import jltools.ast.*;
import jltools.util.*;

/** A pass which runs a visitor. */
public class VisitorPass extends AbstractPass
{
    Job job;
    NodeVisitor v;

    public VisitorPass(Job job) {
	this(job, null);
    }

    public VisitorPass(Job job, NodeVisitor v) {
	this.job = job;
	this.v = v;
    }

    public void visitor(NodeVisitor v) {
	this.v = v;
    }

    public NodeVisitor visitor() {
	return v;
    }

    public boolean run() {
	Node ast = job.ast();

	if (ast == null) {
	    throw new InternalCompilerError("Null AST: did the parser run?");
	}

        ErrorQueue q = job.compiler().errorQueue();
        int nErrsBefore = q.errorCount();

	ast = ast.visit(v);
        v.finish();

        int nErrsAfter = q.errorCount();

	job.ast(ast);

        return (nErrsBefore == nErrsAfter);
        // because, if they're equal, no new errors occured,
        // so the run was successful.
    }

    public String toString() {
	return v.getClass().getName() + "(" + job + ")";
    }
}

package jltools.frontend;

import jltools.ast.*;
import jltools.util.*;

/** A pass which runs a visitor. */
public class VisitorPass extends AbstractPass
{
    Job job;
    NodeVisitor v;

    public VisitorPass(Job job) {
	this(job, null);
    }

    public VisitorPass(Job job, NodeVisitor v) {
	this.job = job;
	this.v = v;
    }

    public void visitor(NodeVisitor v) {
	this.v = v;
    }

    public NodeVisitor visitor() {
	return v;
    }

    public boolean run() {
	Node ast = job.ast();

	if (ast == null) {
	    throw new InternalCompilerError("Null AST: did the parser run?");
	}

        if (v.begin()) {
            ErrorQueue q = job.compiler().errorQueue();
            int nErrsBefore = q.errorCount();

            ast = ast.visit(v);
            v.finish();

            int nErrsAfter = q.errorCount();

            job.ast(ast);

            return (nErrsBefore == nErrsAfter);
            // because, if they're equal, no new errors occured,
            // so the run was successful.
        }

        return false;
    }

    public String toString() {
	return v.getClass().getName() + "(" + job + ")";
    }
}

Call NodeVisitor.begin() before visiting ast.


package hu.webarticum.treeprinter.decorator;

import hu.webarticum.treeprinter.TreeNode;

public class TrackingTreeNodeDecorator extends AbstractTreeNodeDecorator {

    public final TrackingTreeNodeDecorator parent;

    public final int index;

    public TrackingTreeNodeDecorator(TreeNode baseNode) {
        this(baseNode, null, 0);
    }

    public TrackingTreeNodeDecorator(TreeNode baseNode, TrackingTreeNodeDecorator parent, int index) {
        super(baseNode);
        this.parent = parent;
        this.index = index;
    }

    @Override
    public String content() {
        return decoratedNode.content();
    }

    @Override
    protected TreeNode decorateChild(TreeNode childNode, int index) {
        return new TrackingTreeNodeDecorator(childNode, this, index);
    }

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

    @Override
    public int hashCode() {
        int parentHashCode = parent != null ? parent.hashCode(): 0;
        return (parentHashCode * 37) + index;
    }

    @Override
    public boolean equals(Object other) {
        if (!(other instanceof TrackingTreeNodeDecorator)) {
            return false;
        }

        TrackingTreeNodeDecorator otherReferenceTreeNode = (TrackingTreeNodeDecorator) other;
        TrackingTreeNodeDecorator otherParent = otherReferenceTreeNode.parent;

        if (this == otherReferenceTreeNode) {
            return true;
        } else if (parent == null) {
            if (otherParent != null) {
                return false;
            }
        } else if (otherParent == null || !parent.equals(otherParent)) {
            return false;
        }

        return index == otherReferenceTreeNode.index;
    }

}

package hu.webarticum.treeprinter.decorator;

import hu.webarticum.treeprinter.TreeNode;

public class TrackingTreeNodeDecorator extends AbstractTreeNodeDecorator {

    public final TrackingTreeNodeDecorator parent;

    public final int index;

    public TrackingTreeNodeDecorator(TreeNode baseNode) {
        this(baseNode, null, 0);
    }

    public TrackingTreeNodeDecorator(TreeNode baseNode, TrackingTreeNodeDecorator parent, int index) {
        super(baseNode);
        this.parent = parent;
        this.index = index;
    }

    @Override
    public String content() {
        return decoratedNode.content();
    }

    @Override
    protected TreeNode decorateChild(TreeNode childNode, int index) {
        return new TrackingTreeNodeDecorator(childNode, this, index);
    }

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

    @Override
    public int hashCode() {
        int parentHashCode = parent != null ? parent.hashCode(): 0;
        return (parentHashCode * 37) + index;
    }

    @Override
    public boolean equals(Object other) {
        if (!(other instanceof TrackingTreeNodeDecorator)) {
            return false;
        }

        TrackingTreeNodeDecorator otherTrackingTreeNodeDecorator = (TrackingTreeNodeDecorator) other;
        TrackingTreeNodeDecorator otherParent = otherTrackingTreeNodeDecorator.parent;

        if (this == otherTrackingTreeNodeDecorator) {
            return true;
        } else if (parent == null) {
            if (otherParent != null) {
                return false;
            }
        } else if (otherParent == null || !parent.equals(otherParent)) {
            return false;
        }

        return index == otherTrackingTreeNodeDecorator.index;
    }

}

Rename a variable in TrackingTreeNodeDecocator


package com.annimon.jecp.me;

import com.annimon.jecp.ApplicationListener;
import javax.microedition.midlet.MIDlet;

/**
 *
 * @author aNNiMON
 */
public abstract class JecpMidlet extends MIDlet implements ApplicationListener {

    protected final void startApp() {
        onCreate();
    }

    protected final void pauseApp() {
        onPause();
    }

    protected final void destroyApp(boolean unconditional) {
        onExit();
    }
}

package com.annimon.jecp.me;

import com.annimon.jecp.ApplicationListener;
import javax.microedition.midlet.MIDlet;

/**
 *
 * @author aNNiMON
 */
public abstract class JecpMidlet extends MIDlet implements ApplicationListener {

    protected final void startApp() {
        onStartApp();
    }

    protected final void pauseApp() {
        onPauseApp();
    }

    protected final void destroyApp(boolean unconditional) {
        onDestroyApp();
    }
}

Fix method name in Java ME library

Fix method name in Java ME library


package org.tenidwa.collections.utils;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.util.Arrays;
import java.util.LinkedHashSet;
import org.junit.Assert;
import org.junit.Test;

public final class CollectorsTest {
    @Test
    public void toImmutableSet() {
        Assert.assertEquals(
            ImmutableSet.of(1, 2, 3),
            Arrays.asList(1, 2, 3).stream()
                .collect(Collectors.toImmutableSet())
        );
    }

    @Test
    public void toImmutableList() {
        Assert.assertEquals(
            ImmutableList.of(1, 2, 3),
            Arrays.asList(1, 2, 3).stream()
                .collect(Collectors.toImmutableList())
        );
    }

    @Test
    public void toLinkedHashSet() {
        Assert.assertEquals(
            new LinkedHashSet<Integer>() {
                {
                    add(1);
                    add(2);
                    add(3);
                }
            },
            Arrays.asList(1, 2, 3).stream()
                .collect(Collectors.toLinkedHashSet())
        );
    }
}

package org.tenidwa.collections.utils;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.util.Arrays;
import java.util.LinkedHashSet;
import org.junit.Assert;
import org.junit.Test;

public final class CollectorsTest {
    @Test
    public void toImmutableSet() {
        Assert.assertEquals(
            ImmutableSet.of(1, 2, 3),
            Arrays.asList(1, 2, 3).stream()
                .collect(Collectors.toImmutableSet())
        );
    }

    @Test
    public void toImmutableList() {
        Assert.assertEquals(
            ImmutableList.of(1, 2, 3),
            Arrays.asList(1, 2, 3).stream()
                .collect(Collectors.toImmutableList())
        );
    }

    @Test
    public void toLinkedHashSet() {
        final LinkedHashSet<Integer> expected = new LinkedHashSet<>();
        expected.add(1);
        expected.add(2);
        expected.add(3);
        Assert.assertEquals(
            expected,
            Arrays.asList(1, 2, 3).stream()
                .collect(Collectors.toLinkedHashSet())
        );
    }
}

Change the way an expected set is instantated in a test


package org.apereo.cas.services;

import org.apereo.cas.util.services.RegisteredServiceJsonSerializer;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.core.io.ClassPathResource;

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

/**
 * Handles test cases for {@link JsonServiceRegistryDao}.
 *
 * @author Misagh Moayyed
 * @since 4.1.0
 */
public class JsonServiceRegistryDaoTests extends AbstractResourceBasedServiceRegistryDaoTests {

    @Before
    public void setUp() {
        try {
            this.dao = new JsonServiceRegistryDao(RESOURCE, false, mock(ApplicationEventPublisher.class));
        } catch (final Exception e) {
            throw new IllegalArgumentException(e);
        }
    }

    @Test
    public void verifyLegacyServiceDefn() throws Exception {
        final ClassPathResource resource = new ClassPathResource("Legacy-10000003.json");
        final RegisteredServiceJsonSerializer serializer = new RegisteredServiceJsonSerializer();
        final RegisteredService service = serializer.from(resource.getInputStream());
        assertNotNull(service);
    }
}

package org.apereo.cas.services;

import org.apereo.cas.util.services.RegisteredServiceJsonSerializer;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

import java.io.IOException;

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

/**
 * Handles test cases for {@link JsonServiceRegistryDao}.
 *
 * @author Misagh Moayyed
 * @since 4.1.0
 */
public class JsonServiceRegistryDaoTests extends AbstractResourceBasedServiceRegistryDaoTests {

    @Before
    public void setUp() {
        try {
            this.dao = new JsonServiceRegistryDao(RESOURCE, false, mock(ApplicationEventPublisher.class));
        } catch (final Exception e) {
            throw new IllegalArgumentException(e);
        }
    }

    @Test
    public void verifyLegacyServiceDefn() throws Exception {
        final ClassPathResource resource = new ClassPathResource("Legacy-10000003.json");
        final RegisteredServiceJsonSerializer serializer = new RegisteredServiceJsonSerializer();
        final RegisteredService service = serializer.from(resource.getInputStream());
        assertNotNull(service);
    }

    @Test
    public void verifyExistingDefinitionForCompatibility() throws IOException {
        final Resource resource = new ClassPathResource("returnMappedAttributeReleasePolicyTest1.json");
        final RegisteredServiceJsonSerializer serializer = new RegisteredServiceJsonSerializer();
        final RegisteredService service = serializer.from(resource.getInputStream());
        assertNotNull(service);
    }
}

Clean up transformations of multimaps into JSON