/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2017, Red Hat, Inc., and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.wildfly.clustering.group;

/**
 * Listener for {@link Group} membership changes.
 * @author Paul Ferraro
 */
public interface GroupListener {
    /**
     * Indicates that the membership of the group has changed.
     *
     * @param previousMembership previous group membership
     * @param membership new group membership
     * @param merged indicates whether the membership change is the result of a merge view
     */
    void membershipChanged(Membership previousMembership, Membership membersip, boolean merged);
}

/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2017, Red Hat, Inc., and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.wildfly.clustering.group;

/**
 * Listener for {@link Group} membership changes.
 * @author Paul Ferraro
 */
public interface GroupListener {
    /**
     * Indicates that the membership of the group has changed.
     *
     * @param previousMembership previous group membership
     * @param membership new group membership
     * @param merged indicates whether the membership change is the result of a merge view
     */
    void membershipChanged(Membership previousMembership, Membership membership, boolean merged);
}

Fix spelling of parameter name.

Fix spelling of parameter name.


package example;

import java.awt.BorderLayout;

import javax.swing.JFrame;

import processing.core.*;

public class MainJFrame {
	static public void main(String args[]) {
		// This method works!
		//PApplet.main (new String[] { "--present", "--bgcolor=#000000", "--stop-color=#cccccc", "example.Main"});

        // But now this method.
        JFrame frame = new JFrame ();
        frame.setLayout(new BorderLayout());
        PApplet sketch = new example.Main();
        frame.add(sketch, BorderLayout.CENTER);
        sketch.init();
        frame.pack();
        frame.show();
	}
}

package example;

import java.awt.BorderLayout;

import javax.swing.JFrame;

import processing.core.*;

public class MainJFrame {
	static public void main(String args[]) {
		// This method works!
		//PApplet.main (new String[] { "--present", "--bgcolor=#000000", "--stop-color=#cccccc", "example.Main"});

        // But now this method.
        JFrame frame = new JFrame();
        frame.setLayout(new BorderLayout());
        PApplet sketch = new example.Main();
        frame.add(sketch, BorderLayout.CENTER);
        sketch.init();
        frame.pack();
        frame.show();
	}
}

Remove extra space from before ()

Remove extra space from before ()


/*
 * Copyright 2001-2004 The Apache Software Foundation.
 *
 * 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.apache.commons.codec;

/**
 * Defines common decoding methods for byte array decoders.
 *
 * @author Tim O'Brien
 * @author Gary Gregory
 * @version $Id: BinaryDecoder.java,v 1.9 2004/02/23 07:32:49 ggregory Exp $
 */
public interface BinaryDecoder extends Decoder {

    /**
     * Decodes a byte array and returns the results as a byte array.
     *
     * @param pArray A byte array which has been encoded with the
     *      appropriate encoder
     *
     * @return a byte array that contains decoded content
     *
     * @throws DecoderException A decoder exception is thrown
     *          if a Decoder encounters a failure condition during
     *          the decode process.
     */
    byte[] decode(byte[] pArray) throws DecoderException;
}

/*
 * Copyright 2001-2004 The Apache Software Foundation.
 *
 * 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.apache.commons.codec;

/**
 * Defines common decoding methods for byte array decoders.
 *
 * @author Apache Software Foundation
 * @version $Id: BinaryDecoder.java,v 1.10 2004/06/15 18:14:15 ggregory Exp $
 */
public interface BinaryDecoder extends Decoder {

    /**
     * Decodes a byte array and returns the results as a byte array.
     *
     * @param pArray A byte array which has been encoded with the
     *      appropriate encoder
     *
     * @return a byte array that contains decoded content
     *
     * @throws DecoderException A decoder exception is thrown
     *          if a Decoder encounters a failure condition during
     *          the decode process.
     */
    byte[] decode(byte[] pArray) throws DecoderException;
}

Replace custom author tags with @author Apache Software Foundation.

git-svn-id: 774b6be6af7f353471b728afb213ebe1be89b277@130378 13f79535-47bb-0310-9956-ffa450edef68


package com.dhemery.victor;

/**
 * Represents an application running on an iOS device.
 * @author Dale Emery
 *
 */
public interface IosApplication {
	public enum Orientation {
		LANDSCAPE,
		PORTRAIT,
		UNKNOWN,
	}

    /**
     * Send a message to the application delegate.
     * @param name the name of the message to send (an Objective-C selector).
     * @param arguments arguments to send with the message.
     * @return the value returned by the application delegate.
     */
    String sendMessage(String name, String... arguments);

	/**
	 * @return the application's current orientation.
	 */
	Orientation orientation();
}

package com.dhemery.victor;

/**
 * Represents an application running on an iOS device.
 * @author Dale Emery
 *
 */
public interface IosApplication {
	public enum Orientation {
		LANDSCAPE,
		PORTRAIT,
		UNKNOWN,
	}

    /**
     * Send a message to the application delegate.
     * @param name the name of the message to send (an Objective-C selector).
     * @param arguments arguments to send with the message.
     * @return the value returned by the application delegate.
     */
    String sendMessage(String name, String... arguments);

	/**
	 * @return the application's current orientation.
	 */
	Orientation orientation();

    /**
     * @param query identifies a set of views.
     * @return a view driver that represents the identified views within this application.
     */
    IosView view(By query);
}

Clean up APIs of Frank classes.

Clean up APIs of Frank classes.


package butterknife.internal;

import android.view.View;

/**
 * A {@link View.OnClickListener} that enables debouncing of multiple clicks posted in a row.
 *
 * Once a click is fired, a post is enqueued to the main thread looper queue and no further click
 * is allowed until that post is dequeued.
 *
 * A click on one button disables all buttons.
 *
 */
public abstract class DebouncingOnClickListener implements View.OnClickListener {

  /**
   * This is static because we want to disable clicks for all click listeners.
   */
  private static boolean enabled = true;

  private static final Runnable ENABLE_AGAIN = new Runnable() {
    @Override public void run() {
      enabled = true;
    }
  };

  @Override public final void onClick(View v) {
    if (enabled) {
      enabled = false;
      v.post(ENABLE_AGAIN);
      doClick(v);
    }
  }

  public abstract void doClick(View v);
}

package butterknife.internal;

import android.view.View;

/**
 * A {@linkplain View.OnClickListener click listener} that debounces multiple clicks posted in the
 * same frame. A click on one button disables all buttons for that frame.
 */
public abstract class DebouncingOnClickListener implements View.OnClickListener {
  private static boolean enabled = true;

  private static final Runnable ENABLE_AGAIN = new Runnable() {
    @Override public void run() {
      enabled = true;
    }
  };

  @Override public final void onClick(View v) {
    if (enabled) {
      enabled = false;
      v.post(ENABLE_AGAIN);
      doClick(v);
    }
  }

  public abstract void doClick(View v);
}

Clean up the docs to remove implementation details.


/*
 * Copyright 2020, TeamDev. 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 io.spine.query;

import com.google.errorprone.annotations.Immutable;

import java.util.function.UnaryOperator;

/**
 * A lambda serving to fill the current predicate {@linkplain QueryBuilder query builders}
 * with the parameters joined in {@linkplain LogicalOperator#OR disjunction}.
 */
@Immutable
@FunctionalInterface
public interface Either<B extends QueryBuilder<?, ?, ?, ?, ?>> extends UnaryOperator<B> {

}

/*
 * Copyright 2020, TeamDev. 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 io.spine.query;

import com.google.errorprone.annotations.Immutable;

import java.util.function.UnaryOperator;

/**
 * A lambda serving to fill the current predicate {@linkplain QueryBuilder query builders}
 * with the parameters joined in {@linkplain LogicalOperator#OR disjunction}.
 *
 * @param <B> the type of the query builder
 */
@Immutable
@FunctionalInterface
public interface Either<B extends QueryBuilder<?, ?, ?, ?, ?>> extends UnaryOperator<B> {

}

Add the missing docs for the parameter.

Add the missing docs for the parameter.


/*
 * Copyright 2017 Arunkumar
 *
 * 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 arun.com.chameleonskinforkwlp;

import android.app.Application;

import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
import timber.log.Timber;

public class Chameleon extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Fabric.with(this, new Crashlytics());
        if (BuildConfig.DEBUG) {
            Timber.plant(new Timber.DebugTree());
        }
    }
}

/*
 * Copyright 2017 Arunkumar
 *
 * 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 arun.com.chameleonskinforkwlp;

import android.app.Application;

import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.core.CrashlyticsCore;

import io.fabric.sdk.android.Fabric;
import timber.log.Timber;

public class Chameleon extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        CrashlyticsCore core = new CrashlyticsCore.Builder()
                .disabled(BuildConfig.DEBUG)
                .build();
        Fabric.with(this, new Crashlytics.Builder().core(core).build());

        if (BuildConfig.DEBUG) {
            Timber.plant(new Timber.DebugTree());
        }
    }
}

Disable crashlytics on debug builds.

Disable crashlytics on debug builds.


package nuclibook.routes;

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

import java.util.List;

public class ExportRoute extends DefaultRoute {

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

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

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

        String exportData = null;

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

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

        return exportData;
    }
}

package nuclibook.routes;

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

import java.util.List;

public class ExportRoute extends DefaultRoute {

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

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

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

        String exportData = null;

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

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

        return exportData;
    }
}

Fix string == null error

Fix string == null error


package vg.civcraft.mc.citadel.command.commands;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import vg.civcraft.mc.citadel.PlayerState;
import vg.civcraft.mc.citadel.Utility;
import vg.civcraft.mc.civmodcore.command.PlayerCommand;

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

public class Off extends PlayerCommand{

	public Off(String name) {
		super(name);
		setIdentifier("cto");
		setDescription("Turns all Reinforcement Modes off.");
		setUsage("/cto");
		setArguments(0,0);
	}

	@Override
	public boolean execute(CommandSender sender, String[] args) {
		if (!(sender instanceof Player)){
			sender.sendMessage("Must be a player to run this command.");
			return true;
		}
		Player p = (Player) sender;
		PlayerState state = PlayerState.get(p);
		state.reset();
		if (state.isBypassMode()) {
			state.toggleBypassMode();
		}
		Utility.sendAndLog(p, ChatColor.GREEN, "Reinforcement mode has been set to Normal.");
		return true;
	}

	@Override
	public List<String> tabComplete(CommandSender sender, String[] args) {
		return new ArrayList<String>();
	}

}

package vg.civcraft.mc.citadel.command.commands;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import vg.civcraft.mc.citadel.PlayerState;
import vg.civcraft.mc.citadel.Utility;
import vg.civcraft.mc.civmodcore.command.PlayerCommand;

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

public class Off extends PlayerCommand{

	public Off(String name) {
		super(name);
		setIdentifier("cto");
		setDescription("Turns all Reinforcement Modes off.");
		setUsage("/cto");
		setArguments(0,0);
	}

	@Override
	public boolean execute(CommandSender sender, String[] args) {
		if (!(sender instanceof Player)){
			sender.sendMessage("Must be a player to run this command.");
			return true;
		}
		Player p = (Player) sender;
		PlayerState state = PlayerState.get(p);
		state.reset();
		if (state.isBypassMode()) {
			state.toggleBypassMode();
		}
		if (state.getEasyMode()) {
			state.toggleEasyMode();
		}
		Utility.sendAndLog(p, ChatColor.GREEN, "Reinforcement mode has been set to Normal.");
		return true;
	}

	@Override
	public List<String> tabComplete(CommandSender sender, String[] args) {
		return new ArrayList<String>();
	}

}

Clear easy mode on /cto

Clear easy mode on /cto

Why are we clearing bypass mode but not easy mode?


package introspect;

import net.bytebuddy.instrumentation.method.bytecode.bind.annotation.*;

import java.lang.invoke.MethodHandle;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
import clojure.lang.IFn;

public class Interceptor {

	public static IFn callback;

  @RuntimeType
  public static Object intercept(@SuperCall Callable method,
                                 @This Object proxy,
                                 @AllArguments Object[] allArguments) throws Throwable {

    Object returnValue = null;
    try {
      returnValue = method.call();
    } catch (Throwable throwable) {
      callback.invoke(proxy, allArguments, throwable);
      throwable.printStackTrace();
      throw throwable;
    }

    // System.out.printf("___%s, returnValue: %s___\n",proxy, returnValue);
    callback.invoke(proxy, allArguments, returnValue);
    return returnValue;
  }

	public static void setCallback(IFn fn) {
		callback = fn;
	}

}

package introspect;

import net.bytebuddy.instrumentation.method.bytecode.bind.annotation.*;

import java.lang.invoke.MethodHandle;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
import clojure.lang.IFn;

public class Interceptor {

	public static IFn callback;

  @RuntimeType
  public static Object intercept(@SuperCall Callable method,
                                 @Origin Method originalMethod,
                                 @This Object proxy,
                                 @AllArguments Object[] allArguments) throws Throwable {

    Object returnValue = null;
    try {
      returnValue = method.call();
    } catch (Throwable throwable) {
      callback.invoke(proxy, allArguments, throwable);
      throwable.printStackTrace();
      throw throwable;
    }

    // System.out.printf("___%s, returnValue: %s___\n",proxy, returnValue);
    callback.invoke(proxy, originalMethod, allArguments, returnValue);
    return returnValue;
  }

	public static void setCallback(IFn fn) {
		callback = fn;
	}

}

Add original method call interception for protocols


package org.cyclops.cyclopscore.inventory.container;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.container.ContainerType;

import javax.annotation.Nullable;

/**
 * A container for an inventory.
 * @author rubensworks
 */
public abstract class InventoryContainer extends ContainerExtended {

	protected final IInventory inventory;

	public InventoryContainer(@Nullable ContainerType<?> type, int id, PlayerInventory playerInventory, IInventory inventory) {
		super(type, id, playerInventory);
		this.inventory = inventory;
		assertInventorySize(inventory, getSizeInventory());
		this.inventory.openInventory(playerInventory.player);
	}

	public IInventory getContainerInventory() {
		return inventory;
	}

	@Override
	protected int getSizeInventory() {
		return inventory.getSizeInventory();
	}

	@Override
	public boolean canInteractWith(PlayerEntity player) {
		return this.inventory.isUsableByPlayer(player);
	}

	@Override
	public void onContainerClosed(PlayerEntity player) {
		super.onContainerClosed(player);
		this.inventory.closeInventory(player);
	}
}

package org.cyclops.cyclopscore.inventory.container;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.container.ContainerType;

import javax.annotation.Nullable;

/**
 * A container for an inventory.
 * @author rubensworks
 */
public abstract class InventoryContainer extends ContainerExtended {

	protected final IInventory inventory;

	public InventoryContainer(@Nullable ContainerType<?> type, int id, PlayerInventory playerInventory, IInventory inventory) {
		super(type, id, playerInventory);
		this.inventory = inventory;
		if (isAssertInventorySize()) {
			assertInventorySize(inventory, getSizeInventory());
		}
		this.inventory.openInventory(playerInventory.player);
	}

	protected boolean isAssertInventorySize() {
		return true;
	}

	public IInventory getContainerInventory() {
		return inventory;
	}

	@Override
	protected int getSizeInventory() {
		return inventory.getSizeInventory();
	}

	@Override
	public boolean canInteractWith(PlayerEntity player) {
		return this.inventory.isUsableByPlayer(player);
	}

	@Override
	public void onContainerClosed(PlayerEntity player) {
		super.onContainerClosed(player);
		this.inventory.closeInventory(player);
	}
}

Allow inventory size assertion to be skipped


package com.growingwiththeweb.algorithms.interviewquestions.reversestring;

public class Program {
    public static void main(String[] args) {
        assert reverse1("abc123def").equals("fed321cba");
        assert reverse2("abc123def").equals("fed321cba");
        assert reverse3("abc123def").equals("fed321cba");
        assert reverse1("abcd1234").equals("4321dcba");
        assert reverse2("abcd1234").equals("4321dcba");
        assert reverse3("abcd1234").equals("4321dcba");

        System.out.println("Tests passed");
    }

    public static String reverse1(String text) {
        char[] charArray = text.toCharArray();
        int start = -1;
        int end = charArray.length;
        while (++start < --end) {
            char temp = charArray[start];
            charArray[start] = charArray[end];
            charArray[end] = temp;
        }
        return String.valueOf(charArray);
    }

    public static String reverse2(String text) {
        StringBuilder sb = new StringBuilder();
        for (int i = text.length() - 1; i >= 0; i--) {
            sb.append(text.charAt(i));
        }
        return sb.toString();
    }

    public static String reverse3(String text) {
        return new StringBuilder(text).reverse().toString();
    }
}

package com.growingwiththeweb.algorithms.interviewquestions.reversestring;

public class Program {
    public static void main(String[] args) {
        assert reverseViaCharArray("abc123def").equals("fed321cba");
        assert reverseViaStringBuilderA("abc123def").equals("fed321cba");
        assert reverseViaStringBuilderB("abc123def").equals("fed321cba");
        assert reverseViaCharArray("abcd1234").equals("4321dcba");
        assert reverseViaStringBuilderA("abcd1234").equals("4321dcba");
        assert reverseViaStringBuilderB("abcd1234").equals("4321dcba");

        System.out.println("Tests passed");
    }

    public static String reverseViaCharArray(String text) {
        char[] charArray = text.toCharArray();
        int start = -1;
        int end = charArray.length;
        while (++start < --end) {
            char temp = charArray[start];
            charArray[start] = charArray[end];
            charArray[end] = temp;
        }
        return String.valueOf(charArray);
    }

    public static String reverseViaStringBuilderA(String text) {
        StringBuilder sb = new StringBuilder();
        for (int i = text.length() - 1; i >= 0; i--) {
            sb.append(text.charAt(i));
        }
        return sb.toString();
    }

    public static String reverseViaStringBuilderB(String text) {
        return new StringBuilder(text).reverse().toString();
    }
}

Update reverse string method names

Update reverse string method names


package org.atlasapi.query.v4.meta;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class ConfigurerBasedLinkCreatorTest {

    private String baseUri = "base";
    private final LinkCreator linkCreator = new MetaApiLinkCreator(baseUri);

    @Test
    public void testLinkCreation() {
        String type = "type";

        assertEquals(baseUri + "/4/meta/model_classes/" + type + ".json", linkCreator.createModelLink(type));
    }

}

package org.atlasapi.query.v4.meta;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class ConfigurerBasedLinkCreatorTest {

    private String baseUri = "base";
    private final LinkCreator linkCreator = new MetaApiLinkCreator(baseUri);

    @Test
    public void testLinkCreation() {
        String type = "type";

        assertEquals(baseUri + "/4/meta/types/" + type + ".json", linkCreator.createModelLink(type));
    }

}

Fix test for Meta API URL generation

Fix test for Meta API URL generation


package unstar.server;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;

/**
 * The main class for launching a server.
 */
public final class Launcher {

    /**
     * Hidden constructor.
     */
    private Launcher() {
    }

    /**
     * The main method, launches a server.
     * @param args  command line arguments
     */
    public static void main(final String[] args) {
        if (args.length != 1) {
            System.err.println("error: select one file to serve");
            System.exit(-1);
        }

        unstar.DeadSimpleFormatter.load();

        try {
            PrintStream out = new PrintStream(new File("valid.log"));
            File in = new File(args[0]);
            new Server(in, Server.DEFAULT_PORT, out).run();
        } catch (FileNotFoundException e) {
            System.err.println("File not found: " + e.getMessage());
            System.exit(-1);
        }
    }
}

package unstar.server;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;

/**
 * The main class for launching a server.
 */
public final class Launcher {

    /**
     * Hidden constructor.
     */
    private Launcher() {
    }

    /**
     * The main method, launches a server.
     * @param args  command line arguments
     */
    public static void main(final String[] args) {
        if (args.length != 1) {
            System.err.println("error: select one file to serve");
            System.exit(-1);
        }

        unstar.DeadSimpleFormatter.load();

        try {
            File log = new File("valid.log");
            FileOutputStream fout = new FileOutputStream(log, true);
            PrintStream out = new PrintStream(fout, true);
            File in = new File(args[0]);
            new Server(in, Server.DEFAULT_PORT, out).run();
        } catch (FileNotFoundException e) {
            System.err.println("File not found: " + e.getMessage());
            System.exit(-1);
        }
    }
}

Append to the valid code log rather than truncate.


package com.jmrapp.terralegion.game.world.block;

public enum BlockType {

	AIR(0), DIRT(1), GRASS(2), STONE(3), DIAMOND(4), TORCH(5), STONE_WALL(6), COAL(8), DIRT_WALL(9),
    WOOD(10), LEAVES(11), WOOD_CHEST(12);

    private static final BlockType[] blockTypeArray = values();
	private final int id;

    BlockType(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public static BlockType getBlockType(int id) {
        for (BlockType type : blockTypeArray) {
            if (type.getId() == id)
                return type;
        }
        return AIR;
    }

}

package com.jmrapp.terralegion.game.world.block;

public enum BlockType {

	AIR(0), DIRT(1), GRASS(2), STONE(3), DIAMOND(4), TORCH(5), STONE_WALL(6), COAL(8), DIRT_WALL(9),
    WOOD(10), LEAVES(11), WOOD_CHEST(14);

    private static final BlockType[] blockTypeArray = values();
	private final int id;

    BlockType(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public static BlockType getBlockType(int id) {
        for (BlockType type : blockTypeArray) {
            if (type.getId() == id)
                return type;
        }
        return AIR;
    }

}

Fix chest using taken ID

Fix chest using taken ID


package som.interpreter.nodes;

import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;

public class ArgumentEvaluationNode extends ExpressionNode {

  @Children private final ExpressionNode[] arguments;

  public ArgumentEvaluationNode(final ExpressionNode[] arguments) {
    this.arguments = adoptChildren(arguments);
  }

  public ArgumentEvaluationNode() {
    this.arguments = null;
  }

  public ExpressionNode getArgument(final int idx) {
    return arguments[idx];
  }

  @Override
  public Object executeGeneric(final VirtualFrame frame) {
    return executeArray(frame);
  }

  @Override
  @ExplodeLoop
  public Object[] executeArray(final VirtualFrame frame) {
    if (arguments == null || arguments.length == 0) {
      return null;
    }

    Object[] result = new Object[arguments.length];

    for (int i = 0; i < arguments.length; i++) {
      result[i] = arguments[i].executeGeneric(frame);
    }

    return result;
  }

}

package som.interpreter.nodes;

import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;

public class ArgumentEvaluationNode extends ExpressionNode {

  @Children private final ExpressionNode[] arguments;

  public ArgumentEvaluationNode(final ExpressionNode[] arguments) {
    this.arguments = adoptChildren(arguments);
  }

  public ArgumentEvaluationNode() {
    this.arguments = null;
  }

  public ExpressionNode getArgument(final int idx) {
    return arguments[idx];
  }

  @Override
  public Object executeGeneric(final VirtualFrame frame) {
    return executeArray(frame);
  }

  @Override
  @ExplodeLoop
  public Object[] executeArray(final VirtualFrame frame) {
    Object[] result = new Object[arguments.length];

    for (int i = 0; i < arguments.length; i++) {
      result[i] = arguments[i].executeGeneric(frame);
    }

    return result;
  }

}

Remove the null and length check, this should always hold.

Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>


// Copyright 2022 Code Intelligence GmbH
//
// 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.example;

import static org.junit.jupiter.api.Assumptions.assumeTrue;

import com.code_intelligence.jazzer.junit.FuzzTest;

class AutofuzzFuzzTests {
  private static class IntHolder {
    private final int i;

    IntHolder(int i) {
      this.i = i;
    }

    public int getI() {
      return i;
    }
  }

  @FuzzTest
  void autofuzz(String str, IntHolder holder) {
    assumeTrue(holder != null);
    if (holder.getI() == 1234 && "jazzer".equals(str)) {
      throw new RuntimeException();
    }
  }

  @FuzzTest(seedCorpus = "AutofuzzSeedCorpus")
  void autofuzzWithCorpus(String str, int i) {
    if ("jazzer".equals(str) && i == 1234) {
      throw new RuntimeException();
    }
  }
}

// Copyright 2022 Code Intelligence GmbH
//
// 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.example;

import static org.junit.jupiter.api.Assumptions.assumeTrue;

import com.code_intelligence.jazzer.junit.FuzzTest;

class AutofuzzFuzzTests {
  private static class IntHolder {
    private final int i;

    IntHolder(int i) {
      this.i = i;
    }

    public int getI() {
      return i;
    }
  }

  @FuzzTest(maxDuration = "5m")
  void autofuzz(String str, IntHolder holder) {
    assumeTrue(holder != null);
    if (holder.getI() == 1234 && "jazzer".equals(str)) {
      throw new RuntimeException();
    }
  }

  @FuzzTest(seedCorpus = "AutofuzzSeedCorpus")
  void autofuzzWithCorpus(String str, int i) {
    if ("jazzer".equals(str) && i == 1234) {
      throw new RuntimeException();
    }
  }
}

Increase timout of autofuzz @FuzzTest

tests: Increase timout of autofuzz @FuzzTest


package com.enderio.core.common.tweaks;

import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class InfiniBow extends Tweak {

  public InfiniBow() {
    super("infinibow", "Makes bows with Infinity enchant able to be fired with no arrows in the inventory.");
  }

  @Override
  public void load() {
    MinecraftForge.EVENT_BUS.register(this);
  }

  @SubscribeEvent
  public void onArrowNock(ArrowNockEvent event) {
    EntityPlayer player = event.entityPlayer;
    ItemStack stack = player.getHeldItem();
    if (player.capabilities.isCreativeMode || player.inventory.hasItem(Items.arrow)
        || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0) {
      player.setItemInUse(stack, stack.getItem().getMaxItemUseDuration(stack));
    }

    event.result = stack;
    event.setCanceled(true);
  }
}

package com.enderio.core.common.tweaks;

import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class InfiniBow extends Tweak {

  public InfiniBow() {
    super("infinibow", "Makes bows with Infinity enchant able to be fired with no arrows in the inventory.");
  }

  @Override
  public void load() {
    MinecraftForge.EVENT_BUS.register(this);
  }

  @SubscribeEvent(priority = EventPriority.LOWEST)
  public void onArrowNock(ArrowNockEvent event) {
    EntityPlayer player = event.entityPlayer;
    ItemStack stack = player.getHeldItem();
    if (player.capabilities.isCreativeMode || player.inventory.hasItem(Items.arrow)
        || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0) {
      player.setItemInUse(stack, stack.getItem().getMaxItemUseDuration(stack));
    }

    event.result = stack;
    event.setCanceled(true);
  }
}

Make infinibow lowest priority to give other mod behaviors priority


package com.bol.cd.stash;

import feign.Feign;
import feign.RequestInterceptor;
import feign.auth.BasicAuthRequestInterceptor;
import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder;
import feign.jaxrs.JAXRSModule;

import java.util.Arrays;

import com.bol.cd.stash.model.JsonApplicationMediaTypeInterceptor;
import com.bol.cd.stash.request.DeleteBranch;

public class StashClient {

    private static String projectKey = "TPT";
    private static String repositorySlug = "testrepository";

    public static StashApi createClient() {
        return Feign.builder().contract(new JAXRSModule.JAXRSContract()).decoder(new JacksonDecoder()).encoder(new JacksonEncoder())
                .requestInterceptors(getRequestInterceptors()).target(StashApi.class, "http://localhost:7990");
    }

    private static Iterable<RequestInterceptor> getRequestInterceptors() {
        return Arrays.asList(new BasicAuthRequestInterceptor("admin", "password"), new JsonApplicationMediaTypeInterceptor());
    }

}

package com.bol.cd.stash;

import feign.Feign;
import feign.RequestInterceptor;
import feign.auth.BasicAuthRequestInterceptor;
import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder;
import feign.jaxrs.JAXRSModule;

import java.util.Arrays;

import com.bol.cd.stash.model.JsonApplicationMediaTypeInterceptor;
import com.bol.cd.stash.request.DeleteBranch;

public class StashClient {

    public static StashApi createClient() {
        return Feign.builder().contract(new JAXRSModule.JAXRSContract()).decoder(new JacksonDecoder()).encoder(new JacksonEncoder())
                .requestInterceptors(getRequestInterceptors()).target(StashApi.class, "http://localhost:7990");
    }

    private static Iterable<RequestInterceptor> getRequestInterceptors() {
        return Arrays.asList(new BasicAuthRequestInterceptor("admin", "password"), new JsonApplicationMediaTypeInterceptor());
    }

}

Refactor in progress - cleaning...

Refactor in progress - cleaning...


/*
 * Copyright 2015 Ben Ashford
 *
 * 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 jresp.pool;

import jresp.Connection;
import jresp.ConnectionException;
import jresp.Responses;
import jresp.protocol.RespType;

import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;

/**
 * A connection used solely for commands that have a single response to each request
 */
public class SingleCommandConnection {
    private Connection connection;

    private Deque<Responses> responseQueue = new ArrayDeque<>();

    public SingleCommandConnection(Connection connection) throws IOException, ConnectionException {
        this.connection = connection;
        this.connection.start(resp -> {
            synchronized (responseQueue) {
                responseQueue.pop().responseReceived(resp);
            }
        });
    }

    public void write(RespType command, Responses responses) {
        synchronized (responseQueue) {
            responseQueue.add(responses);
            connection.write(command);
        }
    }
}

/*
 * Copyright 2015 Ben Ashford
 *
 * 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 jresp.pool;

import jresp.Connection;
import jresp.ConnectionException;
import jresp.Responses;
import jresp.protocol.RespType;

import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;

/**
 * A connection used solely for commands that have a single response to each request
 */
public class SingleCommandConnection {
    private Connection connection;

    private final Deque<Responses> responseQueue = new ArrayDeque<>();

    public SingleCommandConnection(Connection connection) throws IOException, ConnectionException {
        this.connection = connection;
        this.connection.start(resp -> {
            Responses respondTo = null;
            synchronized (responseQueue) {
                if (responseQueue.isEmpty()) {
                    throw new IllegalStateException("Got an unexpected response: " + resp);
                }
                respondTo = responseQueue.pop();
            }
            respondTo.responseReceived(resp);
        });
    }

    public void write(RespType command, Responses responses) {
        synchronized (responseQueue) {
            responseQueue.add(responses);
            connection.write(command);
        }
    }
}

Put a sharper-edge on a potential failure-case when requests and responses become out-of-sync.


package org.osiam.client.oauth;

import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.osiam.resources.scim.Group;

import java.util.Set;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
public class QueryResult {

    private Integer totalResults;
    private Integer itemsPerPage;
    private Integer startIndex;
    private Set<String> schemas;
    private Set<Group> Resources;

    public Integer getTotalResults() {
        return totalResults;
    }

    public Integer getItemsPerPage() {
        return itemsPerPage;
    }

    public Integer getStartIndex() {
        return startIndex;
    }

    public Set<String> getSchemas() {
        return schemas;
    }

    public Set<Group> Resources() {
        return Resources;
    }
}

package org.osiam.client.oauth;

import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.osiam.resources.scim.Group;

import java.util.Set;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
public class QueryResult {

    private Integer totalResults;
    private Integer itemsPerPage;
    private Integer startIndex;
    private String schemas;
    private Set<Group> Resources;

    public Integer getTotalResults() {
        return totalResults;
    }

    public Integer getItemsPerPage() {
        return itemsPerPage;
    }

    public Integer getStartIndex() {
        return startIndex;
    }

    public String getSchemas() {
        return schemas;
    }

    public Set<Group> Resources() {
        return Resources;
    }
}

Set Schemas changed to String Schemas

Set Schemas changed to String Schemas


package org.dynmap.modsupport;

/**
 * Record representing a texture mapping for one or more blocks, based on copying an existing one
 */
public interface CopyBlockTextureRecord {
    public static final int METAMASK_ALL = -1;

    /**
     * Add block ID to mapping (in case multiple block IDs use same texture mapping)
     * @param blockID - block ID
     */
    public void addBlockID(int blockID);
    /**
     * Get block IDs
     * @return configured IDs
     */
    public int[] getBlockIDs();
    /**
     * Set metadata value : default is for all values (data=*).  Setting other values will match only the values that are set
     * @param data - value to match (-1 = all, 0-15 is meta value to match)
     */
    public void setMetaValue(int data);
    /**
     * Get matching metadata value mask
     * @return matching metadata mask: bit N is set if given metadata value matches
     */
    public int getMetaValueMask();
    /**
     * Get source block ID
     * @return source block ID
     */
    public int getSourceBlockID();
    /**
     * Get source metadata
     * @return souce meta ID
     */
    public int getSourceMeta();
}

package org.dynmap.modsupport;

/**
 * Record representing a texture mapping for one or more blocks, based on copying an existing one
 */
public interface CopyBlockTextureRecord {
    public static final int METAMASK_ALL = -1;

    /**
     * Add block ID to mapping (in case multiple block IDs use same texture mapping)
     * @param blockID - block ID
     */
    public void addBlockID(int blockID);
    /**
     * Get block IDs
     * @return configured IDs
     */
    public int[] getBlockIDs();
    /**
     * Set metadata value : default is for all values (data=*).  Setting other values will match only the values that are set
     * @param data - value to match (-1 = all, 0-15 is meta value to match)
     */
    public void setMetaValue(int data);
    /**
     * Get matching metadata value mask
     * @return matching metadata mask: bit N is set if given metadata value matches
     */
    public int getMetaValueMask();
    /**
     * Get source block ID
     * @return source block ID
     */
    public int getSourceBlockID();
    /**
     * Get source metadata
     * @return souce meta ID
     */
    public int getSourceMeta();
    /**
     * Set transparency mode for block
     * @param mode - transparency mode
     */
    public void setTransparencyMode(TransparencyMode mode);
    /**
     * Get transparency mode for block
     * @return transparency mode
     */
    public TransparencyMode getTransparencyMode();
}

Add transparency mode override to copied records


package ch.cern.cvmfs.model;

public class RepositoryDescription {

    private String name;
    private String fqrn;
    private String url;

    public RepositoryDescription(String name, String fqrn, String url) {
        this.name = name;
        this.fqrn = fqrn;
        this.url = url;
    }

    public String getName() {
        return name;
    }

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

    public String getFqrn() {
        return fqrn;
    }

    public void setFqrn(String fqrn) {
        this.fqrn = fqrn;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public String toString() {
        return name + "(" + fqrn + ")";
    }
}

package ch.cern.cvmfs.model;

public class RepositoryDescription {

    private String name;
    private String fqrn;
    private String url;

    public RepositoryDescription(String name, String fqrn, String url) {
        this.name = name;
        this.fqrn = fqrn;
        this.url = url;
    }

    public String getName() {
        return name;
    }

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

    public String getFqrn() {
        return fqrn;
    }

    public void setFqrn(String fqrn) {
        this.fqrn = fqrn;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public String toString() {
        return name + " (" + fqrn + ")";
    }
}

Insert a space when displaying the repositories


package se.kth.csc.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import se.kth.csc.persist.AccountStore;

public class AdminControllerTest {

    private AccountStore accountStore;
    private ObjectMapper objectMapper;
}

package se.kth.csc.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import se.kth.csc.auth.Role;
import se.kth.csc.model.Account;
import se.kth.csc.persist.AccountStore;
import org.junit.Before;
import se.kth.csc.persist.QueueStore;

import javax.servlet.http.HttpServletRequest;
import java.security.Principal;

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

public class AdminControllerTest {

    // SUT
    private AdminController adminController;
    // Dependencies
    private AccountStore accountStore;

    @Before
    public void setUp() throws Exception {
        accountStore = mock(AccountStore.class);
        adminController = new AdminController(accountStore, null, null);
    }

    @Test
    public void testMakeUserAdmin() throws Exception {
        HttpServletRequest request = mock(HttpServletRequest.class);
        when(request.isUserInRole(Role.ADMIN.getAuthority())).thenReturn(true);
        Principal principal = mock(Principal.class);
        when(principal.getName()).thenReturn("testuser");
        Account account = mock(Account.class);
        when(accountStore.fetchAccountWithPrincipalName("testuser")).thenReturn(account);

        String result = adminController.makeUserAdmin("testuser", request);
        verify(account, atLeastOnce()).setAdmin(true);
        assertEquals(result, "redirect:/admin/settings");
    }

    @Test
    public void removeUserAdmin() throws Exception {
        HttpServletRequest request = mock(HttpServletRequest.class);
        when(request.isUserInRole(Role.ADMIN.getAuthority())).thenReturn(true);
        Principal principal = mock(Principal.class);
        when(principal.getName()).thenReturn("testuser");
        Account account = mock(Account.class);
        when(accountStore.fetchAccountWithPrincipalName("testuser")).thenReturn(account);

        String result = adminController.removeUserAdmin("testuser", request);
        verify(account, atLeastOnce()).setAdmin(false);
        assertEquals(result, "redirect:/admin/settings");
    }
}

Add tests for adding admins and removing admins.


package seedu.address.commons.core;

/**
 * Container for user visible messages.
 */
public class Messages {

    public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
    public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
    public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
    public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";

}

package seedu.address.commons.core;

/**
 * Container for user visible messages.
 */
public class Messages {

    public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
    public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
    public static final String MESSAGE_INVALID_TASK_DISPLAYED_INDEX = "The task index provided is invalid";
    public static final String MESSAGE_TASKS_LISTED_OVERVIEW = "%1$d tasks listed!";

}

Modify Variable and Method names

Modify Variable and Method names

changed all mention of AddressBook/Person to TaskManager/Task


/*******************************************************************************
 * Copyright 2014, 2016 gwt-ol3
 *
 * 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 ol;

/**
 * Test for {@link Feature}.
 *
 * @author Tino Desjardins
 *
 */
public class FeatureTest extends GwtOL3BaseTestCase {

    private static final String FEATURE_ID = "#1";

    public void testAttribution() {

        injectUrlAndTest(new TestWithInjection() {

            @Override
            public void test() {

                Feature feature = new Feature();

                assertNotNull(feature);
                assertTrue(feature instanceof Object);
                assertTrue(feature instanceof Observable);

                feature.setId(FEATURE_ID);

                assertEquals(FEATURE_ID, feature.getId());

            }

        });

    }

}

/*******************************************************************************
 * Copyright 2014, 2016 gwt-ol3
 *
 * 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 ol;

/**
 * Test for {@link Feature}.
 *
 * @author Tino Desjardins
 *
 */
public class FeatureTest extends GwtOL3BaseTestCase {

    private static final String FEATURE_ID = "#1";
    private static final String GEOMETRY_NAME = "geometry";

    public void testFeature() {

        injectUrlAndTest(new TestWithInjection() {

            @Override
            public void test() {

                Feature feature = new Feature();

                assertNotNull(feature);
                assertTrue(feature instanceof Object);
                assertTrue(feature instanceof Observable);

                feature.setId(FEATURE_ID);
                assertEquals(FEATURE_ID, feature.getId());

                feature.setGeometryName(GEOMETRY_NAME);
                assertEquals(GEOMETRY_NAME, feature.getGeometryName());

            }

        });

    }

}

Refactor and extend test for Feature

Refactor and extend test for Feature


package me.modmuss50.rebornstorage.proxys;

import me.modmuss50.rebornstorage.init.ModelHelper;

/**
 * Created by Gigabit101 on 03/01/2017.
 */
public class ClientProxy extends CommonProxy {
	@Override
	public void registerRenders() {
		ModelHelper.init();
	}
}

package me.modmuss50.rebornstorage.proxys;

import com.raoulvdberge.refinedstorage.apiimpl.API;
import me.modmuss50.rebornstorage.client.gui.ContainerMultiCrafter;
import me.modmuss50.rebornstorage.init.ModelHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.inventory.Container;

/**
 * Created by Gigabit101 on 03/01/2017.
 */
public class ClientProxy extends CommonProxy {
	@Override
	public void registerRenders() {
		ModelHelper.init();

		API.instance().addPatternRenderHandler(itemStack -> {
			Container container = Minecraft.getMinecraft().player.openContainer;
			if(container instanceof ContainerMultiCrafter){
				for (int i = 0; i < 78; i++) {
					if(container.getSlot(i).getStack() == itemStack){
						return true;
					}
				}

			}
			return false;
		});
	}
}

Make patters render output item when in multicrafter slot


package com.haskforce.jps.model;

import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.JpsElementTypeWithDefaultProperties;
import org.jetbrains.jps.model.library.sdk.JpsSdkType;

import java.io.File;

public class JpsHaskellSdkType extends JpsSdkType<JpsDummyElement> implements JpsElementTypeWithDefaultProperties<JpsDummyElement> {
    public static final JpsHaskellSdkType INSTANCE = new JpsHaskellSdkType();

    @NotNull
    public static File getExecutable(@NotNull final String path, @NotNull final String command) {
        return new File(path, SystemInfo.isWindows ? command + ".exe" : command);
    }

    @NotNull
    public static File getByteCodeCompilerExecutable(@NotNull final String sdkHome) {
        return getExecutable(new File(sdkHome, "bin").getAbsolutePath(), "ghc");
    }

    @NotNull
    @Override
    public JpsDummyElement createDefaultProperties() {
        return JpsElementFactory.getInstance().createDummyElement();
    }
}

package com.haskforce.jps.model;

import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.JpsElementTypeWithDefaultProperties;
import org.jetbrains.jps.model.library.sdk.JpsSdkType;

import java.io.File;

public class JpsHaskellSdkType extends JpsSdkType<JpsDummyElement> implements JpsElementTypeWithDefaultProperties<JpsDummyElement> {
    public static final JpsHaskellSdkType INSTANCE = new JpsHaskellSdkType();

    @NotNull
    public static File getExecutable(@NotNull final String path, @NotNull final String command) {
        return new File(path, SystemInfo.isWindows ? command + ".exe" : command);
    }

    @NotNull
    public static File getGhcExecutable(@NotNull final String sdkHome) {
        return getExecutable(new File(sdkHome, "bin").getAbsolutePath(), "ghc");
    }

    @NotNull
    @Override
    public JpsDummyElement createDefaultProperties() {
        return JpsElementFactory.getInstance().createDummyElement();
    }
}

Rename the method for getting the compiler.


/**
 * Copyright © 2014 Will Dignazio
 *
 * Java implementation file for the JNI wrapper of libatasmart.
 * This provides an interface to produce SkDisk objects that are
 * synonymous with the SkDisk structures within the atasmart library.
 *
 * The underlying implementation code is compiled from a .c file(s),
 * the primary of which being jatasmart.c.
 *
 * @author Will Dignazio <wdignazio@gmail.com>
 */

package net.digitalbebop;

public class JataSMART
{
	/* One time initialize libatasmart */
	static
	{
		System.loadLibrary("jatasmart");
	}

	private class SkDisk
	{
		private long _skDiskAddr;

		private SkDisk()
		{
		}

		public native long getSize();
		public native boolean isSMARTAvailable();
		public native boolean isSleepMode();
		public native boolean isIdentifyAvailabe();
		public native boolean getSMARTStatus();
		public native long getPowerOn();
		public native long getPowerCycle();
		public native long getBadSectors();
		public native long getTemperature();

		public native String toString();
	}

	public native SkDisk open(String path);
}

/**
 * Copyright © 2014 Will Dignazio
 *
 * Java implementation file for the JNI wrapper of libatasmart.
 * This provides an interface to produce SkDisk objects that are
 * synonymous with the SkDisk structures within the atasmart library.
 *
 * The underlying implementation code is compiled from a .c file(s),
 * the primary of which being jatasmart.c.
 *
 * @author Will Dignazio <wdignazio@gmail.com>
 */

package net.digitalbebop;

public class JataSMART
{
	/* One time initialize libatasmart */
	static
	{
		System.loadLibrary("jatasmart");
	}

	private class SkDisk
	{
		private long _skDiskAddr;

		private SkDisk()
		{
		}

		public native long getSize();
		public native boolean isSMARTAvailable();
		public native boolean isSleepMode();
		public native boolean isIdentifyAvailabe();
		public native boolean getSMARTStatus();
		public native long getPowerOn();
		public native long getPowerCycle();
		public native long getBadSectors();
		public native long getTemperature();

		public native String toString();
	}

	/**
	 * Open the given device, and produce an SkDisk object.
	 * This creates a specialized SkDisk object using the underlying
	 * JNI wrapper code, giving an interface to the libatasmart
	 * library methods.
	 *
	 * The path given in this is expected to be a block device that
	 * supports SMART.
	 *
	 * @param path Path to disk device
	 * @return SkDisk SkDisk device interface object
	 */
	public native SkDisk open(String path);
}

Add header docs for open

docs: Add header docs for open


package net.minecraft.world.biome;

import net.minecraft.entity.EntityLiving;

public class SpawnListEntry {
    public SpawnListEntry(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max) {
        this.field_76300_b = entityClass;
        this.field_76292_a = weightedProb;
        this.field_76301_c = min;
        this.field_76299_d = max;

    }

    public Class<? extends EntityLiving> field_76300_b;
    int field_76292_a;
    int field_76301_c;
    int field_76299_d;
}

package net.minecraft.world.biome;

import net.minecraft.entity.EntityLiving;

public class SpawnListEntry {
    public SpawnListEntry(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max) {
        this.field_76300_b = entityClass;
        this.field_76292_a = weightedProb;
        this.field_76301_c = min;
        this.field_76299_d = max;

    }

    public Class<? extends EntityLiving> field_76300_b;
    public int field_76292_a;
    public int field_76301_c;
    public int field_76299_d;
}

Fix spawn list fields visibility (438)

Fix spawn list fields visibility (438)


package sword.langbook3.android.sqlite;

import sword.database.DbColumn;
import sword.database.DbValue;

public final class SqliteUtils {

    private SqliteUtils() {
    }

    public static String sqlType(DbColumn column) {
        if (column.isPrimaryKey()) {
            return "INTEGER PRIMARY KEY AUTOINCREMENT";
        }
        else if (column.isUnique()) {
            return "TEXT UNIQUE ON CONFLICT IGNORE";
        }
        else if (column.isText()) {
            return "TEXT";
        }
        else {
            return "INTEGER";
        }
    }

    public static String sqlValue(DbValue value) {
        return value.isText()? "'" + value.toText() + '\'' : Integer.toString(value.toInt());
    }
}

package sword.langbook3.android.sqlite;

import sword.database.DbColumn;
import sword.database.DbValue;

public final class SqliteUtils {

    private SqliteUtils() {
    }

    public static String sqlType(DbColumn column) {
        if (column.isPrimaryKey()) {
            return "INTEGER PRIMARY KEY AUTOINCREMENT";
        }
        else {
            final String typeName = column.isText()? "TEXT" : "INTEGER";
            return column.isUnique()? typeName + " UNIQUE ON CONFLICT IGNORE" : typeName;
        }
    }

    public static String sqlValue(DbValue value) {
        return value.isText()? "'" + value.toText() + '\'' : Integer.toString(value.toInt());
    }
}

Allow having unique integer columns in the database


package org.projectodd.nodej;

import java.io.FileNotFoundException;

import org.dynjs.runtime.DynJS;
import org.dynjs.runtime.GlobalObject;
import org.dynjs.vertx.DynJSVerticleFactory;
import org.vertx.java.core.Vertx;
import org.vertx.java.platform.Container;

public class NodeJSVerticleFactory extends DynJSVerticleFactory {

    private Process process;

    @Override
    public void init(Vertx vertx, Container container, ClassLoader classloader) {
        super.init(vertx, container, classloader);
        DynJS runtime = this.getRuntime();
        GlobalObject global = runtime.getExecutionContext().getGlobalObject();
        process = new Process(global, null);
        runtime.getConfig().setGlobalObjectFactory(new NodeJSGlobalObjectFactory());
        try {
            loadScript(getRuntime().getExecutionContext(), "node.js");
        } catch (FileNotFoundException e) {
            System.err.println("Cannot initialize NodeJ");
            e.printStackTrace();
        }
    }

    private class NodeJSGlobalObjectFactory extends DynJSGlobalObjectFactory {
        @Override
        public GlobalObject newGlobalObject(final DynJS runtime) {
            GlobalObject global = super.newGlobalObject(runtime);
            global.defineReadOnlyGlobalProperty("process", process);
            return global;
        }
    }

}

package org.projectodd.nodej;

import java.io.FileNotFoundException;

import org.dynjs.runtime.DynJS;
import org.dynjs.runtime.ExecutionContext;
import org.dynjs.runtime.GlobalObject;
import org.dynjs.vertx.DynJSVerticleFactory;
import org.vertx.java.core.Vertx;
import org.vertx.java.platform.Container;

public class NodeJSVerticleFactory extends DynJSVerticleFactory {

    @Override
    public void init(Vertx vertx, Container container, ClassLoader classloader) {
        super.init(vertx, container, classloader);
        DynJS runtime = this.getRuntime();
        ExecutionContext context = runtime.getExecutionContext();
        runtime.getConfig().setGlobalObjectFactory(new NodeJSGlobalObjectFactory(context));
        try {
            loadScript(context, "node.js");
        } catch (FileNotFoundException e) {
            System.err.println("Cannot initialize NodeJ");
            e.printStackTrace();
        }
    }

    private class NodeJSGlobalObjectFactory extends DynJSGlobalObjectFactory {
        private Process process;

        NodeJSGlobalObjectFactory(ExecutionContext context) {
            process = new Process(context.getGlobalObject(), null);
        }

        @Override
        public GlobalObject newGlobalObject(final DynJS runtime) {
            GlobalObject global = super.newGlobalObject(runtime);
            global.defineReadOnlyGlobalProperty("process", process);
            return global;
        }
    }

}

Make the global object factory responsible for creating the Process object.


package com.groupon.seleniumgridextras.utilities;

import org.junit.Test;

import java.net.ConnectException;
import java.net.URL;
import java.net.UnknownHostException;

import static org.junit.Assert.assertEquals;

/**
 * Created with IntelliJ IDEA. User: dima Date: 7/8/14 Time: 4:09 PM To change this template use
 * File | Settings | File Templates.
 */
public class HttpUtilityTest {

  @Test(expected=ConnectException.class)
  public void testConnectionRefusedError() throws Exception {
    HttpUtility.getRequest(new URL("http://localhost:9999")).getResponseCode();
  }

  @Test
  public void test404Page() throws Exception {
    assertEquals(404, HttpUtility.getRequest(new URL("http://xkcd.com/404")).getResponseCode());
  }

  @Test
  public void test200Page() throws Exception {
    assertEquals(200, HttpUtility.getRequest(new URL("http://google.com")).getResponseCode());
  }

  @Test(expected = UnknownHostException.class)
  public void testUnknownHost() throws Exception {
    HttpUtility.getRequest(new URL("http://googasdfasfdkjashfdkjahsfdle.com/")).getResponseCode();
  }

  @Test
  public void testGetAsString() throws Exception{
    assertEquals("", HttpUtility.getRequestAsString(new URL("http://xkcd.com/404")));
  }
}

package com.groupon.seleniumgridextras.utilities;

import org.junit.Test;

import java.net.ConnectException;
import java.net.ServerSocket;
import java.net.URL;
import java.net.UnknownHostException;

import static org.junit.Assert.assertEquals;

public class HttpUtilityTest {

  @Test(expected = ConnectException.class)
  public void testConnectionRefusedError() throws Exception {
    ServerSocket serverSocket = new ServerSocket(0);
    int port = serverSocket.getLocalPort();
    serverSocket
        .close(); //Find a garanteed open port by taking one and closing. Why doesn't Java allow me to get a list of open ports?
    HttpUtility.getRequest(new URL("http://localhost:" + port)).getResponseCode();
  }

  @Test
  public void test404Page() throws Exception {
    assertEquals(404, HttpUtility.getRequest(new URL("http://xkcd.com/404")).getResponseCode());
  }

  @Test
  public void test200Page() throws Exception {
    assertEquals(200, HttpUtility.getRequest(new URL("http://google.com")).getResponseCode());
  }

  @Test(expected = UnknownHostException.class)
  public void testUnknownHost() throws Exception {
    HttpUtility.getRequest(new URL("http://googasdfasfdkjashfdkjahsfdle.com/")).getResponseCode();
  }

  @Test
  public void testGetAsString() throws Exception {
    assertEquals("", HttpUtility.getRequestAsString(new URL("http://xkcd.com/404")));
  }
}

Fix an issue where the port 9999 might be occupied thus the test fails. Now the test finds a garanteed emtpy port.


package nodomain.freeyourgadget.gadgetbridge.database.schema;

import android.database.sqlite.SQLiteDatabase;

import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
import nodomain.freeyourgadget.gadgetbridge.database.DBUpdateScript;

import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_PROVIDER;
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_STEPS;
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_TIMESTAMP;
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.TABLE_STEPS_PER_DAY;

/**
 * Adds a table "STEPS_PER_DAY".
 */
public class ActivityDBUpdate_6 implements DBUpdateScript {
    @Override
    public void upgradeSchema(SQLiteDatabase db) {
        String CREATE_STEPS_PER_DAY_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_STEPS_PER_DAY + " ("
                + KEY_TIMESTAMP + " INT,"
                + KEY_PROVIDER + " TINYINT,"
                + KEY_STEPS + " TINYINT,"
                + " PRIMARY KEY (" + KEY_TIMESTAMP + "," + KEY_PROVIDER + ") ON CONFLICT REPLACE)" + DBHelper.getWithoutRowId();
        db.execSQL(CREATE_STEPS_PER_DAY_TABLE);
    }

    @Override
    public void downgradeSchema(SQLiteDatabase db) {
        DBHelper.dropTable(TABLE_STEPS_PER_DAY, db);
    }
}

package nodomain.freeyourgadget.gadgetbridge.database.schema;

import android.database.sqlite.SQLiteDatabase;

import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
import nodomain.freeyourgadget.gadgetbridge.database.DBUpdateScript;

import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_PROVIDER;
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_STEPS;
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_TIMESTAMP;
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.TABLE_STEPS_PER_DAY;

/**
 * Adds a table "STEPS_PER_DAY".
 */
public class ActivityDBUpdate_6 implements DBUpdateScript {
    @Override
    public void upgradeSchema(SQLiteDatabase db) {
        String CREATE_STEPS_PER_DAY_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_STEPS_PER_DAY + " ("
                + KEY_TIMESTAMP + " INT,"
                + KEY_PROVIDER + " TINYINT,"
                + KEY_STEPS + " MEDIUMINT,"
                + " PRIMARY KEY (" + KEY_TIMESTAMP + "," + KEY_PROVIDER + ") ON CONFLICT REPLACE)" + DBHelper.getWithoutRowId();
        db.execSQL(CREATE_STEPS_PER_DAY_TABLE);
    }

    @Override
    public void downgradeSchema(SQLiteDatabase db) {
        DBHelper.dropTable(TABLE_STEPS_PER_DAY, db);
    }
}

Use MEDIUMINT for steps per day (no effect, not used, and ignored by sqlite)


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

package org.gradle.internal.fingerprint;

import org.gradle.api.file.FileVisitor;
import org.gradle.api.internal.file.FileTreeInternal;
import org.gradle.internal.snapshot.FileSystemSnapshot;

/**
 * A snapshotter for generic file trees, which are not based on a directory on disk.
 *
 * This is needed to build a Merkle directory tree from the elements of a file tree obtained by {@link org.gradle.api.file.FileTree#visit(FileVisitor)}.
 */
public interface GenericFileTreeSnapshotter {
    FileSystemSnapshot snapshotFileTree(FileTreeInternal tree);
}

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

package org.gradle.internal.fingerprint;

import org.gradle.api.file.FileVisitor;
import org.gradle.api.internal.file.FileTreeInternal;
import org.gradle.internal.snapshot.FileSystemSnapshot;

/**
 * A snapshotter for generic file trees, which are not based on a directory on disk.
 *
 * Examples of a generic file tree is a {@link org.gradle.api.internal.file.archive.TarFileTree} backed by a non-file resource.
 * This is needed to build a Merkle directory tree from the elements of a file tree obtained by {@link org.gradle.api.file.FileTree#visit(FileVisitor)}.
 */
public interface GenericFileTreeSnapshotter {
    FileSystemSnapshot snapshotFileTree(FileTreeInternal tree);
}

Add example for generic file tree to Javadoc

`SingletonFileTree`s aren't generic file trees.


package com.davidmogar.njc.ast.types;

import com.davidmogar.njc.visitors.Visitor;
import com.davidmogar.njc.ast.AbstractAstNode;

public class StringType extends AbstractType implements Type {

    private static StringType instance;

    private StringType(int line, int column) {
        super(line, column);
    }

    public static StringType getInstance(int line, int column) {
        if (instance == null) {
            instance = new StringType(line, column);
        }

        return instance;
    }

    @Override
    public Object accept(Visitor visitor, Object object) {
        return visitor.visit(this, object);
    }

}

package com.davidmogar.njc.ast.types;

import com.davidmogar.njc.TypeError;
import com.davidmogar.njc.visitors.Visitor;
import com.davidmogar.njc.ast.AbstractAstNode;

public class StringType extends AbstractType implements Type {

    private static StringType instance;

    private StringType(int line, int column) {
        super(line, column);
    }

    public static StringType getInstance(int line, int column) {
        if (instance == null) {
            instance = new StringType(line, column);
        }

        return instance;
    }

    @Override
    public Object accept(Visitor visitor, Object object) {
        return visitor.visit(this, object);
    }

}

Remove code added in a previous commit

Remove code added in a previous commit

String literals shouldn't be assignable.


package com.packtpublishing.tddjava.friendships;

import org.jongo.marshall.jackson.oid.Id;

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

/**
 * This class holds person declaration and the list of friends
 */
public class Person {
    @Id
    private String name;

    private List<String> friends;

    public Person() { }

    public Person(String name) {
        this.name = name;
        friends = new ArrayList<>();
    }

    public List<String> getFriends() {
        return friends;
    }

    public void addFriend(String friend) {
        if (!friends.contains(friend)) friends.add(friend);
    }

    @Override
    public String toString() {
        return String.format("NAME: %1$s FRIENDS: %2$s", name, friends);
    }
}

package com.packtpublishing.tddjava.friendships;

import org.jongo.marshall.jackson.oid.Id;

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

/**
 * This class holds person declaration and the list of friends
 */
public class Person {
    @Id
    private String name;

    private List<String> friends;

    public Person() { }

    public Person(String name) {
        this.name = name;
        friends = new ArrayList<String>();
    }

    public List<String> getFriends() {
        return friends;
    }

    public void addFriend(String friend) {
        if (!friends.contains(friend)) friends.add(friend);
    }

    @Override
    public String toString() {
        return String.format("NAME: %1$s FRIENDS: %2$s", name, friends);
    }
}

Use generic type instead of diamond operator for Java 6 compatibility


package jannotate.beans;

import jannotate.domain.Annotation;

import java.util.List;

import javax.annotation.Resource;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Transient;
import javax.ejb.*;

@Stateless
public class AnnotationEjb {

	@PersistenceContext
	EntityManager em;

	public List<Annotation> getAnnotations() {
		return (List<Annotation>) em.createQuery(
			"SELECT a FROM Annotation a order by a.api, a.name").getResultList();
	}

	@TransactionAttribute(TransactionAttributeType.REQUIRED)
	public String addEntry(Annotation instance) {
		System.out.println("AnnotationEjb.addEntry():" + instance);
		em.persist(instance);
		return "index";
	}
}

package jannotate.beans;

import jannotate.domain.Annotation;

import java.util.List;

import javax.annotation.Resource;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Transient;
import javax.ejb.*;

@Stateless
public class AnnotationEjb {

	@PersistenceContext
	EntityManager em;

	@TransactionAttribute()
	public List<Annotation> getAnnotations() {
		return (List<Annotation>) em.createQuery(
			"SELECT a FROM Annotation a order by a.api, a.name").getResultList();
	}

	@TransactionAttribute(TransactionAttributeType.REQUIRED)
	public String addEntry(Annotation instance) {
		System.out.println("AnnotationEjb.addEntry():" + instance);
		em.persist(instance);
		return "index";
	}
}

Add dummy @TransactionAttribute on read method.


package bakatxt.core;

import java.awt.GraphicsEnvironment;
import java.util.LinkedList;
import java.util.Scanner;

import bakatxt.gui.BakaUI;

public class BakaTxtMain {

    private static final String MESSAGE_WELCOME = "Welcome To BakaTxt!";
    private static final String MESSAGE_BYEBYE = "Bye bye!";
    private static final String MESSAGE_ENTER_COMMAND = "Please enter command: ";
    private static final String MESSAGE_INVALID_COMMAND = "Invalid Command!";

    private static Scanner _sc;
    private static BakaParser _parser;
    private static Database _database;
    private static LinkedList<Task> _displayTasks;
    private static BakaProcessor _processor;

    public BakaTxtMain() {

        _sc = new Scanner(System.in);
        _parser = BakaParser.getInstance();
        _database = Database.getInstance();
        _displayTasks = _database.getAllTasks();
        _processor = new BakaProcessor();
    }

    public static void main(String[] args) {

        if (GraphicsEnvironment.isHeadless()) {
            BakaTxtMain thisSession = new BakaTxtMain();

            System.out.println(MESSAGE_WELCOME);

            while (true) {
                System.out.print(MESSAGE_ENTER_COMMAND);
                String input = _sc.nextLine();
                String result = _processor.executeCommand(input);
                System.out.println(result);
            }
        }
        BakaUI.startGui();
    }

}

package bakatxt.core;

import java.awt.GraphicsEnvironment;
import java.util.Scanner;

import bakatxt.gui.BakaUI;

public class BakaTxtMain {

    private static Scanner _sc;
    private static BakaProcessor _processor;

    public BakaTxtMain() {

        _sc = new Scanner(System.in);
        _processor = new BakaProcessor();
    }

    public static void main(String[] args) {

        if (GraphicsEnvironment.isHeadless()) {
            BakaTxtMain thisSession = new BakaTxtMain();

            while (true) {
                String input = _sc.nextLine();
                String result = _processor.executeCommand(input);
                System.out.println(result);
            }
        }
        BakaUI.startGui();
    }

}

Remove unused command line interface messages and instances in the main


package org.dstadler.jgit;

import org.dstadler.jgit.helper.CookbookHelper;
import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevWalk;
import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertNotNull;

/**
 * Tests which show issues with JGit that we reported upstream.
 */
public class JGitBugTest {
    @Test
    public void testRevWalkDisposeClosesReader() throws IOException {
        try (Repository repo = CookbookHelper.openJGitCookbookRepository()) {
            try (ObjectReader reader = repo.newObjectReader()) {
                try (RevWalk walk = new RevWalk(reader)) {
                    walk.dispose();

                    Ref head = repo.exactRef("refs/heads/master");
                    System.out.println("Found head: " + head);

                    ObjectLoader loader = reader.open(head.getObjectId());
                    assertNotNull(loader);
                }
            }
        }
    }
}

package org.dstadler.jgit;

import org.dstadler.jgit.helper.CookbookHelper;
import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevWalk;
import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertNotNull;

/**
 * Tests which show issues with JGit that we reported upstream.
 */
public class JGitBugTest {
    @Test
    public void testRevWalkDisposeClosesReader() throws IOException {
        try (Repository repo = CookbookHelper.openJGitCookbookRepository()) {
            try (ObjectReader reader = repo.newObjectReader()) {
                assertNotNull("Need to get back an ObjectReader", reader);
                try (RevWalk walk = new RevWalk(reader)) {
                    walk.dispose();

                    Ref head = repo.exactRef("refs/heads/master");
                    System.out.println("Found head: " + head);
                    assertNotNull("Need to find head on master-branch", head);

                    ObjectLoader loader = reader.open(head.getObjectId());
                    assertNotNull(loader);
                }
            }
        }
    }
}

Add additional assertions to fail test earlier on null responses


package com.haxademic.core.app;

import javax.media.opengl.GL;

import processing.core.PApplet;

@SuppressWarnings("serial")
public class P
extends PApplet {
	public static PAppletHax p;
	public static GL gl;
	public static String SUNFLOW = "hipstersinc.P5Sunflow";
}

package com.haxademic.core.app;

import javax.media.opengl.GL;

import processing.core.PApplet;

@SuppressWarnings("serial")
public class P
extends PApplet {
	public static PAppletHax p;
	public static GL gl;
}

Remove very old sunflow renderer string

Remove very old sunflow renderer string


package squeek.veganoption.blocks;

import net.minecraft.block.material.Material;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidFinite;
import net.minecraftforge.fluids.Fluid;

public class BlockRawEnder extends BlockFluidFinite
{
	public static Material materialRawEnder = Material.WATER;

	public BlockRawEnder(Fluid fluid)
	{
		super(fluid, materialRawEnder);
	}

	@Override
	public boolean canDisplace(IBlockAccess world, BlockPos pos)
	{
		//if (world.getBlock(x, y, z).getMaterial().isLiquid())
		//	return false;
		return super.canDisplace(world, pos);
	}

	@Override
	public boolean displaceIfPossible(World world, BlockPos pos)
	{
		//if (world.getBlock(x, y, z).getMaterial().isLiquid())
		//	return false;
		return super.displaceIfPossible(world, pos);
	}
}

package squeek.veganoption.blocks;

import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.material.Material;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidFinite;
import net.minecraftforge.fluids.Fluid;

public class BlockRawEnder extends BlockFluidFinite
{
	public static Material materialRawEnder = Material.WATER;

	public BlockRawEnder(Fluid fluid)
	{
		super(fluid, materialRawEnder);
		this.setDefaultState(blockState.getBaseState().withProperty(LEVEL, 7));
	}

	@Override
	public boolean canDisplace(IBlockAccess world, BlockPos pos)
	{
		//if (world.getBlock(x, y, z).getMaterial().isLiquid())
		//	return false;
		return super.canDisplace(world, pos);
	}

	@Override
	public boolean displaceIfPossible(World world, BlockPos pos)
	{
		//if (world.getBlock(x, y, z).getMaterial().isLiquid())
		//	return false;
		return super.displaceIfPossible(world, pos);
	}
}

Fix raw ender buckets not creating full fluid blocks in the world


package sg.ncl.testbed_interface.domain;

/**
 * The {@link Credentials} interface represents the credentials of a {@link User}.
 * @author Christopher Zhong
 */
public interface Credentials {

    /**
     * Returns the username.
     * @return the username.
     */
    String getUsername();

    /**
     * Returns the password.
     * @return the password.
     */
    String getPassword();

    /**
     * Returns the hash type.
     * @return the hash type.
     */
    String getHashType();

}

package sg.ncl.testbed_interface.domain;

/**
 * The {@link Credentials} interface represents the credentials of a {@link User}.
 * @author Christopher Zhong
 */
public interface Credentials {

    /**
     * Returns the username.
     * @return the username.
     */
    String getUsername();

    /**
     * Returns the password.
     * @return the password.
     */
    String getPassword();

    /**
     * Returns the hashing algorithm.
     * @return the hashing algorithm.
     */
    String getHashingAlgorithm();

}

Rename `getHashType` to `getHashingAlgorithm` (DEV-15)


package com.vtence.molecule;

import com.vtence.molecule.middlewares.NotFound;
import com.vtence.molecule.middlewares.URLMap;

import java.util.function.Consumer;

public class MiddlewareStack {

    private Middleware pipeline = Middleware.identity();
    private URLMap map;
    private Application runner;
    private Consumer<Application> warmup;

    public MiddlewareStack use(Middleware middleware) {
        if (map != null) {
            pipeline = pipeline.andThen(map);
            map = null;
        }
        pipeline = pipeline.andThen(middleware);
        return this;
    }

    public MiddlewareStack mount(String path, Application app) {
        if (map == null) {
            map = new URLMap();
        }
        map.mount(path, app);
        return this;
    }

    public MiddlewareStack warmup(Consumer<Application> warmup) {
        this.warmup = warmup;
        return this;
    }

    public MiddlewareStack run(Application runner) {
        this.runner = runner;
        return this;
    }

    public Application boot() {
        if (map == null && runner == null) {
            throw new IllegalStateException("No app or mount points defined");
        }

        if (map != null) {
            pipeline = pipeline.andThen(map);
        }

        Application app = pipeline.then(runner != null ? runner : new NotFound());
        if (warmup != null) warmup.accept(app);
        return app;
    }
}

package com.vtence.molecule;

import com.vtence.molecule.middlewares.NotFound;
import com.vtence.molecule.middlewares.URLMap;

import java.util.function.Consumer;

public class MiddlewareStack {

    private Middleware pipeline = Middleware.identity();
    private URLMap map;
    private Application runner;
    private Consumer<Application> warmup;

    public MiddlewareStack use(Middleware middleware) {
        if (map != null) {
            pipeline = pipeline.andThen(map);
            map = null;
        }
        pipeline = pipeline.andThen(middleware);
        return this;
    }

    public MiddlewareStack mount(String path, Application app) {
        if (map == null) {
            map = new URLMap();
        }
        map.mount(path, app);
        return this;
    }

    public MiddlewareStack warmup(Consumer<Application> warmup) {
        this.warmup = warmup;
        return this;
    }

    public MiddlewareStack run(Application runner) {
        this.runner = runner;
        return this;
    }

    public Application boot() {
        if (map == null && runner == null) {
            throw new IllegalStateException("No app or mount points defined");
        }

        Middleware chain = map != null ? pipeline.andThen(map) : pipeline;
        Application app = chain.then(runner != null ? runner : new NotFound());
        if (warmup != null) warmup.accept(app);
        return app;
    }
}

Remove side effect when booting middleware stack

See #64


package com.langpath.service.api;

import com.langpath.sql.model.entity.User;

/**
 * Created by sjakowski on 2016-03-16.
 */
public class UserService implements UserServiceApi {

    @Override
    public void save(User user) {
        long value1 = 2l;
        int value2 = 2;

        if(value1==value2) {
            System.out.println("It works :)");
        }
    }
}

package com.langpath.service.api;

import com.langpath.sql.model.entity.User;

/**
 * Created by sjakowski on 2016-03-16.
 */
public class UserService implements UserServiceApi {

    @Override
    public void save(User user) {
        String castException = (String) user;
    }
}

Add some test for findBug tools

Add some test for findBug tools


/*
 * Copyright 1999-2018 Alibaba Group Holding Ltd.
 *
 * 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.alibaba.nacos.common.util;

/**
 * @author nkorange
 * @since 0.8.0
 */
public class HttpMethod {

    public static final String GET = "GET";

    public static final String HEAD = "HEAD";

    public static final String POST = "POST";

    public static final String PUT = "PUT";

    public static final String PATCH = "PATCH";

    public static final String DELETE = "DELETE";

    public static final String OPTIONS = "PATCH";

    public static final String TRACE = "TRACE";
}

/*
 * Copyright 1999-2018 Alibaba Group Holding Ltd.
 *
 * 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.alibaba.nacos.common.util;

/**
 * @author nkorange
 * @since 0.8.0
 */
public class HttpMethod {

    public static final String GET = "GET";

    public static final String HEAD = "HEAD";

    public static final String POST = "POST";

    public static final String PUT = "PUT";

    public static final String PATCH = "PATCH";

    public static final String DELETE = "DELETE";

    public static final String OPTIONS = "OPTIONS";

    public static final String TRACE = "TRACE";
}

Fix HTTP method value error

Fix HTTP method value error


package com.example.tools.timber;

import android.util.Log;
import com.crashlytics.android.Crashlytics;
import timber.log.Timber;

import javax.annotation.Nullable;

/**
 * A logging tree that logs {@link Timber#wtf} methods to crashlytics. This tree does not log to logcat at all.
 */
public class CrashlyticsTree extends Timber.Tree {

    @Override
    protected boolean isLoggable(String tag, int priority) {
        return priority == Log.ASSERT;
    }

    @Override
    protected void log(int priority, @Nullable String tag, @Nullable String message, @Nullable Throwable throwable) {
        if (isLoggable(tag, priority)) {
            if (throwable != null) {
                Crashlytics.logException(throwable);
            }
            if (message != null) {
                Crashlytics.log(message);
            }
        }
    }

}

package com.example.tools.timber;

import android.util.Log;
import com.crashlytics.android.Crashlytics;
import timber.log.Timber;

import javax.annotation.Nullable;

/**
 * A logging tree that logs {@link Timber#wtf} methods to crashlytics. This tree does not log to logcat at all.
 */
public class CrashlyticsTree extends Timber.Tree {

    @Override
    protected boolean isLoggable(@Nullable String tag, int priority) {
        return priority == Log.ASSERT;
    }

    @Override
    protected void log(int priority, @Nullable String tag, @Nullable String message, @Nullable Throwable throwable) {
        if (isLoggable(tag, priority)) {
            if (throwable != null) {
                Crashlytics.logException(throwable);
            }
            if (message != null) {
                Crashlytics.log(message);
            }
        }
    }

}

Make tag @Nullable in isLoggable

Make tag @Nullable in isLoggable


package org.innovateuk.ifs.commons.security;

import org.innovateuk.ifs.activitylog.advice.TestActivityLogServiceImpl;
import org.innovateuk.ifs.security.AbstractDataServiceSecurityAnnotationsTest;
import org.innovateuk.ifs.security.StatelessAuthenticationFilter;

import java.util.List;

import static java.util.Arrays.asList;

public class DataServiceSecurityAnnotationsTest extends AbstractDataServiceSecurityAnnotationsTest {

    @Override
    protected List<Class<?>> additionalExcludedClasses() {
        return asList(StatelessAuthenticationFilter.class, TestActivityLogServiceImpl.class);
    }
}

package org.innovateuk.ifs.commons.security;

import org.innovateuk.ifs.activitylog.advice.TestActivityLogServiceImpl;
import org.innovateuk.ifs.security.AbstractDataServiceSecurityAnnotationsTest;
import org.innovateuk.ifs.security.StatelessAuthenticationFilter;
import springfox.documentation.schema.property.ModelSpecificationFactory;

import java.util.List;

import static java.util.Arrays.asList;

public class DataServiceSecurityAnnotationsTest extends AbstractDataServiceSecurityAnnotationsTest {

    @Override
    protected List<Class<?>> additionalExcludedClasses() {
        return asList(StatelessAuthenticationFilter.class,
                TestActivityLogServiceImpl.class, ModelSpecificationFactory.class);
    }
}

[IFS-9682] Add new endpoint with body and enable swagger-ui via 'swagger' Profile