package com.github.tuxdude.yani.network;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.WifiManager;
import android.widget.Toast;

import com.github.tuxdude.yani.utils.Logger;

public class NetworkBroadcastListener extends BroadcastReceiver {

    private static NetworkBroadcastListener instance = null;

    @Override
    public void onReceive(Context context, Intent intent) {
        Logger.trace();
        if (intent.getAction().equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
            Toast.makeText(context, "Airplane Mode Changed!", Toast.LENGTH_LONG).show();
            Logger.d("Airplane Mode Changed");
        }
        else if (intent.getAction().equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
            Toast.makeText(context, "Wifi State Changed!", Toast.LENGTH_LONG).show();
            Logger.d("Wifi State Changed");
        }
        else if (intent.getAction().equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
            Toast.makeText(context, "Network State Changed!", Toast.LENGTH_LONG).show();
            Logger.d("Network State Changed");
        }
        else {
            Logger.d("Unhandled intent: " + intent.getAction().toString());
        }
    }

    private NetworkBroadcastListener() {
        // Empty constructor
    }

    public static NetworkBroadcastListener getInstance() {
        if (instance == null) {
            instance = new NetworkBroadcastListener();
        }
        return instance;
    }
}

package com.github.tuxdude.yani.network;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.WifiManager;
import android.widget.Toast;

import com.github.tuxdude.yani.utils.Logger;

public class NetworkBroadcastListener extends BroadcastReceiver {

    private static NetworkBroadcastListener instance = null;

    @Override
    public void onReceive(Context context, Intent intent) {
        Logger.trace();
        if (intent.getAction().equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
            //Toast.makeText(context, "Airplane Mode Changed!", Toast.LENGTH_LONG).show();
            Logger.d("Airplane Mode Changed");
        }
        else if (intent.getAction().equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
            //Toast.makeText(context, "Wifi State Changed!", Toast.LENGTH_LONG).show();
            Logger.d("Wifi State Changed");
        }
        else if (intent.getAction().equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
            //Toast.makeText(context, "Network State Changed!", Toast.LENGTH_LONG).show();
            Logger.d("Network State Changed");
        }
        else {
            Logger.d("Unhandled intent: " + intent.getAction().toString());
        }
    }

    private NetworkBroadcastListener() {
        // Empty constructor
    }

    public static NetworkBroadcastListener getInstance() {
        if (instance == null) {
            instance = new NetworkBroadcastListener();
        }
        return instance;
    }
}

Disable toasts for network broadcast events.


package flickr.demo.qvdev.com.flickrdemo;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

import flickr.demo.qvdev.com.flickrdemo.dummy.DummyContent;

class FlickrItemRecyclerViewAdapter
        extends RecyclerView.Adapter<FlickrViewHolder> {

    private final List<DummyContent.DummyItem> mItems;

    FlickrItemRecyclerViewAdapter(List<DummyContent.DummyItem> items) {
        mItems = items;
    }

    @Override
    public FlickrViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.flickritem_list_content, parent, false);
        return new FlickrViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final FlickrViewHolder holder, int position) {
        holder.mItem = mItems.get(position);
        holder.mIdView.setText(mItems.get(position).id);
        holder.mContentView.setText(mItems.get(position).content);
    }

    @Override
    public int getItemCount() {
        return mItems.size();
    }
}

package flickr.demo.qvdev.com.flickrdemo;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

import flickr.demo.qvdev.com.flickrdemo.dummy.DummyContent;

class FlickrItemRecyclerViewAdapter
        extends RecyclerView.Adapter<FlickrViewHolder> {

    private final List<DummyContent.DummyItem> mItems;

    FlickrItemRecyclerViewAdapter(List<DummyContent.DummyItem> items) {
        mItems = items;
    }

    @Override
    public FlickrViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.flickritem_list_content, parent, false);
        return new FlickrViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final FlickrViewHolder holder, int position) {
        holder.mIdView.setText(mItems.get(position).id);
        holder.mContentView.setText(mItems.get(position).content);
    }

    @Override
    public int getItemCount() {
        return mItems.size();
    }
}

Remove holder item as not used anymore


package org.intermine.webservice.server.lists;

import java.io.IOException;

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

import org.intermine.api.InterMineAPI;
import org.intermine.web.context.InterMineContext;

public class AvailableListsServlet extends HttpServlet
{
    /**
     * Serialisation constant.
     */
    private static final long serialVersionUID = 1L;

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        getAvailableLists(request, response);
    }

    private void getAvailableLists(HttpServletRequest request, HttpServletResponse response) {
        final InterMineAPI im = InterMineContext.getInterMineAPI();
        new AvailableListsService(im).service(request, response);
    }

    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        saveUploadedList(request, response);
    }

    private void saveUploadedList(HttpServletRequest request, HttpServletResponse response) {
        final InterMineAPI im = InterMineContext.getInterMineAPI();
        new ListUploadService(im).service(request, response);
    }

    @Override
    public void doDelete(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        deleteList(request, response);
    }

    private void deleteList(HttpServletRequest request, HttpServletResponse response) {
        final InterMineAPI im = InterMineContext.getInterMineAPI();
        new ListDeletionService(im).service(request, response);
    }

}

package org.intermine.webservice.server.lists;

import org.intermine.webservice.server.WebService;
import org.intermine.webservice.server.core.NoServiceException;
import org.intermine.webservice.server.core.WebServiceServlet;

public class AvailableListsServlet extends WebServiceServlet
{
    private static final long serialVersionUID = 1L;

    @Override
    protected WebService getService(Method method) throws NoServiceException {
        switch (method) {
        case GET:
            return new AvailableListsService(api);
        case POST:
            return new ListUploadService(api);
        case DELETE:
            return new ListDeletionService(api);
        default:
            throw new NoServiceException();
        }
    }

}

Use the new WebServiceServlet framework


package org.spoofax.jsglr2.recovery;

import org.spoofax.jsglr2.parser.Position;

public class RecoveryJob {

    public Position position;
    public int iteration;
    public int quota;

    public RecoveryJob(Position position) {
        this.position = position;
        this.iteration = 0;
    }

    boolean hasNextIteration() {
        return iteration < 3;
    }

    int nextIteration() {
        quota = iteration++;

        return iteration;
    }

}

package org.spoofax.jsglr2.recovery;

import org.spoofax.jsglr2.parser.Position;

public class RecoveryJob {

    public Position position;
    public int iteration;
    public int quota;

    public RecoveryJob(Position position) {
        this.position = position;
        this.iteration = 0;
    }

    boolean hasNextIteration() {
        return iteration < 3;
    }

    int nextIteration() {
        quota = ++iteration;

        return iteration;
    }

}

Fix that first recovery iterations have quota


package orc.runtime.regions;

import orc.runtime.Token;

public class SemiRegion extends Region {

	Region parent;
	Token t;

	/* Create a new group region with the given parent and coupled group cell */
	public SemiRegion(Region parent, Token t) {
		this.parent = parent;
		this.t = t;
		this.parent.add(this);
	}

	protected void reallyClose(Token closer) {
		if (t != null) {
			t.getTracer().after(closer.getTracer().before());
			t.setPending();
			t.activate();
		}
		parent.remove(this, closer);
	}

	public Region getParent() {
		return parent;
	}

	public void cancel() {
		if (t != null) {
			t.die();
			t = null;
		}
	}
}

package orc.runtime.regions;

import orc.runtime.Token;

public class SemiRegion extends Region {

	Region parent;
	Token t;

	/* Create a new group region with the given parent and coupled group cell */
	public SemiRegion(Region parent, Token t) {
		this.parent = parent;
		this.t = t;
		this.parent.add(this);
	}

	protected void reallyClose(Token closer) {
		if (t != null) {
			t.getTracer().after(closer.getTracer().before());
			t.setPending();
			t.activate();
		}
		parent.remove(this, closer);
	}

	public Region getParent() {
		return parent;
	}

	public void cancel() {
		if (t != null) {
			// setPending so that the token can unsetPending when it
			// dies
			t.setPending();
			t.die();
			t = null;
		}
	}
}

Fix crash bug with new semicolon semantics.


package io.github.classgraph.issues;

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

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

import org.junit.Test;

import io.github.classgraph.ClassGraph;

public class TestGetUniqueClasspathElements {
    @Test
    public void testGetUniqueClasspathElements() {
        final List<File> classpathElements = new ClassGraph().whitelistPackages("com.xyz").getClasspathFiles();
        assertThat(classpathElements).isNotEmpty();
    }
}

package io.github.classgraph.issues;

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

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

import org.junit.Test;

import io.github.classgraph.ClassGraph;

public class TestGetUniqueClasspathElements {
    @Test
    public void testGetUniqueClasspathElements() {
        final List<File> classpathElements = new ClassGraph().verbose().whitelistPackages("com.xyz").getClasspathFiles();
        assertThat(classpathElements).isNotEmpty();
    }
}

Add .verbose() for Travis logging


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

import java.io.IOException;

/**
 * Used to indicate a filesystem inconsistency, e.g. file 'a/b' exists but directory 'a' doesn't
 * exist. This generally means the result of the build is undefined but we shouldn't crash hard.
 */
public class InconsistentFilesystemException extends IOException {
  public InconsistentFilesystemException(String inconsistencyMessage) {
    super(
        "Inconsistent filesystem operations. "
            + inconsistencyMessage
            + " The results of the "
            + "build are not guaranteed to be correct. You should probably run 'bazel clean' and "
            + "investigate the filesystem inconsistency (likely due to filesytem updates "
            + "concurrent with the build)");
  }
}

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

import java.io.IOException;

/**
 * Used to indicate a filesystem inconsistency, e.g. file 'a/b' exists but directory 'a' doesn't
 * exist. This generally means the result of the build is undefined but we shouldn't crash hard.
 */
public class InconsistentFilesystemException extends IOException {
  public InconsistentFilesystemException(String inconsistencyMessage) {
    super(
        "Inconsistent filesystem operations. "
            + inconsistencyMessage
            + " The results of the "
            + "build are not guaranteed to be correct. You should probably run 'bazel clean' and "
            + "investigate the filesystem inconsistency (likely due to filesystem updates "
            + "concurrent with the build)");
  }
}

Fix typo (filesytem --> filesystem).


// fails
// TYPE_NOT_FOUND
// TYPE_NOT_FOUND
// TYPE_NOT_FOUND
// NAME_NOT_FOUND
// TYPE_MISMATCH

package java.util;

// import java.lang.*;
import java.io.File;
import java.io.JFile;  // fails

class A extends Object {
  String fname = "filename";
  File   file  = new java.io.File(fname);
  JFile  jfile  = new JFile(fname); /* fails four times:
                                       1- The first use of JFille
                                       2- The second use of JFille
                                       3- The missing constructor of JFille
                                       4- The unresolved types information
                                     */

  Object b1 = new Object();
  Object b2 = new Object();
  Object b3 = new Object();
  public String m(String a) {
    String s = "";
    Object b4 = new Object();
    Object b5 = new Object();
    return m(s);
  }
}

// fails
// TYPE_NOT_FOUND
// TYPE_NOT_FOUND
// TYPE_NOT_FOUND
// NAME_NOT_FOUND
// TYPE_MISMATCH

package java.util;

// import java.lang.*;
import java.io.File;
import java.io.JFile;  // fails

class A extends Object {
  String fname = "filename";
  File   file  = new java.io.File(fname);
  JFile  jfile  = new JFile(fname); /* fails four times:
                                       1- The first use of JFille
                                       2- The second use of JFille
                                       3- The missing constructor of JFille
                                       4- The unresolved types information
                                     */

  Object b1 = new Object();
  Object b2 = new Object();
  Object b3 = new Object();
  public String m(String a) {
    if("" instanceof String) {
      System.out.println("");
    }
    String s = "";
    Object b4 = new Object();
    Object b5 = new Object();
    return m(s);
  }
}

Add a test case for instanceof expressions


package org.vaadin.spring.mvp.explicit;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.vaadin.spring.UIScope;
import org.vaadin.spring.annotation.EnableVaadin;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.FooView;

@Configuration
@EnableVaadin
public class ExplicitConfig {

    @Autowired
    private EventBus eventBus;

    @Bean
    @UIScope
    public FooView fooView() {
        return new FooView();
    }

    @Bean
    @UIScope
    public ExplicitPresenter fooPresenter() {
        return new ExplicitPresenter(fooView(), eventBus);
    }
}

package org.vaadin.spring.mvp.explicit;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.vaadin.spring.annotation.EnableVaadin;
import org.vaadin.spring.annotation.VaadinUIScope;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.mvp.FooView;

@Configuration
@EnableVaadin
public class ExplicitConfig {

    @Autowired
    private EventBus eventBus;

    @Bean
    @VaadinUIScope
    public FooView fooView() {
        return new FooView();
    }

    @Bean
    @VaadinUIScope
    public ExplicitPresenter fooPresenter() {
        return new ExplicitPresenter(fooView(), eventBus);
    }
}

Test Class Update: Change UIScope => VaadinUIScope


package seedu.ezdo.model.todo;

/**
 * Represents the date associated with tasks.
 */
public abstract class TaskDate {

    public final String value;

    public static final String TASKDATE_VALIDATION_REGEX =
        "^$|([12][0-9]|3[01]|0?[1-9])/(0?[1-9]|1[012])/((?:19|20)\\d\\d)";;

    public TaskDate(String taskDate) {
        this.value = taskDate;
    }

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

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof TaskDate // instanceof handles nulls
                && this.value.equals(((TaskDate) other).value)); // state check
    }

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

    /**
     * Returns true if a given string is a valid task date.
     */
    public static boolean isValidTaskDate(String test) {
        return test.matches(TASKDATE_VALIDATION_REGEX);
    }
}

package seedu.ezdo.model.todo;

import com.joestelmach.natty.Parser;

/**
 * Represents the date associated with tasks.
 */
public abstract class TaskDate {

    public final String value;

    public static final String TASKDATE_VALIDATION_REGEX =
        "^$|([12][0-9]|3[01]|0?[1-9])/(0?[1-9]|1[012])/((?:19|20)\\d\\d)";;

    public TaskDate(String taskDate) {
    	Parser parser = new Parser();
        this.value = parser.parse(taskDate).get(0).getDates().get(0).toString();
    }

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

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof TaskDate // instanceof handles nulls
                && this.value.equals(((TaskDate) other).value)); // state check
    }

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

    /**
     * Returns true if a given string is a valid task date.
     */
    public static boolean isValidTaskDate(String test) {
        return test.matches(TASKDATE_VALIDATION_REGEX);
    }
}

Add the use of Natty in every date input


package com.splicemachine.test;

import com.splicemachine.concurrent.Threads;

import java.io.IOException;
import java.net.Socket;
import java.util.concurrent.TimeUnit;

import static java.lang.String.format;

/**
 * Waits for connections on a given host+port to be available.
 */
public class SpliceTestPlatformWait {

    private static final long MAX_WAIT_SECS = TimeUnit.SECONDS.toSeconds(90);

    /**
     * argument 0 - hostname
     * argument 1 - port
     */
    public static void main(String[] arguments) throws IOException {

        String hostname = arguments[0];
        int port = Integer.valueOf(arguments[1]);

        long startTime = System.currentTimeMillis();
        long elapsedSecs = 0;
        while (elapsedSecs < MAX_WAIT_SECS) {
            try {
                new Socket(hostname, port);
                System.out.println("\nStarted\n");
                break;
            } catch (Exception e) {
                System.out.println(format("SpliceTestPlatformWait: Not started, still waiting for '%s:%s'. %s of %s seconds elapsed.",
                        hostname, port, elapsedSecs, MAX_WAIT_SECS));
                Threads.sleep(1, TimeUnit.SECONDS);
            }
            elapsedSecs = (long) ((System.currentTimeMillis() - startTime) / 1000d);
        }
        if (elapsedSecs >= MAX_WAIT_SECS) {
            System.out.println(format("Waited %s seconds without success", MAX_WAIT_SECS));
            System.exit(-1);
        }

    }

}

package com.splicemachine.test;

import com.splicemachine.concurrent.Threads;

import java.io.IOException;
import java.net.Socket;
import java.util.concurrent.TimeUnit;

import static java.lang.String.format;

/**
 * Waits for connections on a given host+port to be available.
 */
public class SpliceTestPlatformWait {

    private static final long MAX_WAIT_SECS = TimeUnit.SECONDS.toSeconds(120);

    /**
     * argument 0 - hostname
     * argument 1 - port
     */
    public static void main(String[] arguments) throws IOException {

        String hostname = arguments[0];
        int port = Integer.valueOf(arguments[1]);

        long startTime = System.currentTimeMillis();
        long elapsedSecs = 0;
        while (elapsedSecs < MAX_WAIT_SECS) {
            try {
                new Socket(hostname, port);
                System.out.println("\nStarted\n");
                break;
            } catch (Exception e) {
                System.out.println(format("SpliceTestPlatformWait: Not started, still waiting for '%s:%s'. %s of %s seconds elapsed.",
                        hostname, port, elapsedSecs, MAX_WAIT_SECS));
                Threads.sleep(1, TimeUnit.SECONDS);
            }
            elapsedSecs = (long) ((System.currentTimeMillis() - startTime) / 1000d);
        }
        if (elapsedSecs >= MAX_WAIT_SECS) {
            System.out.println(format("Waited %s seconds without success", MAX_WAIT_SECS));
            System.exit(-1);
        }

    }

}

Increase waiting time for MapR standalone


package com.infinityraider.agricraft.plugins.minecraft;

import com.infinityraider.agricraft.api.v1.adapter.IAgriAdapter;
import com.infinityraider.agricraft.api.v1.crop.CropCapability;
import com.infinityraider.agricraft.api.v1.genetics.IAgriGenome;
import com.infinityraider.agricraft.api.v1.genetics.IAgriGenomeProvider;
import net.minecraftforge.common.capabilities.ICapabilityProvider;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Optional;

public class GenomeWrapper implements IAgriAdapter<IAgriGenome> {
    @Override
    public boolean accepts(@Nullable Object obj) {
        return obj instanceof IAgriGenomeProvider || obj instanceof ICapabilityProvider;
    }

    @Nonnull
    @Override
    public Optional<IAgriGenome> valueOf(@Nullable Object obj) {
        if(obj instanceof IAgriGenomeProvider) {
            return ((IAgriGenomeProvider) obj).getGenome();
        }
        if(obj instanceof ICapabilityProvider) {
            ICapabilityProvider capabilityProvider = (ICapabilityProvider) obj;
            return capabilityProvider.getCapability(CropCapability.getCapability())
                    .map(crop -> crop)
                    .flatMap(IAgriGenomeProvider::getGenome);
        }
        return Optional.empty();
    }
}

package com.infinityraider.agricraft.plugins.minecraft;

import com.infinityraider.agricraft.api.v1.adapter.IAgriAdapter;
import com.infinityraider.agricraft.api.v1.crop.CropCapability;
import com.infinityraider.agricraft.api.v1.genetics.IAgriGenome;
import com.infinityraider.agricraft.api.v1.genetics.IAgriGenomeProvider;
import net.minecraft.tileentity.TileEntity;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Optional;

public class GenomeWrapper implements IAgriAdapter<IAgriGenome> {
    @Override
    public boolean accepts(@Nullable Object obj) {
        return obj instanceof IAgriGenomeProvider || obj instanceof TileEntity;
    }

    @Nonnull
    @Override
    public Optional<IAgriGenome> valueOf(@Nullable Object obj) {
        if(obj instanceof IAgriGenomeProvider) {
            return ((IAgriGenomeProvider) obj).getGenome();
        }
        if(obj instanceof TileEntity) {
            TileEntity tile = (TileEntity) obj;
            return tile.getCapability(CropCapability.getCapability())
                    .map(crop -> crop)
                    .flatMap(IAgriGenomeProvider::getGenome);
        }
        return Optional.empty();
    }
}

Fix bug where it was impossible to plant seeds on crop sticks


/*
 *    Copyright 2010 Chris Sinjakli
 *
 * 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.
 */

/**
 * @author Chris Sinjakli
 */

package uk.co.sinjakli.trivial;

import android.app.Activity;
import android.os.Bundle;

public class HomeActivity extends Activity {

	/** Called when the activity is first created. */
	@Override
	public void onCreate(final Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.home);

	}
}

/*
 *    Copyright 2010 Chris Sinjakli
 *
 * 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.
 */

/**
 * @author Chris Sinjakli
 */

package uk.co.sinjakli.trivial;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class HomeActivity extends Activity {

	/** Called when the activity is first created. */
	@Override
	public void onCreate(final Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.home);

		final Button startQuiz = (Button) findViewById(R.id.btn_start_quiz);
		startQuiz.setOnClickListener(new Button.OnClickListener() {

			@Override
			public void onClick(View v) {
				final Intent i = new Intent(HomeActivity.this, QuizActivity.class);
				startActivity(i);
			}

		});
	}
}

Implement onClick for Start Quiz button.


package cas.ypsiliform.mediator.negotiation;

import java.util.ArrayList;

import cas.ypsiliform.mediator.async.Thenable;
import cas.ypsiliform.messages.AgentResponse;

public class AgentProxy {
	private ArrayList<AgentDeadListener> listeners = new ArrayList<AgentDeadListener>();

	public void addAgentDeadListener(AgentDeadListener listener) {
		listeners.add(listener);
	}

	public void removeAgentDeadListener(AgentDeadListener listener) {
		listeners.remove(listener);
	}

	public Thenable<AgentResponse> sendSolutionProposal(SolutionProposal solution) {
		// TODO implementation missing
		throw new UnsupportedOperationException();
	}
}

package cas.ypsiliform.mediator.negotiation;

import java.util.ArrayList;

import cas.ypsiliform.mediator.async.Thenable;
import cas.ypsiliform.messages.AgentResponse;

public class AgentProxy {
	private ArrayList<AgentDeadListener> listeners = new ArrayList<AgentDeadListener>();

	public void addAgentDeadListener(AgentDeadListener listener) {
		listeners.add(listener);
	}

	public void removeAgentDeadListener(AgentDeadListener listener) {
		listeners.remove(listener);
	}

	public Thenable<AgentResponse> sendSolutionProposal(SolutionProposal solution) {
		// TODO implementation missing
		throw new UnsupportedOperationException();
	}

	public Thenable<Void> endNegotiation(SolutionProposal solution) {
		// TODO implementation missing
		throw new UnsupportedOperationException();
	}
}

Add agent proxy operation to end the negotiation


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

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import net.simonvt.cathode.common.util.WakeLock;

public class NotificationReceiver extends BroadcastReceiver {

  @Override public void onReceive(Context context, Intent intent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
      PendingResult pendingResult = goAsync();
      NotificationHelper.displayNotifications(context);
      NotificationHelper.scheduleNextNotification(context);
      pendingResult.finish();
    } else {
      WakeLock.acquire(context, NotificationService.LOCK_TAG);
      NotificationService.start(context);
    }
  }
}

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

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import net.simonvt.cathode.common.util.WakeLock;
import net.simonvt.cathode.settings.Settings;

public class NotificationReceiver extends BroadcastReceiver {

  @Override public void onReceive(Context context, Intent intent) {
    if (Settings.get(context).getBoolean(Settings.NOTIFICACTIONS_ENABLED, false)) {
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        PendingResult pendingResult = goAsync();
        NotificationHelper.displayNotifications(context);
        NotificationHelper.scheduleNextNotification(context);
        pendingResult.finish();
      } else {
        WakeLock.acquire(context, NotificationService.LOCK_TAG);
        NotificationService.start(context);
      }
    }
  }
}

Check notification setting before displaying notification.


/*
 * Copyright 2019 EPAM Systems
 *
 * 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.epam.ta.reportportal.ws.model.integration.auth;

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

/**
 * @author Ivan Budayeu
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ActiveDirectoryResource extends AbstractLdapResource {

	@JsonProperty(value = "domain")
	private String domain;

	public String getDomain() {
		return domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	@Override
	public String toString() {
		return "ActiveDirectoryResource{" + "domain='" + domain + '\'' + '}';
	}
}

/*
 * Copyright 2019 EPAM Systems
 *
 * 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.epam.ta.reportportal.ws.model.integration.auth;

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

/**
 * @author Ivan Budayeu
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ActiveDirectoryResource extends AbstractLdapResource {

	@JsonProperty(value = "domain")
	private String domain;

	@JsonProperty(value = "searchFilter")
	private String searchFilter;

	public String getDomain() {
		return domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	public String getSearchFilter() {
		return searchFilter;
	}

	public void setSearchFilter(String searchFilter) {
		this.searchFilter = searchFilter;
	}

	@Override
	public String toString() {
		return "ActiveDirectoryResource{" + "domain='" + domain + '\'' + ", searchFilter='" + searchFilter + '\'' + '}';
	}
}

Add a searchFilter field to ad resource


package dk.statsbiblioteket.medieplatform.newspaper.editionRecords;

import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import dk.statsbiblioteket.medieplatform.autonomous.ConfigConstants;
import dk.statsbiblioteket.medieplatform.autonomous.DomsItemFactory;
import dk.statsbiblioteket.medieplatform.autonomous.Item;
import dk.statsbiblioteket.medieplatform.autonomous.SolrJConnector;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import java.util.Properties;

import static org.testng.Assert.*;

public class NewspaperIndexIT {

    private String summaLocation;

    @BeforeClass
    public void setUp() throws Exception {
        Properties props = new Properties();
        try {
            props.load(new FileReader(new File(System.getProperty("integration.test.newspaper.properties"))));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        summaLocation = props.getProperty(ConfigConstants.AUTONOMOUS_SBOI_URL);

    }

    @Test(groups = "externalTest")
    public void testGetNewspapers() throws Exception {
        NewspaperIndex newspaperIndex = new NewspaperIndex(new SolrJConnector(summaLocation).getSolrServer(), new DomsItemFactory());
        List<Item> newspapers = newspaperIndex.getNewspapers("berlingsketidende", "1970-01-01");
        assertTrue(newspapers.size() == 1);
    }
}

package dk.statsbiblioteket.medieplatform.newspaper.editionRecords;

import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import dk.statsbiblioteket.medieplatform.autonomous.ConfigConstants;
import dk.statsbiblioteket.medieplatform.autonomous.DomsItemFactory;
import dk.statsbiblioteket.medieplatform.autonomous.Item;
import dk.statsbiblioteket.medieplatform.autonomous.SolrJConnector;

import java.io.FileInputStream;
import java.util.List;
import java.util.Properties;

import static org.testng.Assert.*;

public class NewspaperIndexIT {

    private String summaLocation;

    @BeforeClass(alwaysRun = true)
    public void setUp() throws Exception {
        String pathToProperties = System.getProperty("integration.test.newspaper.properties");
        Properties props = new Properties();

        props.load(new FileInputStream(pathToProperties));
        summaLocation = props.getProperty(ConfigConstants.AUTONOMOUS_SBOI_URL);

    }

    @Test(groups = "externalTest")
    public void testGetNewspapers() throws Exception {
        NewspaperIndex newspaperIndex = new NewspaperIndex(new SolrJConnector(summaLocation).getSolrServer(), new DomsItemFactory());
        List<Item> newspapers = newspaperIndex.getNewspapers("berlingsketidende", "1970-01-01");
        assertTrue(newspapers.size() == 1);
    }
}

Fix integration test to run the BeforeClass method for all groups


package io.github.droidkaigi.confsched.util;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

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

import java.util.Arrays;
import java.util.Locale;

import io.github.droidkaigi.confsched.prefs.DefaultPrefsSchema;

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

@RunWith(AndroidJUnit4.class)
public class LocaleUtilsTest {

    @Test
    public void testCurrentLanguageId() throws Exception {
        Context context = InstrumentationRegistry.getContext();
        // is not null value.
        assertThat(LocaleUtil.getCurrentLanguageId(context)).isNotNull();

        DefaultPrefsSchema.get(context).putLanguageId("ja");
        // eq to languageID is put in SharedPreferences.
        assertThat(LocaleUtil.getCurrentLanguageId(context)).isEqualTo("ja");

        DefaultPrefsSchema.get(context).removeLanguageId();
        String defaultLanguage = Locale.getDefault().getLanguage().toLowerCase();
        if (Arrays.asList(LocaleUtil.SUPPORT_LANG).contains(defaultLanguage)) {
            // eq to Locale.getDefault().getLanguage() when it is supported
            assertThat(LocaleUtil.getCurrentLanguageId(context)).isEqualTo(defaultLanguage);
        } else {
            // eq to "en" when Locale.getDefault().getLanguage() is not supported
            assertThat(LocaleUtil.getCurrentLanguageId(context)).isEqualTo("en");
        }
    }

}

package io.github.droidkaigi.confsched.util;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

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

import java.util.Arrays;
import java.util.Locale;

import io.github.droidkaigi.confsched.prefs.DefaultPrefs;

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

@RunWith(AndroidJUnit4.class)
public class LocaleUtilsTest {

    @Test
    public void testCurrentLanguageId() throws Exception {
        Context context = InstrumentationRegistry.getContext();
        // is not null value.
        assertThat(LocaleUtil.getCurrentLanguageId(context)).isNotNull();

        DefaultPrefs.get(context).putLanguageId("ja");
        // eq to languageID is put in SharedPreferences.
        assertThat(LocaleUtil.getCurrentLanguageId(context)).isEqualTo("ja");

        DefaultPrefs.get(context).removeLanguageId();
        String defaultLanguage = Locale.getDefault().getLanguage().toLowerCase();
        if (Arrays.asList(LocaleUtil.SUPPORT_LANG).contains(defaultLanguage)) {
            // eq to Locale.getDefault().getLanguage() when it is supported
            assertThat(LocaleUtil.getCurrentLanguageId(context)).isEqualTo(defaultLanguage);
        } else {
            // eq to "en" when Locale.getDefault().getLanguage() is not supported
            assertThat(LocaleUtil.getCurrentLanguageId(context)).isEqualTo("en");
        }
    }

}

Rename old class name of kvs-schema


package com.amebame.triton.server;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

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

import com.amebame.triton.config.TritonServerConfiguration;
import com.amebame.triton.util.NamedThreadFactory;

@Singleton
public class TritonServerContext {

	private TritonServerMethodMap methodMap;

	private ExecutorService executor;

	@Inject
	public TritonServerContext(TritonServerConfiguration config) {
		methodMap = new TritonServerMethodMap();
		executor = new ThreadPoolExecutor(
				1,
				config.getNetty().getWorker(),
				60L,
				TimeUnit.SECONDS,
				new LinkedBlockingQueue<Runnable>(),
				new NamedThreadFactory("triton-worker-")
		);
	}

	/**
	 * Add server methods from the target object
	 * @param target
	 */
	public void addServerMethod(Object target) {
		methodMap.register(target);
	}

	/**
	 * Get server method by name
	 * @param name
	 * @return
	 */
	public TritonServerMethod getServerMethod(String name) {
		return methodMap.getMethod(name);
	}

	/**
	 * Get worker executor
	 * @return
	 */
	public ExecutorService getWorkerExecutor() {
		return executor;
	}
}

package com.amebame.triton.server;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

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

import com.amebame.triton.config.TritonServerConfiguration;
import com.amebame.triton.util.NamedThreadFactory;

@Singleton
public class TritonServerContext {

	private TritonServerMethodMap methodMap;

	private ExecutorService executor;

	@Inject
	public TritonServerContext(TritonServerConfiguration config) {
		methodMap = new TritonServerMethodMap();
		executor = Executors.newFixedThreadPool(
				config.getNetty().getWorker(),
				new NamedThreadFactory("triton-worker-"));
	}

	/**
	 * Add server methods from the target object
	 * @param target
	 */
	public void addServerMethod(Object target) {
		methodMap.register(target);
	}

	/**
	 * Get server method by name
	 * @param name
	 * @return
	 */
	public TritonServerMethod getServerMethod(String name) {
		return methodMap.getMethod(name);
	}

	/**
	 * Get worker executor
	 * @return
	 */
	public ExecutorService getWorkerExecutor() {
		return executor;
	}
}

Make worker executor to FixedThreadPoolExecutor.


package pokefenn.totemic.client.renderer.entity;

import net.minecraft.client.renderer.entity.ArrowRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider.Context;
import net.minecraft.resources.ResourceLocation;
import pokefenn.totemic.api.TotemicAPI;
import pokefenn.totemic.entity.InvisibleArrow;

public class InvisibleArrowRenderer extends ArrowRenderer<InvisibleArrow> {
    private static final ResourceLocation INVIS_ARROW_TEXTURE = new ResourceLocation(TotemicAPI.MOD_ID, "textures/entity/invis_arrow.png");

    public InvisibleArrowRenderer(Context pContext) {
        super(pContext);
    }

    @Override
    public ResourceLocation getTextureLocation(InvisibleArrow pEntity) {
        return INVIS_ARROW_TEXTURE;
    }
}

package pokefenn.totemic.client.renderer.entity;

import com.mojang.blaze3d.vertex.PoseStack;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.ArrowRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider.Context;
import net.minecraft.resources.ResourceLocation;
import pokefenn.totemic.api.TotemicAPI;
import pokefenn.totemic.entity.InvisibleArrow;

public class InvisibleArrowRenderer extends ArrowRenderer<InvisibleArrow> {
    private static final ResourceLocation INVIS_ARROW_TEXTURE = new ResourceLocation(TotemicAPI.MOD_ID, "textures/entity/invis_arrow.png");

    public InvisibleArrowRenderer(Context pContext) {
        super(pContext);
    }

    @SuppressWarnings("resource")
    @Override
    public void render(InvisibleArrow pEntity, float pEntityYaw, float pPartialTicks, PoseStack pMatrixStack, MultiBufferSource pBuffer, int pPackedLight) {
        if(pEntity.getOwner() == Minecraft.getInstance().player) {
            //Override render type used by super method
            MultiBufferSource translucentBufferSrc = renderType -> pBuffer.getBuffer(RenderType.entityTranslucentCull(INVIS_ARROW_TEXTURE));
            super.render(pEntity, pEntityYaw, pPartialTicks, pMatrixStack, translucentBufferSrc, pPackedLight);
        }
    }

    @Override
    public ResourceLocation getTextureLocation(InvisibleArrow pEntity) {
        return INVIS_ARROW_TEXTURE;
    }
}

Make invisible arrow actually invisible


/**
 * @file Introductions.java
 * @author Valery Samovich
 * @version 1
 * @date 2015/04/07
 */

/**
 * TeamTreehouse. Java Basics.
 */
package com.samovich.basics.introduction.treehouse;

import java.io.Console;

public class Introductions {

    public static void main(String[] args) {
        Console console = System.console();
        // Welcome to the Introductions program!
        String firstName = "Valery";
        // thisIsAnExampleOfCamelCasing
        console.printf("Hello, my name is %s\n", firstName);
    }

}

/**
 * @file Introductions.java
 * @author Valery Samovich
 * @version 1
 * @date 2015/04/07
 */

/**
 * TeamTreehouse. Java Basics.
 */
package com.samovich.basics.introduction.treehouse;

import java.io.Console;

public class Introductions {

    public static void main(String[] args) {
        Console console = System.console();
        // Welcome to the Introductions program!
        String firstName = "Valery";
        // thisIsAnExampleOfCamelCasing
        console.printf("Hello, my name is %s\n", firstName);
        console.printf("%s is learning how to write Java\n", firstName);
    }

}

Add Introduction class for Team Treehouse example


package org.pitest.cucumber;

import org.pitest.junit.CompoundTestUnitFinder;
import org.pitest.junit.JUnitCompatibleConfiguration;
import org.pitest.testapi.TestGroupConfig;
import org.pitest.testapi.TestUnitFinder;
import org.pitest.util.Log;

import java.util.Collections;
import java.util.List;

import static java.util.Arrays.asList;

public class CucumberJUnitCompatibleConfiguration extends JUnitCompatibleConfiguration {

    public CucumberJUnitCompatibleConfiguration(TestGroupConfig config) {
        super(config, Collections.<String>emptyList());
    }

    @Override
    public TestUnitFinder testUnitFinder() {
        final TestUnitFinder finder;
        if (isCucumberUsed()) {
            Log.getLogger().fine("Cucumber detected, scenarios will be used");
            List<TestUnitFinder> finders
                    = asList(new CucumberTestUnitFinder(), super.testUnitFinder());
            finder = new CompoundTestUnitFinder(finders);
        } else {
            Log.getLogger().fine("Cucumber not used in this project");
            finder = super.testUnitFinder();
        }
        return finder;
    }

    private boolean isCucumberUsed() {
        boolean result = false;
        try {
            Class.forName("cucumber.api.junit.Cucumber");
            result = true;
        } catch (ClassNotFoundException e) {
        }
        return result;
    }
}

package org.pitest.cucumber;

import org.pitest.junit.CompoundTestUnitFinder;
import org.pitest.junit.JUnitCompatibleConfiguration;
import org.pitest.testapi.TestGroupConfig;
import org.pitest.testapi.TestUnitFinder;
import org.pitest.util.Log;

import java.util.Collections;
import java.util.List;

import static java.util.Arrays.asList;

public class CucumberJUnitCompatibleConfiguration extends JUnitCompatibleConfiguration {

    public CucumberJUnitCompatibleConfiguration(TestGroupConfig config) {
        super(config, Collections.<String>emptyList(), Collections.<String>emptyList());
    }

    @Override
    public TestUnitFinder testUnitFinder() {
        final TestUnitFinder finder;
        if (isCucumberUsed()) {
            Log.getLogger().fine("Cucumber detected, scenarios will be used");
            List<TestUnitFinder> finders
                    = asList(new CucumberTestUnitFinder(), super.testUnitFinder());
            finder = new CompoundTestUnitFinder(finders);
        } else {
            Log.getLogger().fine("Cucumber not used in this project");
            finder = super.testUnitFinder();
        }
        return finder;
    }

    private boolean isCucumberUsed() {
        boolean result = false;
        try {
            Class.forName("cucumber.api.junit.Cucumber");
            result = true;
        } catch (ClassNotFoundException e) {
        }
        return result;
    }
}

Update to support PIT 1.4.3


package net.tomp2p.utils;

import java.util.ArrayList;
import java.util.Collection;

import junit.framework.Assert;

import org.junit.Test;

public class TestUtils {
    @SuppressWarnings("unchecked")
    @Test
    public void testDifference1() {
        Collection<String> collection1 = new ArrayList<String>();
        Collection<String> result = new ArrayList<String>();
        Collection<String> collection2 = new ArrayList<String>();
        Collection<String> collection3 = new ArrayList<String>();
        //
        collection1.add("hallo");
        collection1.add("test");
        //
        collection2.add("test");
        collection2.add("hallo");
        Utils.difference(collection1, result, collection2, collection3);
        Assert.assertEquals(0, result.size());
    }
}

package net.tomp2p.utils;

import java.util.ArrayList;
import java.util.Collection;

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

public class TestUtils {
    @Test
    public void testDifference1() {
        Collection<String> collection1 = new ArrayList<String>();
        Collection<String> result = new ArrayList<String>();
        Collection<String> collection2 = new ArrayList<String>();
        Collection<String> collection3 = new ArrayList<String>();
        //
        collection1.add("hallo");
        collection1.add("test");
        //
        collection2.add("test");
        collection2.add("hallo");
        Utils.difference(collection1, result, collection2, collection3);
        Assert.assertEquals(0, result.size());
    }
}

Fix warning in core test


package cgeo.geocaching;

import cgeo.geocaching.files.FileList;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;

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

public class cgSelectMapfile extends FileList<cgMapfileListAdapter> {

    public cgSelectMapfile() {
        super("map");
    }

    String mapFile;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mapFile = Settings.getMapFile();
    }

    public void close() {

        Intent intent = new Intent();
        intent.putExtra("mapfile", mapFile);

        setResult(RESULT_OK, intent);

        finish();
    }

    @Override
    protected cgMapfileListAdapter getAdapter(List<File> files) {
        return new cgMapfileListAdapter(this, files);
    }

    @Override
    protected String[] getBaseFolders() {
        String base = Environment.getExternalStorageDirectory().toString();
        return new String[] { base + "/mfmaps", base + "/Locus/mapsVector" };
    }

    @Override
    protected void setTitle() {
        setTitle(res.getString(R.string.map_file_select_title));
    }

    public String getCurrentMapfile() {
        return mapFile;
    }

    public void setMapfile(String newMapfile) {
        mapFile = newMapfile;
    }

}

package cgeo.geocaching;

import cgeo.geocaching.files.FileList;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;

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

public class cgSelectMapfile extends FileList<cgMapfileListAdapter> {

    public cgSelectMapfile() {
        super("map");
    }

    String mapFile;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mapFile = Settings.getMapFile();
    }

    public void close() {

        Intent intent = new Intent();
        intent.putExtra("mapfile", mapFile);

        setResult(RESULT_OK, intent);

        finish();
    }

    @Override
    protected cgMapfileListAdapter getAdapter(List<File> files) {
        return new cgMapfileListAdapter(this, files);
    }

    @Override
    protected String[] getBaseFolders() {
        String base = Environment.getExternalStorageDirectory().toString();
        return new String[] { base + "/mfmaps", base + "/Locus/mapsVector", base + "/.cgeo" };
    }

    @Override
    protected void setTitle() {
        setTitle(res.getString(R.string.map_file_select_title));
    }

    public String getCurrentMapfile() {
        return mapFile;
    }

    public void setMapfile(String newMapfile) {
        mapFile = newMapfile;
    }

}

Add .cgeo to search directories for map files


package io.quarkus.test.junit.launcher;

import static io.quarkus.test.junit.IntegrationTestUtil.DEFAULT_WAIT_TIME_SECONDS;

import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.OptionalLong;

import org.eclipse.microprofile.config.Config;

public final class ConfigUtil {

    private ConfigUtil() {
    }

    public static List<String> argLineValue(Config config) {
        List<String> strings = config.getOptionalValues("quarkus.test.arg-line", String.class)
                .orElse(config.getOptionalValues("quarkus.test.argLine", String.class) // legacy value
                        .orElse(Collections.emptyList()));
        if (strings.isEmpty()) {
            return strings;
        }
        List<String> sanitizedString = new ArrayList<>(strings.size());
        for (String s : strings) {
            String trimmed = s.trim();
            if (trimmed.isEmpty()) {
                continue;
            }
            sanitizedString.add(trimmed);
        }
        return sanitizedString;
    }

    public static Duration waitTimeValue(Config config) {
        return Duration.ofSeconds(config.getValue("quarkus.test.wait-time", OptionalLong.class)
                .orElse(config.getValue("quarkus.test.jar-wait-time", OptionalLong.class) // legacy value
                        .orElse(DEFAULT_WAIT_TIME_SECONDS)));
    }
}

package io.quarkus.test.junit.launcher;

import static io.quarkus.test.junit.IntegrationTestUtil.DEFAULT_WAIT_TIME_SECONDS;

import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.OptionalLong;

import org.eclipse.microprofile.config.Config;

public final class ConfigUtil {

    private ConfigUtil() {
    }

    public static List<String> argLineValue(Config config) {
        String strValue = config.getOptionalValue("quarkus.test.arg-line", String.class)
                .orElse(config.getOptionalValue("quarkus.test.argLine", String.class) // legacy value
                        .orElse(null));
        if (strValue == null) {
            return Collections.emptyList();
        }
        String[] parts = strValue.split("\\s+");
        List<String> result = new ArrayList<>(parts.length);
        for (String s : parts) {
            String trimmed = s.trim();
            if (trimmed.isEmpty()) {
                continue;
            }
            result.add(trimmed);
        }
        return result;
    }

    public static Duration waitTimeValue(Config config) {
        return Duration.ofSeconds(config.getValue("quarkus.test.wait-time", OptionalLong.class)
                .orElse(config.getValue("quarkus.test.jar-wait-time", OptionalLong.class) // legacy value
                        .orElse(DEFAULT_WAIT_TIME_SECONDS)));
    }
}

Fix quarkus.test.arg-line multiple args handling


package org.zanata.webtrans.server.rpc;

import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.shared.Action;
import net.customware.gwt.dispatch.shared.Result;

import org.zanata.webtrans.server.ActionHandlerFor;

abstract class AbstractActionHandler<A extends Action<R>, R extends Result>
        implements ActionHandler<A, R> {

    @SuppressWarnings("unchecked")
    @Override
    public final Class<A> getActionType() {
        return (Class<A>) this.getClass().getAnnotation(ActionHandlerFor.class)
                .getClass();
    }

}

package org.zanata.webtrans.server.rpc;

import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.shared.Action;
import net.customware.gwt.dispatch.shared.Result;

import org.zanata.webtrans.server.ActionHandlerFor;

abstract class AbstractActionHandler<A extends Action<R>, R extends Result>
        implements ActionHandler<A, R> {

    protected AbstractActionHandler() {
        assert getActionType() != null;
    }

    @SuppressWarnings("unchecked")
    @Override
    public Class<A> getActionType() {
        return (Class<A>) this.getClass().getAnnotation(ActionHandlerFor.class)
                .getClass();
    }

}

Make method non-final (not allowed for CDI beans)


package jacz.util.id;

import jacz.util.string.AlphanumericString;

/**
 * Created by Alberto on 17/03/2016.
 */
public class AlphaNumFactory extends IdFactory<String> {

    private static String staticId = "1";

    private static AlphanumericString.CharTypeSequence charTypeSequence = new AlphanumericString.CharTypeSequence(AlphanumericString.CharType.NUMERIC, AlphanumericString.CharType.UPPERCASE);

    public AlphaNumFactory() {
        super("1");
    }

    @Override
    protected String cloneId() {
        return id;
    }

    @Override
    protected void nextId() {
        id = AlphanumericString.nextAlphanumericString(id, charTypeSequence);
    }

    public static synchronized String getStaticId() {
        String oldId = staticId;
        staticId = AlphanumericString.nextAlphanumericString(staticId, charTypeSequence);
        return oldId;
    }
}

package jacz.util.id;

import jacz.util.string.AlphanumericString;

/**
 * Created by Alberto on 17/03/2016.
 */
public class AlphaNumFactory extends IdFactory<String> {

    private static String staticId = "1";

    private static final AlphanumericString.CharTypeSequence charTypeSequence = new AlphanumericString.CharTypeSequence(AlphanumericString.CharType.NUMERIC, AlphanumericString.CharType.UPPERCASE);

    public AlphaNumFactory() {
        super("1");
    }

    @Override
    protected String cloneId() {
        return id;
    }

    @Override
    protected void nextId() {
        id = AlphanumericString.nextAlphanumericString(id, charTypeSequence);
    }

    public static synchronized String getStaticId() {
        String oldId = staticId;
        staticId = AlphanumericString.nextAlphanumericString(staticId, charTypeSequence);
        return oldId;
    }
}

Add final modifier to charTypeSequence field


package nl.yacht.lakesideresort;

import nl.yacht.lakesideresort.domain.Trip;

public class Main {
    public static void main(String[] args) {

        /// Create nl.yacht.lakesideresort.domain.Trip
        // set tripnumber
        int tripNumber = 1;
        // create trip
        Trip newTrip = new Trip(tripNumber);

        // sleep for 4 seconds
        Sleep();

        // end the trip
        newTrip.end();

        // print results
        System.out.println("nl.yacht.lakesideresort.domain.Trip: " + newTrip.getTripNumber() + " has ended.");
        System.out.println("Start: " + newTrip.getStartTime());
        System.out.println("End: " + newTrip.getEndTime());
        System.out.println("Duration: " + newTrip.getDuration());
        System.out.println();

    }

    static void Sleep() {
        try {
            Thread.sleep(4000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

package nl.yacht.lakesideresort;

import nl.yacht.lakesideresort.domain.Trip;

public class Main {
    public static void main(String[] args) {

        /// Create Trip
        // set tripnumber
        int tripNumber = 1;
        // create trip
        Trip newTrip = new Trip(tripNumber);

        // sleep for 4 seconds
        Sleep();

        // end the trip
        newTrip.end();

        // print results
        System.out.println("Trip: " + newTrip.getTripNumber() + " has ended.");
        System.out.println("Start: " + newTrip.getStartTime());
        System.out.println("End: " + newTrip.getEndTime());
        System.out.println("Duration: " + newTrip.getDuration());
        System.out.println();

    }

    static void Sleep() {
        try {
            Thread.sleep(4000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

Revert those silly Intellij change


/*
 * Copyright 2001-2005 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.jmeter.util;

/**
 * @version $Revision$
 */
public final class StringUtilities {
	public static String substitute(String input, String pattern, String sub) {
		StringBuffer ret = new StringBuffer();
		int start = 0;
		int index = -1;
		while ((index = input.indexOf(pattern, start)) >= start) {
			ret.append(input.substring(start, index));
			ret.append(sub);
			start = index + pattern.length();
		}
		ret.append(input.substring(start));
		return ret.toString();
	}

	/**
	 * Private constructor to prevent instantiation.
	 */
	private StringUtilities() {
	}

}

/*
 * Copyright 2001-2005 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.jmeter.util;

/**
 * @version $Revision$
 */
public final class StringUtilities {

    /**
     * Private constructor to prevent instantiation.
     */
    private StringUtilities() {
    }

    /**
     * Replace all patterns in a String
     *
     * @see String.replaceAll(regex,replacement) - JDK1.4 only
     *
     * @param input - string to be transformed
     * @param pattern - pattern to replace
     * @param sub - replacement
     * @return the updated string
     */
	public static String substitute(final String input, final String pattern, final String sub) {
		StringBuffer ret = new StringBuffer(input.length());
		int start = 0;
		int index = -1;
        final int length = pattern.length();
		while ((index = input.indexOf(pattern, start)) >= start) {
			ret.append(input.substring(start, index));
			ret.append(sub);
            start = index + length;
		}
		ret.append(input.substring(start));
		return ret.toString();
	}
}

Add documentation and tidy up a bit


package guitests.guihandles;

public class GuiHandleSetting {
    static final int COMMAND_RUN_TIME = 80;
    static final int SLEEP_LENGTH = 50;
    static final int LONG_SLEEP_LENGTH = 600;
}

package guitests.guihandles;

public class GuiHandleSetting {
    public static final int COMMAND_RUN_TIME = 80;
    public static final int SLEEP_LENGTH = 50;
    public static final int LONG_SLEEP_LENGTH = 600;
}

Change access specifiers for sleep times


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

import org.xwiki.component.annotation.Role;

/**
 * @version $Id$
 */
@Role
public interface TranslationManager
{
    /**
     * Get the translation corresponding to the given key, using the current locale.
     *
     * @param key the identifier of the message to retrieve
     * @param parameters optional parameters to be used in the translation
     * @return the message in the current locale, as plain text (all markup is stripped)
     */
    String translate(String key, Object... parameters);
}

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

import org.xwiki.component.annotation.Role;
import org.xwiki.stability.Unstable;

/**
 * @version $Id$
 */
@Unstable("New API introduced in 1.2")
@Role
public interface TranslationManager
{
    /**
     * Get the translation corresponding to the given key, using the current locale.
     *
     * @param key the identifier of the message to retrieve
     * @param parameters optional parameters to be used in the translation
     * @return the message in the current locale, as plain text (all markup is stripped)
     */
    String translate(String key, Object... parameters);
}

Mark new role as unstable API


package org.graylog2;

import java.io.IOException;
import java.net.*;
import java.util.List;

public class GelfSender {

    private static final int DEFAULT_PORT = 12201;

    private static final int PORT_MIN = 8000;
    private static final int PORT_MAX = 8888;

    private InetAddress host;
    private int port;
    private DatagramSocket socket;

    public GelfSender(String host) throws UnknownHostException, SocketException {
        this(host, DEFAULT_PORT);
    }

    public GelfSender(String host, int port) throws UnknownHostException, SocketException {
        this.host = InetAddress.getByName(host);
        this.port = port;
        this.socket = initiateSocket();
    }

    private DatagramSocket initiateSocket() throws SocketException {
        int port = PORT_MIN;

        DatagramSocket resultingSocket = null;
        boolean binded = false;
        while (!binded) {
            try {
                resultingSocket = new DatagramSocket(port);
                binded = true;
            } catch (SocketException e) {
                port++;

                if (port > PORT_MAX)
                    throw e;
            }
        }
        return resultingSocket;
    }

    public boolean sendMessage(GelfMessage message) {
        return message.isValid() && sendDatagrams(message.toDatagrams());
    }

    public boolean sendDatagrams(List<byte[]> bytesList) {
        for (byte[] bytes : bytesList) {
            DatagramPacket datagramPacket = new DatagramPacket(bytes, bytes.length, host, port);
            try {
                socket.send(datagramPacket);
            } catch (IOException e) {
                return false;
            }
        }
        return true;
    }

    public void close() {
        socket.close();
    }
}

package org.graylog2;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.List;

public class GelfSender {

    private static final int DEFAULT_PORT = 12201;

    private InetAddress host;
    private int port;
    private DatagramSocket socket;

    public GelfSender(String host) throws UnknownHostException, SocketException {
        this(host, DEFAULT_PORT);
    }

    public GelfSender(String host, int port) throws UnknownHostException, SocketException {
        this.host = InetAddress.getByName(host);
        this.port = port;
        this.socket = initiateSocket();
    }

    private DatagramSocket initiateSocket() throws SocketException {
        return new DatagramSocket(0);
    }

    public boolean sendMessage(GelfMessage message) {
        return message.isValid() && sendDatagrams(message.toDatagrams());
    }

    public boolean sendDatagrams(List<byte[]> bytesList) {
        for (byte[] bytes : bytesList) {
            DatagramPacket datagramPacket = new DatagramPacket(bytes, bytes.length, host, port);
            try {
                socket.send(datagramPacket);
            } catch (IOException e) {
                return false;
            }
        }
        return true;
    }

    public void close() {
        socket.close();
    }
}

Simplify initialiazing a datagram by use source port 0 and letting OS find an available port


package org.verapdf.model.impl.pb.operator.textobject;

import org.apache.pdfbox.cos.COSBase;
import org.verapdf.model.impl.pb.operator.base.PBOperator;
import org.verapdf.model.operator.OpTextObject;

import java.util.List;

/**
 * @author Timur Kamalov
 */
public class PBOpTextObject extends PBOperator implements OpTextObject {

    public static final String OP_TEXT_OBJECT_TYPE = "OpTextObject";

    public PBOpTextObject(List<COSBase> arguments) {
        super(arguments, OP_TEXT_OBJECT_TYPE);
    }

}

package org.verapdf.model.impl.pb.operator.textobject;

import org.apache.pdfbox.cos.COSBase;
import org.verapdf.model.impl.pb.operator.base.PBOperator;
import org.verapdf.model.operator.OpTextObject;

import java.util.List;

/**
 * Base class for pdf text operators (BT and ET)
 *
 * @author Timur Kamalov
 */
public class PBOpTextObject extends PBOperator implements OpTextObject {

	/** Type name for {@code PBOpTextObject} */
    public static final String OP_TEXT_OBJECT_TYPE = "OpTextObject";

    public PBOpTextObject(List<COSBase> arguments) {
        super(arguments, OP_TEXT_OBJECT_TYPE);
    }

}

Add javadoc to text object operators


//@@author A0138474X
package seedu.address.logic.parser;

import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ALL;

import java.util.Optional;

import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.DeleteCommand;
import seedu.address.logic.commands.IncorrectCommand;

/**
 * Parses input arguments and creates a new DeleteCommand object
 */
public class DeleteCommandParser {

    /**
     * Parses the given {@code String} of arguments in the context of the DeleteCommand
     * and returns an DeleteCommand object for execution.
     */
    public static Command parse(String args) {
        ArgumentTokenizer argsTokenizer = new ArgumentTokenizer(PREFIX_ALL);
        argsTokenizer.tokenize(args);

        String stringIndex = argsTokenizer.getPreamble().get();
        Optional<Integer> index = ParserUtil.parseIndex(stringIndex);
        Optional<String> isDeleteAll = argsTokenizer.getValue(PREFIX_ALL);
        if (!index.isPresent()) {
            return new IncorrectCommand(
                    String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE));
        }

        return new DeleteCommand(index.get(), isDeleteAll.isPresent());
    }

}

//@@author A0138474X
package seedu.address.logic.parser;

import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ALL;

import java.util.Optional;

import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.DeleteCommand;
import seedu.address.logic.commands.IncorrectCommand;

/**
 * Parses input arguments and creates a new DeleteCommand object
 */
public class DeleteCommandParser {

    /**
     * Parses the given {@code String} of arguments in the context of the DeleteCommand
     * and returns an DeleteCommand object for execution.
     */
    public static Command parse(String args) {
        ArgumentTokenizer argsTokenizer = new ArgumentTokenizer(PREFIX_ALL);
        argsTokenizer.tokenize(args);

        if (!argsTokenizer.getPreamble().isPresent()) {
            return new IncorrectCommand(
                    String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE));
        }
        String stringIndex = argsTokenizer.getPreamble().get();
        Optional<Integer> index = ParserUtil.parseIndex(stringIndex);
        Optional<String> isDeleteAll = argsTokenizer.getValue(PREFIX_ALL);
        if (!index.isPresent()) {
            return new IncorrectCommand(
                    String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE));
        }

        return new DeleteCommand(index.get(), isDeleteAll.isPresent());
    }

}

Update deleteCommandParser to pass the test


package com.sibisoft.faizaniftikhartdd;

public class Franc extends Money
{
	public Franc()
	{

	}
	public Franc(int amount)
	{
		this.amount= amount;
	}
	Franc times(int multiplier)
	{
		return new Franc(amount * multiplier);
	}
	public boolean equals(Object object)
	{
		Franc franc= (Franc) object;
		return amount == franc.amount;
	}

}

package com.sibisoft.faizaniftikhartdd;

public class Franc extends Money
{
	public Franc()
	{

	}
	public Franc(int amount)
	{
		this.amount= amount;
	}
	Franc times(int multiplier)
	{
		return new Franc(amount * multiplier);
	}
	public boolean equals(Object object)
	{
		Money franc= (Franc) object;
		return amount == franc.amount;
	}

}

Change the declaration of Equal method's wiht Money


package uk.ac.ox.oucs.vle;

public interface CourseComponent {

	public String getId();

	public String getTitle();

	public int getPlaces();

	public int getSize();

	public String getPresenter();

	public String getPresenterEmail();

	public String getLocation();

	/**
	 * The ID of the component set that this component belongs to.
	 * This is used when there are multiple copies of a component running at once to discover
	 * which ones the user can select from.
	 * @return
	 */
	public String getComponentSet();
}

package uk.ac.ox.oucs.vle;

import java.util.Date;

public interface CourseComponent {

	public String getId();

	public String getTitle();

	public int getPlaces();

	public int getSize();

	public String getPresenter();

	public String getPresenterEmail();

	public String getLocation();

	public Date getOpens();

	public Date getCloses();

	/**
	 * The ID of the component set that this component belongs to.
	 * This is used when there are multiple copies of a component running at once to discover
	 * which ones the user can select from.
	 * @return
	 */
	public String getComponentSet();
}

Include the dates when a component is available. This is because we now aren't agregaring components.


// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author hmusum
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    @Override
    public void getConfig(ThreadpoolConfig.Builder builder) {
        builder.maxthreads(10);
    }

    @Override
    public void getConfig(QrStartConfig.Builder builder) {
        super.getConfig(builder);
        builder.jvm.heapsize(512);
    }

    protected boolean messageBusEnabled() { return false; }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("http://*/logs");
        addComponent(logHandler);
    }

}

// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author hmusum
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    @Override
    public void getConfig(ThreadpoolConfig.Builder builder) {
        builder.maxthreads(10);
    }

    @Override
    public void getConfig(QrStartConfig.Builder builder) {
        super.getConfig(builder);
        builder.jvm.heapsize(384);
    }

    protected boolean messageBusEnabled() { return false; }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("http://*/logs");
        addComponent(logHandler);
    }

}

Revert "Increase JVM heap for logserver-container"


package info.u_team.u_team_core.intern.init;

import info.u_team.u_team_core.util.registry.BusRegister;

public class UCoreCommonBusRegister {

	public static void register() {
		BusRegister.registerMod(UCoreNetwork::registerMod);
	}
}

package info.u_team.u_team_core.intern.init;

import info.u_team.u_team_core.util.registry.BusRegister;

public class UCoreCommonBusRegister {

	public static void register() {
		BusRegister.registerMod(UCoreNetwork::registerMod);
		BusRegister.registerMod(UCoreRecipeSerializers::register);
	}
}

Call the bus register to the recipe serializers now


/*
 * Copyright (c) 2015-2019 Dzikoysk
 *
 * 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.panda_lang.panda.framework;

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

import java.lang.management.ManagementFactory;

public class PandaFrameworkLogger {

    protected static Logger PANDA_FRAMEWORK_LOGGER = LoggerFactory.getLogger("Panda Framework");

    public static void setLogger(Logger logger) {
        PANDA_FRAMEWORK_LOGGER = logger;
    }

    public static void printJVMUptime() {
        PANDA_FRAMEWORK_LOGGER.debug("JVM launch time: " + (System.currentTimeMillis() - ManagementFactory.getRuntimeMXBean().getStartTime()) + "ms");
    }

}

/*
 * Copyright (c) 2015-2019 Dzikoysk
 *
 * 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.panda_lang.panda.framework;

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

import java.lang.management.ManagementFactory;

public class PandaFrameworkLogger {

    protected static Logger PANDA_FRAMEWORK_LOGGER = LoggerFactory.getLogger("Panda Framework");

    public static void setLogger(Logger logger) {
        PANDA_FRAMEWORK_LOGGER = logger;
    }

    public static void printJVMUptime() {
        PANDA_FRAMEWORK_LOGGER.debug("");
        PANDA_FRAMEWORK_LOGGER.debug("JVM launch time: " + (System.currentTimeMillis() - ManagementFactory.getRuntimeMXBean().getStartTime()) + "ms (｡•́︿•̀｡)");
        PANDA_FRAMEWORK_LOGGER.debug("");
    }

}

Improve JVM launch time message


package com.digistratum.microhost.RestServer.JsonApi;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

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

public class ErrorTest {
	private Error sut;

	@BeforeEach
	public void setup() throws Exception {
		sut = new Error();
	}

	@Test
	public void testThat_toJson_returnsEmptyStructure() {
		String res = sut.toJson();
		assertEquals("{}", res);
	}

	// TODO: Fill in additional test cases covering the various, chained setters
}

package com.digistratum.microhost.RestServer.JsonApi;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

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

public class ErrorTest {
	private Error sut;

	@BeforeEach
	public void setup() throws Exception {
		sut = new Error();
	}

	@Test
	public void testThat_toJson_returnsEmptyStructure() {
		String res = sut.toJson();
		assertEquals("{}", res);
	}

	@Test
	public void testThat_setters_chainPropertly() {
		Meta meta = new Meta();
		Source source = new Source();
		Links links = new Links();
		sut.setId("id")
				.setCode("CODE")
				.setDetail("DETAIL")
				.setStatus("STATUS")
				.setTitle("TITLE")
				.setMeta(meta)
				.setSource(source)
				.setLinks(links)
				.setId("ID");
		String res = sut.toJson();
		assertEquals("{\"id\":\"ID\",\"links\":{},\"status\":\"STATUS\",\"code\":\"CODE\",\"title\":\"TITLE\",\"detail\":\"DETAIL\",\"source\":{},\"meta\":{}}", res);
	}
}

Complete test coverage for JsonApi.Errors class


//
// $Id: IntegerTableCellRenderer.java,v 1.2 2004/05/18 19:08:45 ray Exp $

package com.samskivert.swing;

import java.text.NumberFormat;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * A table cell renderer that that formats integers according to the
 * locale's desires.
 */
public class IntegerTableCellRenderer extends DefaultTableCellRenderer
{
    public IntegerTableCellRenderer ()
    {
        setHorizontalAlignment(RIGHT);
    }

    // documentation inherited
    protected void setValue (Object value)
    {
        if ((value instanceof Integer) || (value instanceof Long)) {
            setText(_nfi.format(value));
        } else {
            super.setValue(value);
        }
    }

    // our number formatter
    protected NumberFormat _nfi = NumberFormat.getIntegerInstance();

    /**
     * A convenience method for installing this renderer.
     */
    public static void install (JTable table)
    {
        table.setDefaultRenderer(Number.class, new IntegerTableCellRenderer());
    }
}

//
// $Id: IntegerTableCellRenderer.java,v 1.2 2004/05/18 19:08:45 ray Exp $

package com.samskivert.swing;

import java.text.NumberFormat;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * A table cell renderer that that formats integers according to the
 * locale's desires.
 */
public class IntegerTableCellRenderer extends DefaultTableCellRenderer
{
    public IntegerTableCellRenderer ()
    {
        setHorizontalAlignment(RIGHT);
    }

    // documentation inherited
    protected void setValue (Object value)
    {
        if ((value instanceof Integer) || (value instanceof Long)) {
            setText(_nfi.format(value) + " ");
        } else {
            super.setValue(value);
        }
    }

    // our number formatter
    protected NumberFormat _nfi = NumberFormat.getIntegerInstance();

    /**
     * A convenience method for installing this renderer.
     */
    public static void install (JTable table)
    {
        table.setDefaultRenderer(Number.class, new IntegerTableCellRenderer());
    }
}

Put a space to the right of all right-aligned numbers in tables. Strings are left-aligned, and when the two are next to each other it can look bad.


/*
 * Copyright 2014 Open mHealth
 *
 * 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.openmhealth.dsu.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.lang.annotation.*;

/**
 * A specialisation of the {@link Controller} annotation that controls the version number of the DSU API.
 *
 * @author Emerson Farrugia
 */
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Controller
@RequestMapping("/v2")
public @interface ApiController {

}

/*
 * Copyright 2014 Open mHealth
 *
 * 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.openmhealth.dsu.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.lang.annotation.*;

/**
 * A specialisation of the {@link Controller} annotation that controls the version number of the DSU API.
 *
 * @author Emerson Farrugia
 */
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Controller
@RequestMapping("/v2.0.M1")
public @interface ApiController {

}

Set API version to v2.0.M1.


package com.thoughtworks.xstream.core.util;

public final class FastStack {

    private Object[] stack;
    private int pointer;

    public FastStack(int initialCapacity) {
        stack = new Object[initialCapacity];
    }

    public Object push(Object value) {
        if (pointer + 1 >= stack.length) {
            resizeStack(stack.length * 2);
        }
        stack[pointer++] = value;
        return value;
    }

    public void popSilently() {
        pointer--;
    }

    public Object pop() {
        return stack[--pointer];
    }

    public Object peek() {
        return pointer == 0 ? null : stack[pointer - 1];
    }

    public int size() {
        return pointer;
    }

    public boolean hasStuff() {
        return pointer > 0;
    }

    public Object get(int i) {
        return stack[i];
    }

    private void resizeStack(int newCapacity) {
        Object[] newStack = new Object[newCapacity];
        System.arraycopy(stack, 0, newStack, 0, Math.min(stack.length, newCapacity));
        stack = newStack;
    }

    public String toString() {
        StringBuffer result = new StringBuffer("[");
        for (int i = 0; i < pointer; i++) {
            if (i > 0) {
                result.append(", ");
            }
            result.append(stack[i]);
        }
        result.append(']');
        return result.toString();
    }
}

package com.thoughtworks.xstream.core.util;

public final class FastStack {

    private Object[] stack;
    private int pointer;

    public FastStack(int initialCapacity) {
        stack = new Object[initialCapacity];
    }

    public Object push(Object value) {
        if (pointer + 1 >= stack.length) {
            resizeStack(stack.length * 2);
        }
        stack[pointer++] = value;
        return value;
    }

    public void popSilently() {
        stack[--pointer] = null;
    }

    public Object pop() {
        final Object result = stack[--pointer];
        stack[pointer] = null;
        return result;
    }

    public Object peek() {
        return pointer == 0 ? null : stack[pointer - 1];
    }

    public int size() {
        return pointer;
    }

    public boolean hasStuff() {
        return pointer > 0;
    }

    public Object get(int i) {
        return stack[i];
    }

    private void resizeStack(int newCapacity) {
        Object[] newStack = new Object[newCapacity];
        System.arraycopy(stack, 0, newStack, 0, Math.min(stack.length, newCapacity));
        stack = newStack;
    }

    public String toString() {
        StringBuffer result = new StringBuffer("[");
        for (int i = 0; i < pointer; i++) {
            if (i > 0) {
                result.append(", ");
            }
            result.append(stack[i]);
        }
        result.append(']');
        return result.toString();
    }
}

Drop unnecessary reference to popped elements to allow finalization through GC (XSTR-264).


package com.rarchives.ripme.tst.ripper.rippers;

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

import com.rarchives.ripme.ripper.rippers.HentaiimageRipper;

public class HentaiimageRipperTest extends RippersTest {
    public void testHentaifoundryRip() throws IOException {
        HentaiimageRipper ripper = new HentaiimageRipper(new URL("https://hentai-image.com/image/afrobull-gerudo-ongoing-12/"));
        testRipper(ripper);
    }
}

package com.rarchives.ripme.tst.ripper.rippers;

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

import com.rarchives.ripme.ripper.rippers.HentaiimageRipper;
import com.rarchives.ripme.utils.Utils;

public class HentaiimageRipperTest extends RippersTest {

    public void testHentaifoundryRip() throws IOException {
        if (Utils.getConfigBoolean("test.run_flaky_tests", false)) {
            HentaiimageRipper ripper = new HentaiimageRipper(new URL("https://hentai-image.com/image/afrobull-gerudo-ongoing-12/"));
            testRipper(ripper);
        }
    }
}

Mark hentaiImage test as flaky


package com.stevescodingblog.androidapps.tally;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity {

    int _tally = 1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        final View layoutRoot = this.findViewById(R.id.layoutRoot);
        layoutRoot.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                _tally += 1;
                updateUi();
            }
        });

        final Button resetButton = (Button) this.findViewById(R.id.tallyButton);
        resetButton.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {
                _tally = 1;
                updateUi();
            }
        });
    }

    protected void updateUi() {

        final TextView tallyDisplay = (TextView)this.findViewById(R.id.tallyDisplay);
        tallyDisplay.setText(Integer.toString(this._tally));

    }
}

package com.stevescodingblog.androidapps.tally;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import java.util.prefs.Preferences;

public class MainActivity extends Activity {

    int _tally = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        final View layoutRoot = this.findViewById(R.id.layoutRoot);
        layoutRoot.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
            _tally += 1;
            updateUi();
            }
        });

        final Button resetButton = (Button) this.findViewById(R.id.tallyButton);
        resetButton.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {
            _tally = 0;
            updateUi();
            }
        });

        this.updateUi();
    }

    protected void updateUi() {

        final TextView tallyDisplay = (TextView)this.findViewById(R.id.tallyDisplay);
        tallyDisplay.setText(Integer.toString(this._tally));
    }

    @Override
    protected void onStart() {
        super.onStart();
        this.loadState();
        this.updateUi();
    }

    @Override
    protected void onStop() {
        super.onStop();
        saveState();
    }

    private void loadState() {
        // See if we have previously saved the count, and load it
        SharedPreferences prefs = getPreferences(MODE_PRIVATE);
        this._tally = prefs.getInt("count", 0);
    }

    private void saveState() {
        // Get the preferences and the editor for the preferences
        SharedPreferences prefs = getPreferences(MODE_PRIVATE);
        SharedPreferences.Editor editor = prefs.edit();

        // Store our count..
        editor.putInt("count", this._tally);

        // Save changes
        editor.commit();
    }
}

Add state saving to Tally


package jwebform.integration.bean2form;

import java.util.Optional;
import jwebform.FormResult;
import jwebform.field.structure.Field;
import jwebform.field.structure.FieldResult;
import jwebform.processor.FieldResults;
import jwebform.model.FormModelBuilder;

public class FormResultWithBean extends FormResult {

  public FormResultWithBean(String formId, FieldResults fieldResults, boolean formIsValid, boolean isFirstRun,
      FormModelBuilder viewBuilder, Object bean) {
    super(formId, fieldResults, formIsValid, isFirstRun, viewBuilder);
    /*
     * if (bean instanceof JWebFormBean) { fillBean(bean, ((JWebFormBean) bean).postRun(this)); }
     * else { fillBean(bean, this); }
     */
  }

}

package jwebform.integration.bean2form;

import java.util.Optional;
import jwebform.FormResult;
import jwebform.field.structure.Field;
import jwebform.field.structure.FieldResult;
import jwebform.processor.FieldResults;
import jwebform.model.FormModelBuilder;

public class FormResultWithBean extends FormResult {

  private final Object bean;

  public FormResultWithBean(String formId, FieldResults fieldResults, boolean formIsValid, boolean isFirstRun,
      FormModelBuilder viewBuilder, Object bean) {
    super(formId, fieldResults, formIsValid, isFirstRun, viewBuilder);
    this.bean = bean;
    /*
     * if (bean instanceof JWebFormBean) { fillBean(bean, ((JWebFormBean) bean).postRun(this)); }
     * else { fillBean(bean, this); }
     */
  }

  public Object getBean() {
    return bean;
  }
}

Enable access to bean for FormRunner