package com.github.dieterdepaepe.jsearch.search.statespace;

/**
 * A node encountered in the search graph while solving a problem.
 *

 * There is a subtle but important difference between a {@code SearchNode} and a search space state. A search space
 * state represents the result from a set of chosen actions. A {@code SearchNode} represents a result, but also
 * information regarding the path found to that search space state (most notably the cost needed to reach that state).
 * While the state space for a certain problem can be either a tree or a graph, the search graph is always a tree.
 *
 *
Implementation note:

 * Each implementation will be specific for a certain kind of problem being solved.
 * It is recommended to store only node-specific information, any information that is shared between nodes
 * should be stored in the problem environment (as described in {@link SearchNodeGenerator}).
 *
 * @author Dieter De Paepe
 */
public interface SearchNode {
    /**
     * Indicates whether this node is a solution.
     * @return true if it is a solution
     */
    public boolean isGoal();

    /**
     * Returns the exact cost associated with this search node.
     * @return the cost
     */
    public double getCost();
}

package com.github.dieterdepaepe.jsearch.search.statespace;

/**
 * A node encountered in the search graph while solving a problem.
 *

 * There is a subtle but important difference between a {@code SearchNode} and a search space state. A search space
 * state represents the result from a set of chosen actions. A {@code SearchNode} represents a result, but also
 * information regarding the path found to that search space state (most notably the cost needed to reach that state).
 * While the state space for a certain problem can be either a tree or a graph, the search graph is always a tree.
 *
 *
Implementation note:

 * Each implementation will be specific for a certain kind of problem being solved.
 * It is recommended to store only node-specific information, any information that is shared between nodes
 * should be stored in the problem environment (as described in {@link SearchNodeGenerator}).
 *
 * @author Dieter De Paepe
 */
public interface SearchNode {
    /**
     * Indicates whether this node is a solution.
     * @return true if it is a solution
     */
    public boolean isGoal();

    /**
     * Returns the exact cost associated with this search node.
     * @return the cost
     */
    public double getCost();

    /**
     * Returns a (lightweight) object that represents the search space state that has been reached by this node.
     *

     * When 2 {@code SearchNode}s have an {@code equal} search space state, the most expensive node can be dropped
     * from the search by a solver.
     * @return a non-null object
     */
    public Object getSearchSpaceState();
}

Add lightweight method for detecting duplicate search nodes.


package org.realityforge.replicant.example.client;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * Callback invoked on completion of every job
 */
public class GlobalAsyncCallback
  implements AsyncCallback
{
  @Override
  public void onFailure( final Throwable caught )
  {
    Window.alert( "Failed!" );
  }

  @Override
  public void onSuccess( final Object result )
  {
  }
}

package org.realityforge.replicant.example.client;

import com.google.gwt.user.client.rpc.AsyncCallback;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Callback invoked on completion of every job
 */
public class GlobalAsyncCallback
  implements AsyncCallback
{
  private static final Logger LOG = Logger.getLogger( GlobalAsyncCallback.class.getName() );

  @Override
  public void onFailure( final Throwable caught )
  {
    LOG.log( Level.WARNING, "A request failed", caught );
  }

  @Override
  public void onSuccess( final Object result )
  {
    LOG.log( Level.INFO, "A request succeeded: " + result );
  }
}

Rework callback so that it emits logs to the console. Less annoying than popups


package org.wikipedia.feed.aggregated;

import android.support.annotation.Nullable;

import com.google.gson.annotations.SerializedName;

import org.wikipedia.feed.model.CardPageItem;
import org.wikipedia.feed.mostread.MostReadArticles;
import org.wikipedia.feed.news.NewsItem;
import org.wikipedia.feed.image.FeaturedImage;

import java.util.List;

public class AggregatedFeedContent {
    @SuppressWarnings("unused") @Nullable private CardPageItem tfa;
    @SuppressWarnings("unused") @Nullable private List<NewsItem> news;
    @SuppressWarnings("unused") @Nullable private CardPageItem random;
    @SuppressWarnings("unused") @SerializedName("mostread") @Nullable private MostReadArticles mostRead;
    @SuppressWarnings("unused") @Nullable private FeaturedImage image;

    @Nullable
    public CardPageItem tfa() {
        return tfa;
    }

    @Nullable
    public List<NewsItem> news() {
        return news;
    }

    @Nullable
    public MostReadArticles mostRead() {
        return mostRead;
    }

    @Nullable
    public FeaturedImage potd() {
        return image;
    }
}

package org.wikipedia.feed.aggregated;

import android.support.annotation.Nullable;

import com.google.gson.annotations.SerializedName;

import org.wikipedia.feed.model.CardPageItem;
import org.wikipedia.feed.mostread.MostReadArticles;
import org.wikipedia.feed.news.NewsItem;
import org.wikipedia.feed.image.FeaturedImage;

import java.util.List;

public class AggregatedFeedContent {
    @SuppressWarnings("unused") @Nullable private CardPageItem tfa;
    @SuppressWarnings("unused") @Nullable private List<NewsItem> news;
    @SuppressWarnings("unused") @SerializedName("mostread") @Nullable private MostReadArticles mostRead;
    @SuppressWarnings("unused") @Nullable private FeaturedImage image;

    @Nullable
    public CardPageItem tfa() {
        return tfa;
    }

    @Nullable
    public List<NewsItem> news() {
        return news;
    }

    @Nullable
    public MostReadArticles mostRead() {
        return mostRead;
    }

    @Nullable
    public FeaturedImage potd() {
        return image;
    }
}

Remove random from aggregated feed parsing


package com.relayrides.pushy.apns;

import io.netty.handler.ssl.OpenSsl;
import io.netty.handler.ssl.SslProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Utility class for choosing SSL providers.
 *
 * @author Jon Chambers
 *
 * @since 0.10
 */
class SslUtil {

    private static final Logger log = LoggerFactory.getLogger(SslUtil.class);

    /**
     * Selects an SSL provider based on the availability of of an ALPN-capable native provider.
     *
     * @return an ALPN-capable native SSL provider if available, or else the JDK SSL provider
     */
    public static SslProvider getSslProvider() {
        final SslProvider sslProvider;

        if (OpenSsl.isAvailable()) {
            if (OpenSsl.isAlpnSupported()) {
                log.info("Native SSL provider is available and supports ALPN; will use native provider.");
                sslProvider = SslProvider.OPENSSL;
            } else {
                log.info("Native SSL provider is available, but does not support ALPN; will use JDK SSL provider.");
                sslProvider = SslProvider.JDK;
            }
        } else {
            log.info("Native SSL provider not available; will use JDK SSL provider.");
            sslProvider = SslProvider.JDK;
        }

        return sslProvider;
    }
}

package com.relayrides.pushy.apns;

import io.netty.handler.ssl.OpenSsl;
import io.netty.handler.ssl.SslProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Utility class for choosing SSL providers.
 *
 * @author Jon Chambers
 *
 * @since 0.10
 */
class SslUtil {

    private static final Logger log = LoggerFactory.getLogger(SslUtil.class);

    /**
     * Selects an SSL provider based on the availability of of an ALPN-capable native provider.
     *
     * @return an ALPN-capable native SSL provider if available, or else the JDK SSL provider
     */
    public static SslProvider getSslProvider() {
        final SslProvider sslProvider;

        if (OpenSsl.isAvailable()) {
            if (OpenSsl.isAlpnSupported()) {
                log.info("Native SSL provider is available and supports ALPN; will use native provider.");
                sslProvider = SslProvider.OPENSSL_REFCNT;
            } else {
                log.info("Native SSL provider is available, but does not support ALPN; will use JDK SSL provider.");
                sslProvider = SslProvider.JDK;
            }
        } else {
            log.info("Native SSL provider not available; will use JDK SSL provider.");
            sslProvider = SslProvider.JDK;
        }

        return sslProvider;
    }
}

Use OPENSSL_REFCNT instead of OPENSSL as our SSL provider when possible.


package com.asesolution.mobile.lorempixel.utils;

import android.graphics.Bitmap;
import android.graphics.Color;

import com.asesolution.mobile.lorempixel.utils.picasso.PaletteTransformation;

public class PaletteUtils {
    private static final int DEFAULT_COLOR = Color.parseColor("#757575");
    private static final int DEFAULT_ALPHA = 170; // 255 * 2 / 3

    public static int getPaletteColor(Bitmap bitmap) {
        int color = PaletteTransformation.getPalette(bitmap).getDarkVibrantColor(DEFAULT_COLOR);

        // Add some transparency. This kind of sucks and it's a little cleaner/faster
        // to just use bitwise operations, but I'm going for a readability here
        return Color.argb(DEFAULT_ALPHA, Color.red(color), Color.green(color), Color.blue(color));
    }
}

package com.asesolution.mobile.lorempixel.utils;

import android.graphics.Bitmap;
import android.graphics.Color;

import com.asesolution.mobile.lorempixel.MainApplication;
import com.asesolution.mobile.lorempixel.R;
import com.asesolution.mobile.lorempixel.utils.picasso.PaletteTransformation;

public class PaletteUtils {
    private static final int DEFAULT_COLOR = MainApplication.getStaticResources().getColor(R.color.md_grey_600, null);
    private static final int DEFAULT_ALPHA = 170; // 255 * 2 / 3

    public static int getPaletteColor(Bitmap bitmap) {
        int color = PaletteTransformation.getPalette(bitmap).getDarkVibrantColor(DEFAULT_COLOR);

        // Add some transparency. This kind of sucks and it's a little cleaner/faster
        // to just use bitwise operations, but I'm going for a readability here
        return Color.argb(DEFAULT_ALPHA, Color.red(color), Color.green(color), Color.blue(color));
    }
}

Update upaletteutils to source default color from colors.xml


package com.i906.mpt.date;

import java.util.Calendar;
import java.util.TimeZone;

import javax.inject.Inject;
import javax.inject.Singleton;

/**
 * @author Noorzaini Ilhami
 */
@Singleton
class DateProvider {

    private final Calendar mCalendar;

    @Inject
    DateProvider() {
        mCalendar = getCalendarInstance();
    }

    private void refresh() {
        mCalendar.setTimeInMillis(getCurrentTime());
    }

    public long getCurrentTime() {
        return System.currentTimeMillis();
    }

    public Calendar getNow() {
        refresh();
        return mCalendar;
    }

    public Calendar getCalendarInstance() {
        return Calendar.getInstance(TimeZone.getTimeZone("GMT+8"));
    }
}

package com.i906.mpt.date;

import java.util.Calendar;
import java.util.TimeZone;

import javax.inject.Inject;
import javax.inject.Singleton;

/**
 * @author Noorzaini Ilhami
 */
@Singleton
class DateProvider {

    private Calendar mCalendar;

    @Inject
    DateProvider() {
    }

    private void refresh() {
        mCalendar = getCalendarInstance();
    }

    public long getCurrentTime() {
        return System.currentTimeMillis();
    }

    public Calendar getNow() {
        refresh();
        return mCalendar;
    }

    public Calendar getCalendarInstance() {
        return Calendar.getInstance(TimeZone.getTimeZone("GMT+8"));
    }
}

Fix random wrong month or year in prayer times


/*
 * Copyright 2017, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.spine3.base;

import com.google.common.base.Converter;

/**
 * Serves as converter from {@code I} to {@code String} with an associated
 * reverse function from {@code String} to {@code I}.
 *
 * <p>It is used for converting back and forth between the different
 * representations of the same information.
 *
 * @author Alexander Yevsyukov
 * @see #convert(Object)
 * @see #reverse()
 */
public abstract class Stringifier<I> extends Converter<I, String> {
}

/*
 * Copyright 2017, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.spine3.base;

import com.google.common.base.Converter;

/**
 * Serves as converter from {@code I} to {@code String} with an associated
 * reverse function from {@code String} to {@code I}.
 *
 * <p>It is used for converting back and forth between the different
 * representations of the same information.
 *
 * @author Alexander Yevsyukov
 * @author Illia Shepilov
 * @see #convert(Object)
 * @see #reverse()
 */
public abstract class Stringifier<I> extends Converter<I, String> {
}

Add the `author` annotation in the documentation.


package buildr.ipojo.cli;

import java.io.File;
import java.io.FileInputStream;
import org.apache.felix.ipojo.manipulator.Pojoization;

public class Main
{
  public static void main( final String[] args )
  {
    if( 4 != args.length )
    {
      System.err.println("Usage: <input_file_name> <output_file_name> <metadata_file_name> <print_trace_messages?>");
      System.exit( 42 );
    }
    final String inputFilename = args[0];
    final String outputFilename = args[1];
    final String metadataFilename = args[2];
    final boolean printTraceMessage = args[3].equals( "true" );
    boolean inError;

    try
    {
      final Pojoization pojoizer = new Pojoization();
      pojoizer.setUseLocalXSD();
      pojoizer.pojoization( new File( inputFilename ),
                            new File( outputFilename ),
                            new FileInputStream( metadataFilename ) );
      if( printTraceMessage )
      {
        for( final Object message : pojoizer.getWarnings() )
        {
          System.out.println( "Pojoizer Warning: " + message );
        }
      }

      inError = pojoizer.getWarnings().size() != 0;
      for( final Object message : pojoizer.getWarnings() )
      {
        System.err.println( "Pojoizer Error: " + message );
      }
    }
    catch( final Exception e )
    {
      e.printStackTrace( System.err );
      inError = true;
    }

    System.exit( inError ? 1 : 0 );
  }
}

package buildr.ipojo.cli;

import java.io.File;
import java.io.FileInputStream;
import org.apache.felix.ipojo.manipulator.Pojoization;

public class Main
{
  public static void main( final String[] args )
  {
    if( 4 != args.length )
    {
      System.err.println("Usage: <input_file_name> <output_file_name> <metadata_file_name> <print_trace_messages?>");
      System.exit( 42 );
    }
    final String inputFilename = args[0];
    final String outputFilename = args[1];
    final String metadataFilename = args[2];
    final boolean printTraceMessage = args[3].equals( "true" );
    boolean inError;

    try
    {
      final Pojoization pojoizer = new Pojoization();
      pojoizer.setUseLocalXSD();
      pojoizer.pojoization( new File( inputFilename ),
                            new File( outputFilename ),
                            new FileInputStream( metadataFilename ) );
      if( printTraceMessage )
      {
        for( final Object message : pojoizer.getWarnings() )
        {
          System.out.println( "Pojoizer Warning: " + message );
        }
      }

      inError = pojoizer.getErrors().size() != 0;
      for( final Object message : pojoizer.getErrors() )
      {
        System.err.println( "Pojoizer Error: " + message );
      }
    }
    catch( final Exception e )
    {
      e.printStackTrace( System.err );
      inError = true;
    }

    System.exit( inError ? 1 : 0 );
  }
}

Fix bug where warnings were being printed as errors


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

import javax.inject.Inject;

import com.codenvy.ide.Resources;
import com.codenvy.ide.dto.DtoFactory;
import com.codenvy.ide.editor.common.client.texteditor.EditorWidgetFactory;
import com.codenvy.ide.editor.common.client.texteditor.EmbeddedTextEditorPartView;
import com.codenvy.ide.editor.common.client.texteditor.EmbeddedTextEditorPartViewImpl;
import com.codenvy.ide.editor.common.client.texteditor.EmbeddedTextEditorViewFactory;

public class OrionTextEditorViewFactory implements EmbeddedTextEditorViewFactory {

    @Inject
    private EditorWidgetFactory<OrionEditorWidget> widgetFactory;

    @Override
    public EmbeddedTextEditorPartView createTextEditorPartView(final Resources resources, DtoFactory dtoFactory) {
        return new EmbeddedTextEditorPartViewImpl<OrionEditorWidget>(this.widgetFactory);
    }
}

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

import javax.inject.Inject;

import com.codenvy.ide.editor.common.client.filetype.FileTypeIdentifier;
import com.codenvy.ide.editor.common.client.texteditor.EditorWidgetFactory;
import com.codenvy.ide.editor.common.client.texteditor.EmbeddedTextEditorPartView;
import com.codenvy.ide.editor.common.client.texteditor.EmbeddedTextEditorPartViewImpl;
import com.codenvy.ide.editor.common.client.texteditor.EmbeddedTextEditorViewFactory;

public class OrionTextEditorViewFactory implements EmbeddedTextEditorViewFactory {

    @Inject
    private EditorWidgetFactory<OrionEditorWidget> widgetFactory;
    @Inject
    private FileTypeIdentifier                     fileTypeIdentifier;

    @Override
    public EmbeddedTextEditorPartView createTextEditorPartView() {
        return new EmbeddedTextEditorPartViewImpl<OrionEditorWidget>(this.widgetFactory, this.fileTypeIdentifier);
    }
}

Update the factory after common js editor change


package io.gatekeeper.node.service.replication;

import io.gatekeeper.configuration.Configuration;
import io.gatekeeper.configuration.data.replication.LocalReplicationConfiguration;
import io.gatekeeper.model.Endpoint;
import io.gatekeeper.node.service.ReplicationService;
import io.gatekeeper.node.service.replication.common.Node;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;

public class LocalReplicationService extends ReplicationService<LocalReplicationConfiguration> {

    public LocalReplicationService(Configuration configuration) {
        super(configuration);
    }

    @Override
    public CompletableFuture<Void> start() {
        return CompletableFuture.completedFuture(null);
    }

    @Override
    public CompletableFuture<Integer> countNodes() {
        return CompletableFuture.completedFuture(1);
    }

    @Override
    public CompletableFuture<List<Node>> fetchNodes() {
        return CompletableFuture.completedFuture(Collections.singletonList(new Node(
            "local",
            replicationConfiguration.rpcAddress,
            replicationConfiguration.rpcPort
        )));
    }

    @Override
    public void close() throws IOException {
        super.close();
    }
}

package io.gatekeeper.node.service.replication;

import io.gatekeeper.configuration.Configuration;
import io.gatekeeper.configuration.data.replication.LocalReplicationConfiguration;
import io.gatekeeper.node.service.ReplicationService;
import io.gatekeeper.node.service.replication.common.Node;

import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;

public class LocalReplicationService extends ReplicationService<LocalReplicationConfiguration> {

    public LocalReplicationService(Configuration configuration) {
        super(configuration);
    }

    @Override
    public CompletableFuture<Void> start() {
        return CompletableFuture.completedFuture(null);
    }

    @Override
    public CompletableFuture<Integer> countNodes() {
        return CompletableFuture.completedFuture(1);
    }

    @Override
    public CompletableFuture<List<Node>> fetchNodes() {
        return CompletableFuture.completedFuture(Collections.singletonList(new Node(
            "local",
            replicationConfiguration.rpcAddress,
            replicationConfiguration.rpcPort
        )));
    }

    @Override
    public void close() throws IOException {
        super.close();
    }
}

Clean up imports from local replication service


/*
 * Copyright 2015 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.gcloud.storage;

/**
 * Http method supported by Storage service.
 */
public enum HttpMethod {
  GET, HEAD, PUT, POST, DELETE
}

/*
 * Copyright 2015 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.gcloud.storage;

/**
 * Http method supported by Storage service.
 */
public enum HttpMethod {
  GET, HEAD, PUT, POST, DELETE, OPTIONS
}

Fix IllegalArgumentException when OPTIONS in cors


/*
 * JBoss, Home of Professional Open Source
 * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * 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.hibernate.validator.util;

/**
 * @author Hardy Ferentschik
 */
public final class Version {
	static {
		LoggerFactory.make().info( "Hibernate Search {}", getVersionString() );
	}

	public static String getVersionString() {
		return "[WORKING]";
	}

	public static void touch() {
	}

	// helper class should not have a public constructor
	private Version() {
	}
}

/*
 * JBoss, Home of Professional Open Source
 * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * 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.hibernate.validator.util;

/**
 * @author Hardy Ferentschik
 */
public final class Version {
	static {
		LoggerFactory.make().info( "Hibernate Validator {}", getVersionString() );
	}

	public static String getVersionString() {
		return "[WORKING]";
	}

	public static void touch() {
	}

	// helper class should not have a public constructor
	private Version() {
	}
}

Use Hibernate Validator in version logging message.


package roart.common.util;

import java.io.InputStream;

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

import roart.common.constants.Constants;

public class IOUtil {
    private static Logger log = LoggerFactory.getLogger(IOUtil.class);

    public static byte[] toByteArrayMax(InputStream is) {
        try {
            return is.readNBytes(Integer.MAX_VALUE - 8);
        } catch (Exception e) {
            log.error(Constants.EXCEPTION, e);
            return new byte[0];
        }
    }

    public static byte[] toByteArray1G(InputStream is) {
        try {
            return is.readNBytes(1024 * 1024 * 1024);
        } catch (Exception e) {
            log.error(Constants.EXCEPTION, e);
            return new byte[0];
        }
    }
}

package roart.common.util;

import java.io.InputStream;

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

import roart.common.constants.Constants;

public class IOUtil {
    private static Logger log = LoggerFactory.getLogger(IOUtil.class);

    public static byte[] toByteArrayMax(InputStream is) {
        try {
            return is.readNBytes(Integer.MAX_VALUE - 8);
        } catch (Exception e) {
            log.error(Constants.EXCEPTION, e);
            return new byte[0];
        }
    }

    public static byte[] toByteArray1G(InputStream is) {
        try {
            return is.readNBytes(1024 * 1024 * 1024);
        } catch (Exception e) {
            log.error(Constants.EXCEPTION, e);
            return new byte[0];
        }
    }

    public static byte[] toByteArray(InputStream is, int bytes) {
        try {
            return is.readNBytes(bytes);
        } catch (Exception e) {
            log.error(Constants.EXCEPTION, e);
            return new byte[0];
        }
    }
}

Index size check, for Elastic 8 upgrade (I10).


package au.gov.ga.geodesy.domain.model.event;

import java.time.Instant;
import java.util.Calendar;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

public class EventRepositoryImpl implements EventRepositoryCustom {

    @PersistenceContext(unitName = "geodesy")
    private EntityManager entityManager;

    public List<Event> getPendingEvents() {

        // TODO: try to remove oneMinuteAgo
        String queryString = "select e from Event e "
            + "where e.timeHandled is null and (e.retries is null or e.retries < " + Event.MAX_RETRIES + ") and (e.timePublished is null or e.timePublished < :oneMinuteAgo)";

        TypedQuery<Event> query = entityManager.createQuery(queryString, Event.class);
        Calendar c = Calendar.getInstance();
        c.add(Calendar.MINUTE, -1);
        query.setParameter("oneMinuteAgo", c.getTime());
        return query.getResultList();
    }
}

package au.gov.ga.geodesy.domain.model.event;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

public class EventRepositoryImpl implements EventRepositoryCustom {

    @PersistenceContext(unitName = "geodesy")
    private EntityManager entityManager;

    // TODO: move out of custom
    public List<Event> getPendingEvents() {

        String queryString = "select e from Event e "
            + "where e.timeHandled is null and (e.retries is null or e.retries < " + Event.MAX_RETRIES + ") and (e.timePublished is null)";

        TypedQuery<Event> query = entityManager.createQuery(queryString, Event.class);
        return query.getResultList();
    }
}

Remove recently published test for pending events


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

package io.crate.testing;

import org.hamcrest.Matcher;
import org.junit.jupiter.api.function.Executable;
import org.opentest4j.AssertionFailedError;

public class Asserts {

    private Asserts() {}

    public static <T extends Throwable> void assertThrows(Executable executable, Matcher<T> matcher) {
        try {
            executable.execute();
        } catch (Throwable t) {
            if (matcher.matches(t)) {
                return;
            }
            throw new AssertionFailedError(
                String.format("Unmatched %s type thrown with message '%s'",
                              t.getClass().getCanonicalName(),
                              t.getMessage()), t);
        }
        throw new AssertionFailedError("Expected exception to be thrown, but nothing was thrown.");
    }
}

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

package io.crate.testing;

import static org.hamcrest.MatcherAssert.assertThat;

import org.hamcrest.Matcher;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.function.Executable;

public class Asserts {

    private Asserts() {}

    public static void assertThrows(Executable executable, Matcher<? super Throwable> matcher) {
        try {
            executable.execute();
            Assertions.fail("Expected exception to be thrown, but nothing was thrown.");
        } catch (Throwable t) {
            assertThat(t, matcher);
        }
    }
}

Use junit assertions in assertThrows


package seedu.todo.guitests;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class ConsoleTest extends GuiTest {

    @Test
    public void testValidCommand_consoleInputCleared() {
        console.runCommand("list");
        assertEquals(console.getConsoleInputText(), "");
    }

}

package seedu.todo.guitests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

import org.junit.Test;

public class ConsoleTest extends GuiTest {

    @Test
    public void testValidCommand_consoleInputCleared() {
        console.runCommand("list");
        assertEquals(console.getConsoleInputText(), "");
    }

    @Test
    public void testInvalidCommand_consoleInputRemains() {
        console.runCommand("invalidcommand");
        assertNotEquals(console.getConsoleInputText(), "");
    }

}

Add invalid command console test


package seedu.tasklist.commons.core;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : FlexiTask\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/tasklist.xml\n" +
                "TaskList name : MyTaskList";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod() {
        Config defaultConfig = new Config();
        assertNotNull(defaultConfig);
        assertTrue(defaultConfig.equals(defaultConfig));
    }

}

package seedu.tasklist.commons.core;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : FlexiTask\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/tasklist.xml\n" +
                "TaskList name : MyTaskList";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod() {
        Config defaultConfig = new Config();
        assertNotNull(defaultConfig);
        assertTrue(defaultConfig.equals(defaultConfig));

        Config config = new Config();
        assertFalse(config.equals("MyTaskList"));
    }

    //@@author A0141993X
    @Test
    public void hashCodeMethod() {
        Config defaultConfig = new Config();
        assertEquals(defaultConfig.hashCode(), defaultConfig.hashCode());

        Config config = new Config();
        assertEquals(config.hashCode(), defaultConfig.hashCode());
    }

}

Add test to improve code coverage


package com.google.sps.data;

import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.commons.collections4.keyvalue.MultiKey;

/*
 * Class representing one row/entry in the aggregation response.  A NULL field value
 * means the field was not being aggregated by, and will be omitted from the JSON response
*/
public final class AggregationResponseEntry {

  private String assetId;
  private String location;
  private String user;
  private final int count;

  public AggregationResponseEntry(MultiKey key, int count, Set<AnnotatedField> fields) {

    String keys[] = (String[]) key.getKeys();
    int currKey = 0;

    Iterator<AnnotatedField> it = fields.iterator();
    while (it.hasNext()) {
      switch(it.next()) {
        case ASSET_ID:
          this.assetId = keys[currKey++];
          break;
        case LOCATION:
          this.location = keys[currKey++];
          break;
        case USER:
          this.user = keys[currKey++];
          break;
      }
    }

    this.count = count;
  }
}

package com.google.sps.data;

import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.commons.collections4.keyvalue.MultiKey;

/*
 * Class representing one row/entry in the aggregation response.  A NULL field value
 * means the field was not being aggregated by, and will be omitted from the JSON response
*/
public final class AggregationResponseEntry {

  private String annotatedAssetId;
  private String annotatedLocation;
  private String annotatedUser;
  private final int count;

  public AggregationResponseEntry(MultiKey key, int count, Set<AnnotatedField> fields) {

    String keys[] = (String[]) key.getKeys();
    int currKey = 0;

    Iterator<AnnotatedField> it = fields.iterator();
    while (it.hasNext()) {
      switch(it.next()) {
        case ASSET_ID:
          this.annotatedAssetId = keys[currKey++];
          break;
        case LOCATION:
          this.annotatedLocation = keys[currKey++];
          break;
        case USER:
          this.annotatedUser = keys[currKey++];
          break;
      }
    }

    this.count = count;
  }
}

Refactor output format to be same as input format, standardizing the API


/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */

package cx2x.translator.language;

import cx2x.xcodeml.exception.IllegalDirectiveException;
import org.antlr.v4.runtime.BaseErrorListener;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Recognizer;

/**
 * Listener that save the last error information from the CLAW language parser.
 *
 * @author clementval
 */
public class ClawErrorListener extends BaseErrorListener {

  private static IllegalDirectiveException ex = null;

  /**
   * Default ctor
   */
  public ClawErrorListener(){}

  @Override
  public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol,
                          int line, int charPositionInLine,
                          String msg, RecognitionException e)
  {
    ex = new IllegalDirectiveException("", msg, line, charPositionInLine);
  }

  /**
   * Get the last error information.
   * @return IllegalDirectiveException encapsulating the last error information.
   */
  IllegalDirectiveException getLastError(){
      return ex;
    }

}

/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */

package cx2x.translator.language;

import cx2x.xcodeml.exception.IllegalDirectiveException;
import org.antlr.v4.runtime.BaseErrorListener;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Recognizer;

/**
 * Listener that save the last error information from the CLAW language parser.
 *
 * @author clementval
 */
public class ClawErrorListener extends BaseErrorListener {

  private static IllegalDirectiveException ex = null;

  /**
   * Default ctor
   */
  public ClawErrorListener() {
  }

  @Override
  public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol,
                          int line, int charPositionInLine,
                          String msg, RecognitionException e)
  {
    ex = new IllegalDirectiveException("", msg, line, charPositionInLine);
  }

  /**
   * Get the last error information.
   *
   * @return IllegalDirectiveException encapsulating the last error information.
   */
  public IllegalDirectiveException getLastError() {
    return ex;
  }

}

Update modifier + code style


package org.usfirst.frc4909.STEAMWORKS.commands;

import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

import org.usfirst.frc4909.STEAMWORKS.Robot;

public class DriveCommand extends Command {
    public DriveCommand() {
        requires(Robot.drivetrain);
    }

    protected void initialize() {}

    protected void execute() {
    	Robot.drivetrain.moveTank();
    	/*
		SmartDashboard.putNumber("X dist",Robot.drivetrain.getDisplacementX());
		SmartDashboard.putNumber("Y dist",Robot.drivetrain.getDisplacementY());
		SmartDashboard.putNumber("Z dist",Robot.drivetrain.getDisplacementZ());
		*/

		SmartDashboard.putNumber("Left dist",Robot.drivetrain.getLeftEncDistance());
		SmartDashboard.putNumber("Right dist",Robot.drivetrain.getRightEncDistance());
    }

    protected boolean isFinished() {
        return false;
    }

    protected void end() {
    	Robot.drivetrain.stop();
    }

    protected void interrupted() {
    	end();
    }
}

package org.usfirst.frc4909.STEAMWORKS.commands;

import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

import org.usfirst.frc4909.STEAMWORKS.Robot;

public class DriveCommand extends Command {
    public DriveCommand() {
        requires(Robot.drivetrain);
    }

    protected void initialize() {}

    protected void execute() {
    	Robot.drivetrain.moveTank();
    }

    protected boolean isFinished() {
        return false;
    }

    protected void end() {
    	Robot.drivetrain.stop();
    }

    protected void interrupted() {
    	end();
    }
}

Remove SmartDashboard Data for Teleop. Drive


package ru.faulab.attendence;

import com.google.inject.Guice;
import com.google.inject.Injector;
import ru.faulab.attendence.module.MainModule;
import ru.faulab.attendence.ui.MainFrame;

public class Runner {

    /*
    * 1. Статистика
    * */
    public static void main(String[] args) throws Exception {

        String userHome = System.getProperty("user.home");
        System.setProperty("derby.system.home", userHome);

        Injector injector = Guice.createInjector(new MainModule());

        MainFrame mainFrame = injector.getInstance(MainFrame.class);
        mainFrame.init();
    }

}

package ru.faulab.attendence;

import com.google.inject.Guice;
import com.google.inject.Injector;
import ru.faulab.attendence.module.MainModule;
import ru.faulab.attendence.ui.MainFrame;

import javax.swing.*;

public class Runner {

    /*
    * 1. Статистика
    * */
    public static void main(String[] args) throws Exception {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);

        String userHome = System.getProperty("user.home");
        System.setProperty("derby.system.home", userHome);

        Injector injector = Guice.createInjector(new MainModule());

        MainFrame mainFrame = injector.getInstance(MainFrame.class);
        mainFrame.init();
    }

}

Set UI as best on OS


package com.robrua.orianna.type.core.common;

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

public enum GameMap {
    HOWLING_ABYSS(12), SUMMONERS_RIFT(11), SUMMONERS_RIFT_AUTUMN(2), SUMMONERS_RIFT_SUMMER(1), THE_CRYSTAL_SCAR(8), THE_PROVING_GROUNDS(3), TWISTED_TREELINE(10), TWISTED_TREELINE_ORIGINAL(
            4);

    private static final Map<Long, GameMap> IDs = new HashMap<>();
    static {
        for(final GameMap m : GameMap.values()) {
            IDs.put(m.ID, m);
        }
    }

    /**
     * Gets the map for a specified ID
     *
     * @param ID
     *            the map ID
     * @return the map type
     */
    public static GameMap forID(final long ID) {
        return IDs.get(ID);
    }

    private final Long ID;

    /**
     * @param ID
     */
    private GameMap(final long ID) {
        this.ID = ID;
    }

    /**
     * Gets the ID for this map
     *
     * @return the ID for this map
     */
    public long getID() {
        return ID;
    }
}

package com.robrua.orianna.type.core.common;

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

public enum GameMap {
    BUTCHERS_BRIDGE(14), HOWLING_ABYSS(12), SUMMONERS_RIFT(11), SUMMONERS_RIFT_AUTUMN(2), SUMMONERS_RIFT_SUMMER(1), THE_CRYSTAL_SCAR(8), THE_PROVING_GROUNDS(3), TWISTED_TREELINE(10), TWISTED_TREELINE_ORIGINAL(
            4);

    private static final Map<Long, GameMap> IDs = new HashMap<>();
    static {
        for(final GameMap m : GameMap.values()) {
            IDs.put(m.ID, m);
        }
    }

    /**
     * Gets the map for a specified ID
     *
     * @param ID
     *            the map ID
     * @return the map type
     */
    public static GameMap forID(final long ID) {
        return IDs.get(ID);
    }

    private final Long ID;

    /**
     * @param ID
     */
    private GameMap(final long ID) {
        this.ID = ID;
    }

    /**
     * Gets the ID for this map
     *
     * @return the ID for this map
     */
    public long getID() {
        return ID;
    }
}

Add bildge water event map name


package li.l1t.tingo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * Controls displaying of error messages.
 *
 * @author xxyy
 * @since 7.4.16
 */
@Controller
public class TingoErrorController implements ErrorController {
    private static final String ERROR_PATH = "/error";

    @Autowired
    private ErrorAttributes errorAttributes;

    @Override
    public String getErrorPath() {
        return ERROR_PATH;
    }

    @RequestMapping(value = ERROR_PATH)
    public String errorHtml(HttpServletRequest request, Model model) {
        Object errCodeObj = request.getAttribute("javax.servlet.error.status_code");
        int errorCode = errCodeObj == null ? 0 : (int) errCodeObj;
        model.addAttribute("errorCode", errCodeObj);
        model.addAttribute("errorType", request.getAttribute("javax.servlet.error.exception"));

        switch(errorCode) {
            case 401:
                return "error/401.html";
            case 0:
            default:
                return "error/generic.html";
        }
    }
}

package li.l1t.tingo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * Controls displaying of error messages.
 *
 * @author xxyy
 * @since 7.4.16
 */
@Controller
public class TingoErrorController implements ErrorController {
    private static final String ERROR_PATH = "/error";

    @Autowired
    private ErrorAttributes errorAttributes;

    @Override
    public String getErrorPath() {
        return ERROR_PATH;
    }

    @RequestMapping(value = ERROR_PATH)
    public String errorHtml(HttpServletRequest request, Model model) {
        Object errCodeObj = request.getAttribute("javax.servlet.error.status_code");
        int errorCode = errCodeObj == null ? 0 : (int) errCodeObj;
        model.addAttribute("errorCode", errCodeObj);
        model.addAttribute("errorType", request.getAttribute("javax.servlet.error.exception"));

        switch(errorCode) {
            case 401:
                return "error/401";
            case 0:
            default:
                return "error/generic";
        }
    }
}

Fix wrong template usage in error pages


package org.mastercoin.rpc;

import com.google.bitcoin.core.Address;

import java.math.BigDecimal;

/**
 * Balance data for a specific Mastercoin CurrencyID in a single Bitcoin address
 *
 * A Java representation of the JSON entry returned by getallbalancesforid_MP
 */
public class MPBalanceEntry {
    private Address address;
    private BigDecimal balance;
    private BigDecimal reserved;

    public MPBalanceEntry(Address address, BigDecimal balance, BigDecimal reserved) {
        this.address = address;
        this.balance = balance;
        this.reserved = reserved;
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof MPBalanceEntry)) {
            return false;
        }
        MPBalanceEntry e = (MPBalanceEntry) o;
        if (    (this.address == e.address) &&
                (this.balance == e.balance) &&
                (this.reserved == e.reserved) ) {
            return true;
        } else {
            return false;
        }
    }

    public Address getAddress() {
        return address;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public BigDecimal getReserved() {
        return reserved;
    }
}

package org.mastercoin.rpc;

import com.google.bitcoin.core.Address;

import java.math.BigDecimal;

/**
 * Balance data for a specific Mastercoin CurrencyID in a single Bitcoin address
 *
 * A Java representation of the JSON entry returned by getallbalancesforid_MP
 */
public class MPBalanceEntry {
    private Address address;
    private BigDecimal balance;
    private BigDecimal reserved;

    public MPBalanceEntry(Address address, BigDecimal balance, BigDecimal reserved) {
        this.address = address;
        this.balance = balance;
        this.reserved = reserved;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MPBalanceEntry that = (MPBalanceEntry) o;

        if (!address.equals(that.address)) return false;
        if (!balance.equals(that.balance)) return false;
        if (!reserved.equals(that.reserved)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = address.hashCode();
        result = 31 * result + balance.hashCode();
        result = 31 * result + reserved.hashCode();
        return result;
    }

    public Address getAddress() {
        return address;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public BigDecimal getReserved() {
        return reserved;
    }
}

Correct equals() implementation, add hashCode()


package hudson.plugins.cobertura.targets;

import junit.framework.TestCase;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

/**
 * Created by IntelliJ IDEA.
 * User: stephen
 * Date: 21-Oct-2007
 * Time: 18:01:31
 * To change this template use File | Settings | File Templates.
 */
public class CoveragePaintTest extends TestCase {

    public CoveragePaintTest(String string) {
        super(string);
    }

    public void testSerializable() throws Exception {
        CoveragePaint instance = new CoveragePaint(CoverageElement.JAVA_FILE);
        instance.paint(5, 7, 4, 5);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(instance);
        oos.flush();
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bis);
        CoveragePaint copy = (CoveragePaint) ois.readObject();
        assertEquals(instance.getLineCoverage(), copy.getLineCoverage());
        assertEquals(instance.getConditionalCoverage(), copy.getConditionalCoverage());
    }
}

package hudson.plugins.cobertura.targets;

import junit.framework.TestCase;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

/**
 * Created by IntelliJ IDEA.
 * User: stephen
 * Date: 21-Oct-2007
 * Time: 18:01:31
 * To change this template use File | Settings | File Templates.
 */
public class CoveragePaintTest extends TestCase {

    public CoveragePaintTest(String string) {
        super(string);
    }

    public void testTotalLines() {
        CoveragePaint instance = new CoveragePaint(CoverageElement.JAVA_FILE);
        assertEquals(0, instance.getTotalLines());
        instance.setTotalLines(451);
        assertEquals(451, instance.getTotalLines());
        instance.setTotalLines(179);
        assertEquals(179, instance.getTotalLines());
    }

    public void testSerializable() throws Exception {
        CoveragePaint instance = new CoveragePaint(CoverageElement.JAVA_FILE);
        instance.paint(5, 7, 4, 5);
        instance.setTotalLines(314);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(instance);
        oos.flush();
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bis);
        CoveragePaint copy = (CoveragePaint) ois.readObject();
        assertEquals(instance.getLineCoverage(), copy.getLineCoverage());
        assertEquals(instance.getConditionalCoverage(), copy.getConditionalCoverage());
        assertEquals(314, copy.getTotalLines());
    }
}

Add a test and some asserts to coverage paint total lines


package alien4cloud.it;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features = {
"classpath:alien/rest/cloud/cloud_avz.feature"
}, format = { "pretty", "html:target/cucumber/cloud", "json:target/cucumber/cucumber-cloud.json" })
public class RunCloudIT {
}

package alien4cloud.it;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features = {
"classpath:alien/rest/cloud"
}, format = { "pretty", "html:target/cucumber/cloud", "json:target/cucumber/cucumber-cloud.json" })
public class RunCloudIT {
}

Validate HA groups on a topology REST It tests


package com.elmakers.mine.bukkit.wand;

import org.bukkit.configuration.ConfigurationSection;

import com.elmakers.mine.bukkit.api.magic.Mage;

public class WandUpgradeSlot {
    private final String slotType;
    private boolean hidden = false;
    private boolean swappable = false;
    private Wand slotted;

    public WandUpgradeSlot(String slotType) {
        this.slotType = slotType;
    }

    public WandUpgradeSlot(String configKey, ConfigurationSection config) {
        slotType = config.getString("type", configKey);
        hidden = config.getBoolean("hidden", false);
        swappable = config.getBoolean("swappable", false);
    }

    public Wand getSlotted() {
        return slotted;
    }

    public boolean addSlotted(Wand upgrade, Mage mage) {
        String slotType = upgrade.getSlot();
        if (slotType == null || slotType.isEmpty()) {
            return false;
        }
        if (!slotType.equals(slotType)) {
            return false;
        }
        if (slotted == null) {
            slotted = upgrade;
            return true;
        }
        if (!swappable || mage == null) {
            return false;
        }
        mage.giveItem(slotted.getItem());
        slotted = upgrade;
        return true;
    }

    public boolean isHidden() {
        return hidden;
    }

    public String getType() {
        return slotType;
    }
}

package com.elmakers.mine.bukkit.wand;

import org.bukkit.configuration.ConfigurationSection;

import com.elmakers.mine.bukkit.api.magic.Mage;

public class WandUpgradeSlot {
    private final String slotType;
    private boolean hidden = false;
    private boolean swappable = false;
    private boolean replaceable = false;
    private Wand slotted;

    public WandUpgradeSlot(String slotType) {
        this.slotType = slotType;
    }

    public WandUpgradeSlot(String configKey, ConfigurationSection config) {
        slotType = config.getString("type", configKey);
        hidden = config.getBoolean("hidden", false);
        swappable = config.getBoolean("swappable", false);
        replaceable = config.getBoolean("replaceable", false);
    }

    public Wand getSlotted() {
        return slotted;
    }

    public boolean addSlotted(Wand upgrade, Mage mage) {
        String slotType = upgrade.getSlot();
        if (slotType == null || slotType.isEmpty()) {
            return false;
        }
        if (!slotType.equals(slotType)) {
            return false;
        }
        if (slotted == null || replaceable) {
            slotted = upgrade;
            return true;
        }
        if (!swappable || mage == null) {
            return false;
        }
        mage.giveItem(slotted.getItem());
        slotted = upgrade;
        return true;
    }

    public boolean isHidden() {
        return hidden;
    }

    public String getType() {
        return slotType;
    }
}

Add replaceable slot tag, for upgrades that can be replaced without returning the existing upgrade


package edu.pdx.cs410J.chances;

import edu.pdx.cs410J.AbstractAppointmentBook;
import edu.pdx.cs410J.AppointmentBookParser;
import edu.pdx.cs410J.ParserException;

/**
 * @author chancesnow
 */
public class TextParser implements AppointmentBookParser
{
    @Override
    public AbstractAppointmentBook parse() throws ParserException
    {
        return null;
    }
}

package edu.pdx.cs410J.chances;

import edu.pdx.cs410J.AbstractAppointmentBook;
import edu.pdx.cs410J.AppointmentBookParser;
import edu.pdx.cs410J.ParserException;

import java.io.File;

/**
 * @author chancesnow
 */
public class TextParser implements AppointmentBookParser
{
    private File file;

    public TextParser(String filePath)
    {
        file = new File(filePath);

        if (!file.exists() || !file.isDirectory()) {
            file = null;
        }
    }

    @Override
    public AbstractAppointmentBook parse() throws ParserException
    {
        return null;
    }
}

Add constructor accepting file path


package org.cryptonit.cloud.interfaces;

import java.security.PrivateKey;
import java.security.PublicKey;

public interface KeyStore {
    public enum KeyParameters {
        RSA_2048("RSA", null, 2048),
        RSA_4096("RSA", null, 4096),
        EC_P256("EC", "P-256", 256),
        EC_P384("EC", "P-384", 384),
        EC_P521("EC", "P-521", 521);

        final private String algorithm;
        final private String parameter;
        final private int size;

        KeyParameters(String algorithm, String parameter, int size) {
            this.algorithm = algorithm;
            this.parameter = parameter;
            this.size = size;
        }

        public String getAlgorithm() {
            return algorithm;
        }

        public String getParameter() {
            return parameter;
        }

        public int getSize() {
            return size;
        }
    };

    PrivateKey getPrivateKey(String domain, String keyIdentifier);

    PublicKey getPublicKey(String domain, String keyIdentifier);
}

package org.cryptonit.cloud.interfaces;

import java.security.PrivateKey;
import java.security.PublicKey;

public interface KeyStore {
    public enum KeyParameters {
        RSA_2048("RSA", null, 2048),
        RSA_4096("RSA", null, 4096),
        EC_P256("EC", "P-256", 256),
        EC_P384("EC", "P-384", 384),
        EC_P521("EC", "P-521", 521);

        final private String algorithm;
        final private String parameter;
        final private int size;

        KeyParameters(String algorithm, String parameter, int size) {
            this.algorithm = algorithm;
            this.parameter = parameter;
            this.size = size;
        }

        public String getAlgorithm() {
            return algorithm;
        }

        public String getParameter() {
            return parameter;
        }

        public int getSize() {
            return size;
        }
    };

    String generateKey(String domain, KeyParameters params);

    PrivateKey getPrivateKey(String domain, String keyIdentifier);

    PublicKey getPublicKey(String domain, String keyIdentifier);
}

Add key generation function to interface


package org.radargun.config;

import java.util.List;

import static org.radargun.config.VmArgUtils.ensureArg;
import static org.radargun.config.VmArgUtils.replace;

public class FlightRecorder implements VmArg {
   @Property(doc = "Start flight recording for the benchmark.", optional = false)
   private boolean enabled = false;

   @Property(doc = "File for the recording.")
   private String filename;

   @Property(doc = "Settings file with recording configuration.")
   private String settings;

   @Override
   public void setArgs(List<String> args) {
      if (!enabled)
         return;
      StringBuilder recordingParams = new StringBuilder("=compress=false,delay=10s,duration=24h");
      if (filename != null)
         recordingParams.append(",filename=").append(filename);
      if (settings != null)
         recordingParams.append(",settings=").append(settings);
      ensureArg(args, "-XX:+UnlockCommercialFeatures");
      ensureArg(args, "-XX:+FlightRecorder");
      replace(args, "-XX:StartFlightRecording", recordingParams.toString());
   }

   public boolean isEnabled() {
      return enabled;
   }

   public String getFilename() {
      return filename;
   }

   public String getSettings() {
      return settings;
   }
}

package org.radargun.config;

import java.util.List;

import static org.radargun.config.VmArgUtils.ensureArg;
import static org.radargun.config.VmArgUtils.replace;

public class FlightRecorder implements VmArg {
   @Property(doc = "Start flight recording for the benchmark.", optional = false)
   private boolean enabled = false;

   @Property(doc = "File for the recording.")
   private String filename;

   @Property(doc = "Settings file with recording configuration.")
   private String settings;

   @Override
   public void setArgs(List<String> args) {
      if (!enabled)
         return;
      StringBuilder recordingParams = new StringBuilder("=delay=10s,duration=24h");
      if (filename != null)
         recordingParams.append(",filename=").append(filename);
      if (settings != null)
         recordingParams.append(",settings=").append(settings);
      ensureArg(args, "-XX:+UnlockCommercialFeatures");
      ensureArg(args, "-XX:+FlightRecorder");
      replace(args, "-XX:StartFlightRecording", recordingParams.toString());
   }

   public boolean isEnabled() {
      return enabled;
   }

   public String getFilename() {
      return filename;
   }

   public String getSettings() {
      return settings;
   }

}

Fix Unknown argument 'compress' in diagnostic for JDK11


package com.voxelwind.nbt.util;

import com.voxelwind.nbt.tags.CompoundTag;
import com.voxelwind.nbt.tags.Tag;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

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

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CompoundTagBuilder {
    private final Map<String, Tag<?>> tagMap = new HashMap<>();

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

    public static CompoundTagBuilder from(CompoundTag tag) {
        CompoundTagBuilder builder = new CompoundTagBuilder();
        builder.tagMap.putAll(tag.getValue());
        return builder;
    }

    public CompoundTagBuilder tag(Tag<?> tag) {
        tagMap.put(tag.getName(), tag);
        return this;
    }

    public CompoundTag buildRootTag() {
        return new CompoundTag("", tagMap);
    }

    public CompoundTag build(String tagName) {
        return new CompoundTag(tagName, tagMap);
    }
}

package com.voxelwind.nbt.util;

import com.voxelwind.nbt.tags.*;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

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

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CompoundTagBuilder {
    private final Map<String, Tag<?>> tagMap = new HashMap<>();

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

    public static CompoundTagBuilder from(CompoundTag tag) {
        CompoundTagBuilder builder = new CompoundTagBuilder();
        builder.tagMap.putAll(tag.getValue());
        return builder;
    }

    public CompoundTagBuilder tag(Tag<?> tag) {
        tagMap.put(tag.getName(), tag);
        return this;
    }

    public CompoundTagBuilder tag(String name, byte value) {
        return tag(new ByteTag(name, value));
    }

    public CompoundTagBuilder tag(String name, byte [] value) {
        return tag(new ByteArrayTag(name, value));
    }

    public CompoundTagBuilder tag(String name, double value) {
        return tag(new DoubleTag(name, value));
    }

    public CompoundTagBuilder tag(String name, float value) {
        return tag(new FloatTag(name, value));
    }

    public CompoundTagBuilder tag(String name, int[] value) {
        return tag(new IntArrayTag(name, value));
    }

    public CompoundTagBuilder tag(String name, int value) {
        return tag(new IntTag(name, value));
    }

    public CompoundTagBuilder tag(String name, long value) {
        return tag(new LongTag(name, value));
    }

    public CompoundTagBuilder tag(String name, short value) {
        return tag(new ShortTag(name, value));
    }

    public CompoundTagBuilder tag(String name, String value) {
        return tag(new StringTag(name, value));
    }

    public CompoundTag buildRootTag() {
        return new CompoundTag("", tagMap);
    }

    public CompoundTag build(String tagName) {
        return new CompoundTag(tagName, tagMap);
    }
}

Add type-related tag methods to nbt-builder


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

/**
 *
 * Parent data access manager interface.
 *
 * @author Gautier Koscielny (EMBL-EBI) <koscieln@ebi.ac.uk>
 * @since February 2012
 */

import java.sql.SQLException;
import java.util.Collection;

import org.hibernate.Session;

/**
 * Please add a description about HibernateDAO.java
 */

public interface HibernateDAO {

	public Session getSession();

	@SuppressWarnings("rawtypes")
	public Collection executeNativeQuery(String sql) throws SQLException;

}

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

/**
 *
 * Parent data access manager interface.
 *
 * @author Gautier Koscielny (EMBL-EBI) <koscieln@ebi.ac.uk>
 * @since February 2012
 */

import java.sql.SQLException;
import java.util.Collection;

import org.hibernate.Session;

/**
 * Please add a description about HibernateDAO.java
 */

public interface HibernateDAO {

	public Session getSession();

	public void flushAndClearSession();

	@SuppressWarnings("rawtypes")
	public Collection executeNativeQuery(String sql) throws SQLException;

}

Add a flush and clear method for batch upload.


package uk.me.mjt.ch.status;

public enum MonitoredProcess {
    LOAD_NODES, LOAD_WAYS, INDEX_MAP_DATA, VALIDATE_DATA
}

package uk.me.mjt.ch.status;

public enum MonitoredProcess {
    LOAD_NODES, LOAD_WAYS, INDEX_MAP_DATA, VALIDATE_DATA, EXTRA_PROCESS_1, EXTRA_PROCESS_2
}

Add some extra process names in case someone using the library needs to perform/monitor extra loading processes.


package com.popalay.cardme.ui.base;

import android.app.Activity;
import android.support.annotation.NonNull;

import com.arellomobile.mvp.MvpAppCompatFragment;

public abstract class BaseFragment extends MvpAppCompatFragment implements BaseView {

    @NonNull
    public BaseActivity getBaseActivity() {
        final Activity activity = getActivity();
        if (activity != null && activity instanceof BaseActivity) {
            return (BaseActivity) activity;
        }
        throw new RuntimeException("BaseActivity is null");
    }

    protected void showLoadingDialog() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showLoadingDialog();
    }

    protected void hideLoadingDialog() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.hideLoadingDialog();
    }

    @Override
    public void showError(String error) {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showError(error);
    }

    @Override
    public void showMessage(String message) {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showMessage(message);
    }

    @Override
    public void hideError() {

    }

    @Override
    public void hideMessage() {

    }

    @Override
    public void showProgress() {
        showLoadingDialog();
    }

    @Override
    public void hideProgress() {
        hideLoadingDialog();
    }

    @Override
    public void hideKeyboard() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.hideKeyboard();
    }

    @Override
    public void close() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.close();
    }
}

package com.popalay.cardme.ui.base;

import android.app.Activity;
import android.support.annotation.NonNull;

import com.arellomobile.mvp.MvpAppCompatFragment;

public abstract class BaseFragment extends MvpAppCompatFragment implements BaseView {

    @NonNull
    public BaseActivity getBaseActivity() {
        final Activity activity = getActivity();
        if (activity != null && activity instanceof BaseActivity) {
            return (BaseActivity) activity;
        }
        throw new RuntimeException("BaseActivity is null");
    }

    protected void showLoadingDialog() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showLoadingDialog();
    }

    protected void hideLoadingDialog() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.hideLoadingDialog();
    }

    @Override
    public void showError(String error) {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showError(error);
    }

    @Override
    public void showMessage(String message) {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showMessage(message);
    }

    @Override
    public void hideError() {

    }

    @Override
    public void hideMessage() {

    }

    @Override
    public void showProgress() {
        showLoadingDialog();
    }

    @Override
    public void hideProgress() {
        hideLoadingDialog();
    }

    @Override
    public void hideKeyboard() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.hideKeyboard();
    }

    @Override
    public void close() {
        throw new UnsupportedOperationException("You can not close the fragment");
    }
}

Throw exception when call close() on fragment


import org.junit.Rule;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testcontainers.containers.BrowserWebDriverContainer;

import java.io.File;

import static org.rnorth.visibleassertions.VisibleAssertions.assertTrue;
import static org.testcontainers.containers.BrowserWebDriverContainer.VncRecordingMode.RECORD_ALL;

/**
 * Simple example of plain Selenium usage.
 */
public class SeleniumContainerTest {

    @Rule
    public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer()
                                                    .withDesiredCapabilities(DesiredCapabilities.chrome())
                                                    .withRecordingMode(RECORD_ALL, new File("target"));

    @Test
    public void simplePlainSeleniumTest() {
        RemoteWebDriver driver = chrome.getWebDriver();

        driver.get("https://wikipedia.org");
        WebElement searchInput = driver.findElementByName("search");

        searchInput.sendKeys("Rick Astley");
        searchInput.submit();

        WebElement otherPage = driver.findElementByPartialLinkText("Rickrolling");
        otherPage.click();

        boolean expectedTextFound = driver.findElementsByCssSelector("p")
                .stream()
                .anyMatch(element -> element.getText().contains("meme"));

        assertTrue("The word 'meme' is found on a page about rickrolling", expectedTextFound);
    }
}

import org.junit.Rule;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testcontainers.containers.BrowserWebDriverContainer;

import java.io.File;
import java.util.List;

import static org.rnorth.visibleassertions.VisibleAssertions.assertTrue;
import static org.testcontainers.containers.BrowserWebDriverContainer.VncRecordingMode.RECORD_ALL;

/**
 * Simple example of plain Selenium usage.
 */
public class SeleniumContainerTest {

    @Rule
    public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer()
                                                    .withDesiredCapabilities(DesiredCapabilities.chrome())
                                                    .withRecordingMode(RECORD_ALL, new File("target"));

    @Test
    public void simplePlainSeleniumTest() {
        RemoteWebDriver driver = chrome.getWebDriver();

        driver.get("https://wikipedia.org");
        List<WebElement> searchInput = driver.findElementsByName("search");

        assertTrue("The search input box is found", searchInput != null && searchInput.size() > 0);
    }
}

Simplify selenium example Previous test relied on the content/layout of wikipedia remaining the same, which led to unexpected failures


package io.burt.jmespath.ast;

public class FlattenListNode extends JmesPathNode {
  public FlattenListNode() {
    super();
  }

  public FlattenListNode(JmesPathNode source) {
    super(source);
  }

  @Override
  protected boolean internalEquals(Object o) {
    return true;
  }

  @Override
  protected int internalHashCode() {
    return 19;
  }
}

package io.burt.jmespath.ast;

public class FlattenListNode extends JmesPathNode {
  public FlattenListNode(JmesPathNode source) {
    super(source);
  }

  @Override
  protected boolean internalEquals(Object o) {
    return true;
  }

  @Override
  protected int internalHashCode() {
    return 19;
  }
}

Remove the no-args constructor from FlattenNode


package net.dean.jraw.models;

import net.dean.jraw.models.meta.JsonProperty;
import net.dean.jraw.models.meta.Model;
import com.fasterxml.jackson.databind.JsonNode;

/**
 * Represents an account with additional information visible only to the logged-in user.
 */
@Model(kind = Model.Kind.ACCOUNT)
public final class LoggedInAccount extends Account {
    /** Instantiates a new LoggedInAccount */
    public LoggedInAccount(JsonNode data) {
        super(data);
    }

    /** Checks if the user has unread mail. */
    @JsonProperty
    public Boolean hasMail() {
        return data("has_mail", Boolean.class);
    }

    /** Checks if the user has moderator mail */
    @JsonProperty(nullable = true)
    public Boolean hasModMail() {
        return data("has_mod_mail", Boolean.class);
    }

    /** Checks if the user has a verified email */
    @JsonProperty
    public Boolean hasVerifiedEmail() {
        return data("has_verified_email", Boolean.class);
    }

    /** Gets the amount of non-moderator mail the user has. */
    @JsonProperty
    public Integer getInboxCount() {
        return data("inbox_count", Integer.class);
    }

    /** Gets the amount of gold creddits (one month worth of reddit gold) the user has. */
    @JsonProperty
    public Integer getCreddits() {
        return data("gold_creddits", Integer.class);
    }
}

package net.dean.jraw.models;

import com.fasterxml.jackson.databind.JsonNode;

import net.dean.jraw.models.meta.JsonProperty;
import net.dean.jraw.models.meta.Model;

import java.text.NumberFormat;

/**
 * Represents an account with additional information visible only to the logged-in user.
 */
@Model(kind = Model.Kind.ACCOUNT)
public final class LoggedInAccount extends Account {
    /** Instantiates a new LoggedInAccount */
    public LoggedInAccount(JsonNode data) {
        super(data);
    }

    /** Checks if the user has unread mail. */
    @JsonProperty
    public Boolean hasMail() {
        return data("has_mail", Boolean.class);
    }

    /** Checks if the user has moderator mail */
    @JsonProperty(nullable = true)
    public Boolean hasModMail() {
        return data("has_mod_mail", Boolean.class);
    }

    /** Checks if the user has a verified email */
    @JsonProperty
    public Boolean hasVerifiedEmail() {
        return data("has_verified_email", Boolean.class);
    }

    /** Gets the amount of non-moderator mail the user has. */
    @JsonProperty
    public Integer getInboxCount() {
        return data("inbox_count", Integer.class);
    }

    /** Gets the localized amount of non-moderator mail the user has. */
    public String getLocalizedInboxCount() {
        try {
            return NumberFormat.getInstance().format(getInboxCount());
        } catch (final IllegalArgumentException ex) {
            return null;
        }
    }

    /** Gets the amount of gold creddits (one month worth of reddit gold) the user has. */
    @JsonProperty
    public Integer getCreddits() {
        return data("gold_creddits", Integer.class);
    }
}

Add ability to get localized inbox count


package org.jutils.jprocesses.util;

import org.junit.Test;

import java.text.ParseException;
import java.util.Locale;

import static org.junit.Assert.*;

@SuppressWarnings("Since15")
public class ProcessesUtilsTest {
  @Test
  public void getCustomDateFormat() throws Exception {
      assertEquals("10/23/2016 08:30:00", ProcessesUtils.parseUnixLongTimeToFullDate("23 okt 08:30:00 2016"));
      try {
        ProcessesUtils.parseUnixLongTimeToFullDate("23 okt 2016 08:30:00");
        fail();
      } catch (ParseException e) {}
      ProcessesUtils.setCustomDateFormat("dd MMM yyyy HH:mm:ss");
      ProcessesUtils.setCustomLocale(Locale.forLanguageTag("no"));
      assertEquals("10/23/2016 08:30:00", ProcessesUtils.parseUnixLongTimeToFullDate("23 okt 2016 08:30:00"));
  }

}

package org.jutils.jprocesses.util;

import org.junit.Test;

import java.text.ParseException;
import java.util.Locale;

import static org.junit.Assert.*;

@SuppressWarnings("Since15")
public class ProcessesUtilsTest {
  @Test
  public void getCustomDateFormat() throws Exception {
      assertEquals("10/23/2016 08:30:00", ProcessesUtils.parseUnixLongTimeToFullDate("oct 23 08:30:00 2016"));
      try {
        ProcessesUtils.parseUnixLongTimeToFullDate("23 okt 2016 08:30:00");
        fail();
      } catch (ParseException e) {}
      ProcessesUtils.setCustomDateFormat("dd MMM yyyy HH:mm:ss");
      ProcessesUtils.setCustomLocale(Locale.forLanguageTag("no"));
      assertEquals("10/23/2016 08:30:00", ProcessesUtils.parseUnixLongTimeToFullDate("23 okt 2016 08:30:00"));
  }

}

Make the first date test so that it passes with the default hardcoded ENGLISH locale


/**
 * FIRST Team 1699
 *
 * Abstract Command Class
 *
 * @author squirlemaster42, FIRST Team 1699
 *
 * @version v0.2-norobot
 */
package org.usfirst.frc.team1699.utils.command;

public abstract class Command {

	private String name;
	private int id;

	// id is used for commands run in auto. It should be set to an integer
	// value that corresponds to
	// the value used when wanting to call the command from the autonomous file.
	public Command(String name, int id) {
		this.name = name;
		this.id = id;

		//Add code to add name and id to respective lists
	}

	public abstract void init();
	public abstract void run();
	public abstract void outputToDashBoard(); //Output all data to dash board
	public abstract void zeroAllSensors(); // zeroAllSensors may need to be looked at and changed
	//public abstract boolean isFinished(); Not used at this time may change in the future.

	public String getName() {
		return name;
	}

	public int getId() {
		return id;
	}

	@Override
	public String toString() {
		return "Command [name=" + name + ", id=" + id + "]";
	}
}

/**
 * FIRST Team 1699
 *
 * Abstract Command Class
 *
 * @author squirlemaster42, FIRST Team 1699
 *
 * @version v0.2-norobot
 */
package org.usfirst.frc.team1699.utils.command;

public abstract class Command {

	private String name;
	private int id;

	// id is used for commands run in auto. It should be set to an integer
	// value that corresponds to
	// the value used when wanting to call the command from the autonomous file.
	public Command(String name, int id) {
		this.name = name;
		this.id = id;

		// Add code to add name and id to respective lists
	}

	public abstract void init();

	public abstract void run();

	public abstract void outputToDashBoard(); // Output all data to dash board

	public abstract void zeroAllSensors(); // zeroAllSensors may need to be
											// looked at and changed
	// public abstract boolean isFinished(); Not used at this time may change in
	// the future.

	public String getName() {
		return name;
	}

	public int getId() {
		return id;
	}

	@Override
	public String toString() {
		return "Command [name=" + name + ", id=" + id + "]";
	}
}

Make sure everything is correct version


package simizer.laws;

import org.junit.*;

/**
 * Basic tests that should be run on all Law subclasses.
 */
@Ignore
public class LawTest {
  protected Law law;

  /**
   * Outputs values from the law to evaluate their distribution.
   */
  @Test
  public void testOutput() {
    for (int i = 0; i < 10000; i++) {
      System.out.println(law.nextValue());
    }
  }
}

package simizer.laws;

import java.lang.reflect.Field;
import org.junit.*;

/**
 * Basic tests that should be run on all Law subclasses.
 */
@Ignore
public class LawTest {
  protected Law law;

  /**
   * Outputs values from the law to evaluate their distribution.
   */
  @Test
  public void testOutput() {
    for (int i = 0; i < 10000; i++) {
      System.out.println(law.nextValue());
    }
  }

  /**
   * Tests whether or not the theoretically maximum value can be achieved.
   *
   * @throws Exception if there is a problem with the reflection
   */
  @Test
  public void testMaximum() throws Exception {
    Field upperBound = Law.class.getDeclaredField("upperBound");
    upperBound.setAccessible(true);
    int bound = (Integer) upperBound.get(law);

    long target = System.currentTimeMillis() + 4*1000;

    boolean found = false;
    while (System.currentTimeMillis() < target) {
      int value = law.nextValue();
      Assert.assertTrue("generated a value that was too large", value < bound);
      Assert.assertTrue("generated a value that was too small", value >= 0);

      if (value == (bound - 1)) {
        found = true;
        break;
      }
    }
    Assert.assertTrue("could not generate the maximum value", found);
  }

  /**
   * Tests whether or not the theoretically minimum value can be achieved.
   */
  @Test
  public void testMinimum() {
    long target = System.currentTimeMillis() + 4*1000;

    boolean found = false;
    while (System.currentTimeMillis() < target) {
      int value = law.nextValue();
      Assert.assertTrue("generated a value that was too small", value >= 0);

      if (value == 0) {
        found = true;
        break;
      }
    }
    Assert.assertTrue("could not generate the minimum value", found);
  }
}

Add unit tests to check the min/max range values.


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

package org.mutabilitydetector.locations;

import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;

@Immutable
public abstract class ClassName {
    private final String asString;

    public ClassName(@Nonnull String className) {
        this.asString = className;
    }

    public String asString() {
        return asString;
    }

    @Override
    public String toString() {
        return asString();
    }

    @Override
    public int hashCode() {
        return asString.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) { return true; }
        if (obj == null) { return false; }
        if (getClass() != obj.getClass()) { return false; }
        ClassName other = (ClassName) obj;
        return asString.equals(other.asString);
    }

}

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

package org.mutabilitydetector.locations;

import javax.annotation.Nonnull;

public abstract class ClassName {
    private final String asString;

    public ClassName(@Nonnull String className) {
        this.asString = className;
    }

    public String asString() {
        return asString;
    }

    @Override
    public String toString() {
        return asString();
    }

    @Override
    public int hashCode() {
        return asString.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) { return true; }
        if (obj == null) { return false; }
        if (getClass() != obj.getClass()) { return false; }
        ClassName other = (ClassName) obj;
        return asString.equals(other.asString);
    }

}

Remove @Immutable annotation from abstract class.


package com.commit451.gitlab.model.api;

import com.google.gson.annotations.SerializedName;

import org.parceler.Parcel;

import android.net.Uri;

@Parcel
public class Group {
    @SerializedName("id")
    long mId;
    @SerializedName("name")
    String mName;
    @SerializedName("path")
    String mPath;
    @SerializedName("description")
    String mDescription;
    @SerializedName("avatar_url")
    Uri mAvatarUrl;
    @SerializedName("web_url")
    Uri mWebUrl;

    public Group() {}

    public long getId() {
        return mId;
    }

    public String getName() {
        return mName;
    }

    public String getPath() {
        return mPath;
    }

    public String getDescription() {
        return mDescription;
    }

    public Uri getAvatarUrl() {
        return mAvatarUrl;
    }

    public Uri getWebUrl() {
        return mWebUrl;
    }

    public Uri getFeedUrl() {
        return Uri.parse(mWebUrl.toString() + ".atom");
    }

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

        Group group = (Group) o;
        return mId == group.mId;
    }

    @Override
    public int hashCode() {
        return (int) (mId ^ (mId >>> 32));
    }
}

package com.commit451.gitlab.model.api;

import com.google.gson.annotations.SerializedName;

import org.parceler.Parcel;

import android.net.Uri;

@Parcel
public class Group {
    @SerializedName("id")
    long mId;
    @SerializedName("name")
    String mName;
    @SerializedName("path")
    String mPath;
    @SerializedName("description")
    String mDescription;
    @SerializedName("avatar_url")
    Uri mAvatarUrl;
    @SerializedName("web_url")
    Uri mWebUrl;

    public Group() {}

    public long getId() {
        return mId;
    }

    public String getName() {
        return mName;
    }

    public String getPath() {
        return mPath;
    }

    public String getDescription() {
        return mDescription;
    }

    public Uri getAvatarUrl() {
        return mAvatarUrl;
    }

    public Uri getWebUrl() {
        return mWebUrl;
    }

    public Uri getFeedUrl() {
        if (mWebUrl == null) {
            return null;
        }

        return Uri.parse(mWebUrl.toString() + ".atom");
    }

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

        Group group = (Group) o;
        return mId == group.mId;
    }

    @Override
    public int hashCode() {
        return (int) (mId ^ (mId >>> 32));
    }
}

Check webUrl of groups for null to prevent NullPointerException


package org.wikipedia.page;

import androidx.annotation.NonNull;

import org.wikipedia.history.HistoryEntry;
import org.wikipedia.model.BaseModel;

public class PageBackStackItem extends BaseModel {
    @NonNull private PageTitle title;
    @NonNull private HistoryEntry historyEntry;

    private int scrollY;

    public PageBackStackItem(@NonNull PageTitle title, @NonNull HistoryEntry historyEntry) {
        this.title = title;
        this.historyEntry = historyEntry;
    }

    @NonNull
    public PageTitle getTitle() {
        return title;
    }

    public void setTitle(@NonNull PageTitle title) {
        this.title = title;
    }

    @NonNull
    public HistoryEntry getHistoryEntry() {
        return historyEntry;
    }

    public int getScrollY() {
        return scrollY;
    }

    public void setScrollY(int scrollY) {
        this.scrollY = scrollY;
    }
}

package org.wikipedia.page;

import androidx.annotation.NonNull;

import org.wikipedia.history.HistoryEntry;
import org.wikipedia.model.BaseModel;

public class PageBackStackItem extends BaseModel {
    @NonNull private PageTitle title;
    @NonNull private HistoryEntry historyEntry;

    private int scrollY;

    public PageBackStackItem(@NonNull PageTitle title, @NonNull HistoryEntry historyEntry) {

        // TODO: remove this crash probe upon fixing
        if (title == null || historyEntry == null) {
            throw new IllegalArgumentException("Nonnull parameter is in fact null.");
        }

        this.title = title;
        this.historyEntry = historyEntry;
    }

    @NonNull
    public PageTitle getTitle() {
        return title;
    }

    public void setTitle(@NonNull PageTitle title) {
        this.title = title;
    }

    @NonNull
    public HistoryEntry getHistoryEntry() {
        return historyEntry;
    }

    public int getScrollY() {
        return scrollY;
    }

    public void setScrollY(int scrollY) {
        this.scrollY = scrollY;
    }
}

Set up probe to investigate possible crash(es) with null PageTitle.


/**
 * This package provides an object model and parser for Java class files.
 */
@Version("1." + ClassFile.MAJOR_VERSION + ".0")
package aQute.bnd.classfile;

import org.osgi.annotation.versioning.Version;

/**
 * This package provides an object model and parser for Java class files.
 */
@Version("1." + ClassFile.MAJOR_VERSION + "0.0")
package aQute.bnd.classfile;

import org.osgi.annotation.versioning.Version;

Add space in package version number for enhancements


package net.ssehub.kernel_haven.config;

import static net.ssehub.kernel_haven.config.Setting.Type.BOOLEAN;

import java.util.Properties;

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

import net.ssehub.kernel_haven.SetUpException;

/**
 * Tests the {@link Configuration}.
 * @author El-Sharkawy
 *
 */
public class ConfigurationTest {

    /**
     * Tests that Boolean config values are handled correctly by the {@link Configuration}.
     * @throws SetUpException Must not occur, is not tested by this test.
     */
    @Test
    public void testBooleanValues() throws SetUpException {
        Setting<Boolean> falseValue = new Setting<>("value.false", BOOLEAN, false, "false", "");
        Setting<Boolean> trueValue = new Setting<>("value.true", BOOLEAN, false, "true", "");

        Configuration config = new Configuration(new Properties());
        config.registerSetting(falseValue);
        config.registerSetting(trueValue);

        boolean value = config.getValue(falseValue);
        Assert.assertFalse("False value is treated as true", value);

        value = config.getValue(trueValue);
        Assert.assertTrue("True value is treated as false", value);
    }
}

package net.ssehub.kernel_haven.config;

import static net.ssehub.kernel_haven.config.Setting.Type.BOOLEAN;

import java.util.Properties;

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

import net.ssehub.kernel_haven.SetUpException;

/**
 * Tests the {@link Configuration}.
 * @author El-Sharkawy
 *
 */
public class ConfigurationTest {

    /**
     * Tests that Boolean config values are handled correctly by the {@link Configuration}.
     * @throws SetUpException Must not occur, is not tested by this test.
     */
    @Test
    public void testBooleanValues() throws SetUpException {
        Setting<Boolean> falseValue = new Setting<>("value.false", BOOLEAN, false, "false", "");
        Setting<Boolean> trueValue = new Setting<>("value.true", BOOLEAN, false, "true", "");
        Setting<Boolean> overwriteableValue = new Setting<>("value.x", BOOLEAN, false, "true", "");

        Properties prop = new Properties();
        prop.setProperty(overwriteableValue.getKey(), "false");
        Configuration config = new Configuration(prop);
        config.registerSetting(falseValue);
        config.registerSetting(trueValue);
        config.registerSetting(overwriteableValue);

        boolean value = config.getValue(falseValue);
        Assert.assertFalse("False value is treated as true", value);

        value = config.getValue(trueValue);
        Assert.assertTrue("True value is treated as false", value);

        value = config.getValue(overwriteableValue);
        Assert.assertFalse("False value is treated as true", value);
    }
}

Test case for the configuration