package jsr181.jaxb.globalweather;

import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;

import org.codehaus.xfire.fault.XFireFault;

@WebService(serviceName = "GlobalWeather", targetNamespace = "http://www.webserviceX.NET", endpointInterface = "jsr181.jaxb.globalweather.GlobalWeatherSoap")
@SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL, parameterStyle = ParameterStyle.WRAPPED)
public class GlobalWeatherCustomImpl
    implements GlobalWeatherSoap
{

    public String GetCitiesByCountry(String CountryName)
        throws XFireFault
    {
        return null;
    }

    public String GetWeather(String CityName, String CountryName)
        throws XFireFault
    {
        return "foo";
    }

}

package jsr181.jaxb.globalweather;

import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;

@WebService(serviceName = "GlobalWeather", targetNamespace = "http://www.webserviceX.NET", endpointInterface = "jsr181.jaxb.globalweather.GlobalWeatherSoap")
@SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL, parameterStyle = ParameterStyle.WRAPPED)
public class GlobalWeatherCustomImpl
    implements GlobalWeatherSoap
{

    public String GetCitiesByCountry(String CountryName)
    {
        return null;
    }

    public String GetWeather(String CityName, String CountryName)
    {
        return "foo";
    }

}

Fix test which didn't compile


package org.obolibrary.robot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import py4j.GatewayServer;

/**
 * Starts a gateway server for Py4J to execute ROBOT operations via Python. This class can be used
 * to start the JVM directly from python using Py4J's `launch_gateway`.
 *
 * @author Becky Jackson
 */
public class PythonOperation {

  /** Logger. */
  private static final Logger logger = LoggerFactory.getLogger(PythonOperation.class);

  /**
   * Run a Gateway Server.
   *
   * @param args strings to use as arguments
   */
  public void main(String[] args) {
    run(null);
  }

  /**
   * Run a Gateway Server.
   *
   * @param port port to run JVM on, or null
   */
  public static void run(Integer port) {
    GatewayServer gs;
    if (port != null) {
      gs = new GatewayServer(null, port);
    } else {
      gs = new GatewayServer(null);
    }
    try {
      gs.start();
      port = gs.getPort();
      logger.debug(String.format("JVM started on port %d", port));
    } finally {
      gs.shutdown();
    }
  }
}

package org.obolibrary.robot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import py4j.GatewayServer;

/**
 * Starts a gateway server for Py4J to execute ROBOT operations via Python. This class can be used
 * to start the JVM directly from python using Py4J's `launch_gateway`.
 *
 * @author Becky Jackson
 */
public class PythonOperation {

  /** Logger. */
  private static final Logger logger = LoggerFactory.getLogger(PythonOperation.class);

  /**
   * Run a Gateway Server.
   *
   * @param args strings to use as arguments
   */
  public void main(String[] args) {
    GatewayServer gs = null;
    try {
      gs = run(null);
    } finally {
      if (gs != null) {
        gs.shutdown();
      }
    }
  }

  /**
   * Run a Gateway Server.
   *
   * @param port port to run JVM on, or null
   */
  public static GatewayServer run(Integer port) {
    GatewayServer gs;
    if (port != null) {
      gs = new GatewayServer(null, port);
    } else {
      gs = new GatewayServer(null);
    }
    gs.start();
    port = gs.getPort();
    logger.debug(String.format("JVM started on port %d", port));
    return gs;
  }
}

Make sure JVM doesn't shutdown from command line


package org.codehaus.modello.metadata;

/*
 * LICENSE
 */

import org.codehaus.modello.AbstractLogEnabled;
import org.codehaus.modello.Model;
import org.codehaus.modello.ModelClass;
import org.codehaus.modello.ModelField;
import org.codehaus.modello.ModelloException;

import java.util.Map;

/**
 * @author Trygve Laugstøl
 * @version $Id$
 */
public abstract class AbstractMetaDataPlugin
    extends AbstractLogEnabled
    implements MetaDataPlugin
{
    public MetaData getModelMetaData( Model model )
    {
        return null;
    }

    public MetaData getClassMetaData( ModelClass clazz )
    {
        return null;
    }

    public MetaData getFieldMetaData( ModelField field )
    {
        return null;
    }

    public Map getModelMap( Model model, MetaData metaData )
        throws ModelloException
    {
        return null;
    }

    public Map getClassMap( ModelClass clazz, MetaData metaData )
        throws ModelloException
    {
        return null;
    }

    public Map getFieldMap( ModelField field, MetaData metaData )
        throws ModelloException
    {
        return null;
    }
}

package org.codehaus.modello.metadata;

/*
 * LICENSE
 */

import org.codehaus.modello.AbstractLogEnabled;
import org.codehaus.modello.Model;
import org.codehaus.modello.ModelClass;
import org.codehaus.modello.ModelField;
import org.codehaus.modello.ModelloException;

import java.util.Map;

/**
 * @author Trygve Laugstøl
 * @version $Id$
 */
public abstract class AbstractMetaDataPlugin
    extends AbstractLogEnabled
    implements MetaDataPlugin
{
    public Map getModelMap( Model model, MetaData metaData )
        throws ModelloException
    {
        return null;
    }

    public Map getClassMap( ModelClass clazz, MetaData metaData )
        throws ModelloException
    {
        return null;
    }

    public Map getFieldMap( ModelField field, MetaData metaData )
        throws ModelloException
    {
        return null;
    }
}

Remove methods implementation that must be do in subclasses.


package ru.ming13.muzei.earthview.api;

import android.support.annotation.NonNull;
import android.util.Base64;

import java.util.Locale;

import ru.ming13.muzei.earthview.model.Wallpaper;
import ru.ming13.muzei.earthview.util.DataUris;
import ru.ming13.muzei.earthview.util.Strings;

final class WallpaperOperator
{
	public byte[] getBytes(@NonNull Wallpaper wallpaper) {
		return Base64.decode(DataUris.getData(wallpaper.getDataUri()), Base64.DEFAULT);
	}

	public String getTitle(@NonNull Wallpaper wallpaper) {
		if (Strings.isEmpty(wallpaper.getArea().getRegion())) {
			return wallpaper.getArea().getCountry();
		}

		return String.format(Locale.US, "%s, %s", wallpaper.getArea().getRegion(), wallpaper.getArea().getCountry());
	}

	public String getDescription(@NonNull Wallpaper wallpaper) {
		return wallpaper.getAttribution();
	}
}

package ru.ming13.muzei.earthview.api;

import android.support.annotation.NonNull;
import android.util.Base64;

import java.util.Locale;

import ru.ming13.muzei.earthview.model.Wallpaper;
import ru.ming13.muzei.earthview.util.DataUris;
import ru.ming13.muzei.earthview.util.Strings;

final class WallpaperOperator
{
	public byte[] getBytes(@NonNull Wallpaper wallpaper) {
		return Base64.decode(DataUris.getData(wallpaper.getDataUri()), Base64.DEFAULT);
	}

	public String getTitle(@NonNull Wallpaper wallpaper) {
		if (Strings.isEmpty(wallpaper.getArea().getRegion())) {
			return wallpaper.getArea().getCountry();
		}

		return String.format(Locale.US, "%s, %s", wallpaper.getArea().getRegion(), wallpaper.getArea().getCountry());
	}

	public String getDescription(@NonNull Wallpaper wallpaper) {
		return wallpaper.getAttribution().replace("\u00a9", "\u00a9 ");
	}
}

Add space after copyright symbol in description.


package com.ibm.mil.smartringer;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;

public class IncomingCallReceiver extends BroadcastReceiver {
    private static final String TAG = IncomingCallReceiver.class.getName();

    private static PhoneStateListener phoneStateListener;

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(TAG, "Received system event for change in phone state");

        // register phone state listener only once
        if (phoneStateListener == null) {
            Log.i(TAG, "Phone state listener is being initialized");
            phoneStateListener = new IncomingCallPhoneStateListener(context);
            TelephonyManager telephonyManager = (TelephonyManager)
                    context.getSystemService(Context.TELEPHONY_SERVICE);
            telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
        }
    }

    private static class IncomingCallPhoneStateListener extends PhoneStateListener {
        private Context mContext;
        private boolean isInitialRing = true;

        public IncomingCallPhoneStateListener(Context context) {
            mContext = context;
        }

        @Override
        public void onCallStateChanged(int state, String incomingNumber) {
            if (state == TelephonyManager.CALL_STATE_RINGING && isInitialRing) {
                mContext.startService(new Intent(mContext, RingerAdjusterService.class));

                // prevents CALL_STATE_RINGING from being triggered multiple times
                isInitialRing = false;
            }
        }
    }

}

package com.ibm.mil.smartringer;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;

public class IncomingCallReceiver extends BroadcastReceiver {
    private static final String TAG = IncomingCallReceiver.class.getName();

    private static PhoneStateListener phoneStateListener;

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(TAG, "Received system event for change in phone state");

        // register phone state listener only once
        if (phoneStateListener == null) {
            phoneStateListener = new IncomingCallPhoneStateListener(context);
            TelephonyManager telephonyManager = (TelephonyManager)
                    context.getSystemService(Context.TELEPHONY_SERVICE);
            telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
        }
    }

    private static class IncomingCallPhoneStateListener extends PhoneStateListener {
        Context mContext;
        boolean isInitialRing = true;

        IncomingCallPhoneStateListener(Context context) {
            mContext = context;
        }

        @Override
        public void onCallStateChanged(int state, String incomingNumber) {
            if (state == TelephonyManager.CALL_STATE_RINGING && isInitialRing) {
                mContext.startService(new Intent(mContext, RingerAdjusterService.class));

                // prevents CALL_STATE_RINGING from being triggered multiple times
                isInitialRing = false;
            }
        }
    }

}

Remove unnecessary access modifiers from nested private class


public class Sort {
	public enum DIRECTION {ASCENDING,DESCENDING};

	public void sort(Table _targetTable, DIRECTION d) {

	}
}

Revert "Revert "Started the sort method""


package com.google.slurp.servlets;

import java.io.IOException;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;

/**
 * Servlet context listener that is looked for whenever the backend server
 * receives a startup or shutdown request.
 */
@WebListener
public class ServerListener implements ServletContextListener {
  /**
   * {@inheritDoc}
   *
   * Initialize the Firebase Admin app for the server.
   */
  @Override
  public void contextInitialized(ServletContextEvent event) {
    System.out.println("Server initialized and starting up...");

    try {
      FirebaseOptions options = new FirebaseOptions.Builder()
                                    .setCredentials(GoogleCredentials.getApplicationDefault())
                                    .build();

      FirebaseApp.initializeApp(options);
    } catch (IOException error) {
      System.err.println("Error obtaining the Application Default Credentials:");
      error.printStackTrace();
    }
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public void contextDestroyed(ServletContextEvent event) {
    System.out.println("Server destroyed and shutting down...");
  }
}

package com.google.slurp.servlets;

import java.io.IOException;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;

/**
 * Servlet context listener that is looked for whenever the backend server
 * receives a startup or shutdown request.
 */
@WebListener
public class ServerListener implements ServletContextListener {
  public FirebaseApp app;

  /**
   * {@inheritDoc}
   *
   * Initialize the Firebase Admin app for the server.
   */
  @Override
  public void contextInitialized(ServletContextEvent event) {
    System.out.println("Server initialized and starting up...");

    try {
      FirebaseOptions options = new FirebaseOptions.Builder()
                                    .setCredentials(GoogleCredentials.getApplicationDefault())
                                    .build();

      app = FirebaseApp.initializeApp(options);
    } catch (IOException error) {
      System.err.println("Error obtaining the Application Default Credentials:");
      error.printStackTrace();
    }
  }

  /**
   * {@inheritDoc}
   *
   * Delete the Firebase Admin app.
   */
  @Override
  public void contextDestroyed(ServletContextEvent event) {
    System.out.println("Server destroyed and shutting down...");

    app.delete();
  }
}

Delete FirebaseApp on server shutdown


package com.netflix.governator;

import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Singleton;

import org.testng.annotations.Test;

public class ShutdownHookModuleTest {
    @Singleton
    private static class MySingleton {
        @Override
        public String toString() {
            return "MySingleton [initCounter=" + initCounter.get()
                    + ", shutdownCounter=" + shutdownCounter.get() + "]";
        }

        private AtomicInteger initCounter = new AtomicInteger(0);
        private AtomicInteger shutdownCounter = new AtomicInteger(0);

        @PostConstruct
        void init() {
            initCounter.incrementAndGet();
        }

        @PreDestroy
        void shutdown() {
            shutdownCounter.incrementAndGet();
        }
    }

    @Test
    public void test() throws InterruptedException {
        System.out.println("Starting");
        LifecycleInjector injector = Governator.createInjector(new LifecycleModule(), new ShutdownHookModule());
        Executors.newScheduledThreadPool(1).schedule(new Runnable(){
            @Override
            public void run() {
                System.out.println("Terminating");
                System.exit(-1);
            }
        }, 100, TimeUnit.MILLISECONDS);

        MySingleton singleton = injector.getInstance(MySingleton.class);

        System.out.println("Waiting");
        injector.awaitTermination();
        System.out.println("Terminated : " + singleton);
    }
}

package com.netflix.governator;

import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Singleton;

import org.testng.annotations.Test;

public class ShutdownHookModuleTest {
    @Singleton
    private static class MySingleton {
        @Override
        public String toString() {
            return "MySingleton [initCounter=" + initCounter.get()
                    + ", shutdownCounter=" + shutdownCounter.get() + "]";
        }

        private AtomicInteger initCounter = new AtomicInteger(0);
        private AtomicInteger shutdownCounter = new AtomicInteger(0);

        @PostConstruct
        void init() {
            initCounter.incrementAndGet();
        }

        @PreDestroy
        void shutdown() {
            shutdownCounter.incrementAndGet();
        }
    }

    @Test(enabled=false)
    public void test() throws InterruptedException {
        System.out.println("Starting");
        LifecycleInjector injector = Governator.createInjector(new LifecycleModule(), new ShutdownHookModule());
        Executors.newScheduledThreadPool(1).schedule(new Runnable(){
            @Override
            public void run() {
                System.out.println("Terminating");
                System.exit(-1);
            }
        }, 100, TimeUnit.MILLISECONDS);

        MySingleton singleton = injector.getInstance(MySingleton.class);

        System.out.println("Waiting");
        injector.awaitTermination();
        System.out.println("Terminated : " + singleton);
    }
}

Disable test that calls System.exit


package org.apache;

import org.apache.catalina.ha.session.TestSerializablePrincipal;
import org.apache.catalina.startup.TestTomcat;
import org.apache.catalina.tribes.test.TribesTestSuite;
import org.apache.el.lang.TestELSupport;
import org.apache.el.TestELEvaluation;
import org.apache.tomcat.util.http.TestCookies;
import org.apache.tomcat.util.res.TestStringManager;

import junit.framework.Test;
import junit.framework.TestSuite;

public class TestAll {

    public static Test suite() {
        TestSuite suite = new TestSuite("Test for org.apache");
        // o.a.catalina.ha.session
        suite.addTestSuite(TestSerializablePrincipal.class);
        // o.a.catalina.startup
        suite.addTestSuite(TestTomcat.class);
        // o.a.tomcat.util.http
        suite.addTestSuite(TestCookies.class);
        // Tribes
        // suite.addTest(TribesTestSuite.suite());
        // o.a.el
        suite.addTestSuite(TestELSupport.class);
        suite.addTestSuite(TestELEvaluation.class);
        // o.a.tomcat.util
        suite.addTestSuite(TestStringManager.class);

        return suite;
    }

}

package org.apache;

import org.apache.catalina.connector.TestRequest;
import org.apache.catalina.ha.session.TestSerializablePrincipal;
import org.apache.catalina.startup.TestTomcat;
import org.apache.catalina.tribes.test.TribesTestSuite;
import org.apache.el.lang.TestELSupport;
import org.apache.el.TestELEvaluation;
import org.apache.tomcat.util.http.TestCookies;
import org.apache.tomcat.util.res.TestStringManager;

import junit.framework.Test;
import junit.framework.TestSuite;

public class TestAll {

    public static Test suite() {
        TestSuite suite = new TestSuite("Test for org.apache");
        // o.a.catalina
        // connector
        suite.addTestSuite(TestRequest.class);
        // ha.session
        suite.addTestSuite(TestSerializablePrincipal.class);
        // startup
        suite.addTestSuite(TestTomcat.class);
        // tribes
        // suite.addTest(TribesTestSuite.suite());

        // o.a.el
        suite.addTestSuite(TestELSupport.class);
        suite.addTestSuite(TestELEvaluation.class);

        // o.a.tomcat.util
        // http
        suite.addTestSuite(TestCookies.class);
        // res
        suite.addTestSuite(TestStringManager.class);

        return suite;
    }

}

Add missing test Re-arrange to try and make it easier to see what is what


package com.intellij.debugger.streams.action;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;

/**
 * @author Vitaliy.Bibaev
 */
public class TraceStreamAction extends AnAction {
  private static class Holder {
    private static final JvmStreamDebuggerActionHandler HANDLER = new JvmStreamDebuggerActionHandler();
  }

  @Override
  public void actionPerformed(AnActionEvent e) {
    final Project project = e.getProject();
    if (project != null && Holder.HANDLER.isEnabled(project)) {
      Holder.HANDLER.perform(project);
    }
  }
}

package com.intellij.debugger.streams.action;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;

/**
 * @author Vitaliy.Bibaev
 */
public class TraceStreamAction extends AnAction {
  private static class Holder {
    private static final JvmStreamDebuggerActionHandler HANDLER = new JvmStreamDebuggerActionHandler();
  }

  @Override
  public void update(AnActionEvent e) {
    final Project project = e.getProject();
    if (project != null) {
      e.getPresentation().setEnabled(Holder.HANDLER.isEnabled(project));
      return;
    }
    e.getPresentation().setEnabled(false);
  }

  @Override
  public void actionPerformed(AnActionEvent e) {
    final Project project = e.getProject();
    if (project != null && Holder.HANDLER.isEnabled(project)) {
      Holder.HANDLER.perform(project);
    }
  }
}

Disable the action on the debug toolbar if there is no stream call


// Copyright 2017 The Nomulus 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 google.registry.config;

import static com.google.common.truth.Truth.assertThat;

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

@RunWith(JUnit4.class)
public class RegistryConfigTest {

  public RegistryConfigTest() {}

  @Test
  public void test_clientSecretFilename() {
    RegistryConfigSettings config = YamlUtils.getConfigSettings();
    // Verify that we're pulling this from the default.
    assertThat(RegistryConfig.getClientSecretFilename()).isEqualTo(
        "/google/registry/tools/resources/client_secret.json");
  }
}

// Copyright 2017 The Nomulus 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 google.registry.config;

import static com.google.common.truth.Truth.assertThat;

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

@RunWith(JUnit4.class)
public class RegistryConfigTest {

  public RegistryConfigTest() {}

  @Test
  public void test_clientSecretFilename() {
    RegistryConfigSettings unused = YamlUtils.getConfigSettings();
    // Verify that we're pulling this from the default.
    assertThat(RegistryConfig.getClientSecretFilename()).isEqualTo(
        "/google/registry/tools/resources/client_secret.json");
  }
}

Fix unused variable and missing end newline


/*
 * oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2014, Gluu
 */

package org.xdi.ldap.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.gluu.site.ldap.persistence.annotation.LdapAttributesList;
import org.gluu.site.ldap.persistence.annotation.LdapEntry;
import org.gluu.site.ldap.persistence.annotation.LdapObjectClass;

/**
 * @author Yuriy Movchan Date: 04/08/2014
 */
@LdapEntry
@LdapObjectClass(values = { "top" })
public class CustomEntry extends BaseEntry implements Serializable {

	private static final long serialVersionUID = -7686468010219068788L;

	@LdapAttributesList(name = "name", value = "values", sortByName = true)
	private List<CustomAttribute> customAttributes = new ArrayList<CustomAttribute>();

	public List<CustomAttribute> getCustomAttributes() {
		return customAttributes;
	}

	public void setCustomAttributes(List<CustomAttribute> customAttributes) {
		this.customAttributes = customAttributes;
	}

}

/*
 * oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2014, Gluu
 */

package org.xdi.ldap.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.gluu.site.ldap.persistence.annotation.LdapAttributesList;
import org.gluu.site.ldap.persistence.annotation.LdapEntry;
import org.gluu.site.ldap.persistence.annotation.LdapObjectClass;
import org.xdi.util.StringHelper;

/**
 * @author Yuriy Movchan Date: 04/08/2014
 */
@LdapEntry
@LdapObjectClass(values = { "top" })
public class CustomEntry extends BaseEntry implements Serializable {

	private static final long serialVersionUID = -7686468010219068788L;

	@LdapAttributesList(name = "name", value = "values", sortByName = true)
	private List<CustomAttribute> customAttributes = new ArrayList<CustomAttribute>();

	public List<CustomAttribute> getCustomAttributes() {
		return customAttributes;
	}

	public String getCustomAttributeValue(String attributeName) {
		if (customAttributes == null) {
			return null;
		}

		for (CustomAttribute customAttribute : customAttributes) {
			if (StringHelper.equalsIgnoreCase(attributeName, customAttribute.getName())) {
				return customAttribute.getValue();
			}
		}

		return null;
	}

	public void setCustomAttributes(List<CustomAttribute> customAttributes) {
		this.customAttributes = customAttributes;
	}

}

Add utility method to get attribute value


package com.slack.api.model.view;

import com.slack.api.model.block.composition.PlainTextObject;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ViewState {
    // block_id, action_id
    private Map<String, Map<String, Value>> values;

    /**
     * This class may miss some attributes.
     * If you find missing ones, let us know at https://github.com/seratch/jslack/issues
     */
    @Data
    public static class Value {
        private String type;
        private String value;
        private String selectedDate;
        private String selectedConversation;
        private String selectedChannel;
        private String selectedUser;
        private SelectedOption selectedOption;
        private List<String> selectedUsers;
    }

    @Data
    public static class SelectedOption {
        private PlainTextObject text;
        private String value;
    }
}

package com.slack.api.model.view;

import com.slack.api.model.block.composition.PlainTextObject;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ViewState {
    // block_id, action_id
    private Map<String, Map<String, Value>> values;

    @Data
    public static class Value {
        private String type;
        private String value;
        private String selectedDate;
        private String selectedConversation;
        private String selectedChannel;
        private String selectedUser;
        private SelectedOption selectedOption;
        private List<String> selectedConversations;
        private List<String> selectedChannels;
        private List<String> selectedUsers;
        private List<SelectedOption> selectedOptions;
    }

    @Data
    public static class SelectedOption {
        private PlainTextObject text;
        private String value;
    }
}

Add missing fields in view.state.values


package de.philipphager.disclosure.feature.analyser.app;

import dalvik.system.DexFile;
import de.philipphager.disclosure.database.app.model.App;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import rx.Observable;
import timber.log.Timber;

public class Apk {
  private static final int MIN_INDEX = 0;
  private final App app;
  private List<String> sortedClassNames;

  public Apk(App app) throws IOException {
    this.app = app;
    load();
  }

  private void load() throws IOException {
    File file = new File(app.sourceDir());
    List<String> classNames = new ArrayList<>();

    if (file.exists()) {
      DexFile dexFile = new DexFile(app.sourceDir());
      classNames.addAll(Collections.list(dexFile.entries()));
    }

    sortedClassNames = Observable.from(classNames)
        .distinct()
        .toSortedList()
        .toBlocking()
        .first();
  }

  public boolean containsPackage(String packageName) {
    String currentThread = Thread.currentThread().getName();
    Timber.d("%s : Searching for package %s in app %s", currentThread, packageName, app.label());

    int index = Collections.binarySearch(sortedClassNames, packageName, (currentItem, key) -> {
      if (currentItem.startsWith(key)) {
        return 0;
      }
      return currentItem.compareTo(key);
    });
    return index >= MIN_INDEX;
  }
}

package de.philipphager.disclosure.feature.analyser.app;

import dalvik.system.DexFile;
import de.philipphager.disclosure.database.app.model.App;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import rx.Observable;
import timber.log.Timber;

public class Apk {
  private static final int MIN_INDEX = 0;
  private final App app;
  private List<String> sortedClassNames;

  public Apk(App app) throws IOException {
    this.app = app;
    load();
  }

  private void load() throws IOException {
    File file = new File(app.sourceDir());
    List<String> classNames = new ArrayList<>();

    if (file.exists()) {
      DexFile dexFile = new DexFile(app.sourceDir());
      classNames.addAll(Collections.list(dexFile.entries()));
    }

    sortedClassNames = Observable.from(classNames)
        .distinct()
        .toSortedList()
        .toBlocking()
        .first();
  }

  public boolean containsPackage(String packageName) {
    String currentThread = Thread.currentThread().getName();
    Timber.v("%s : Searching for package %s in app %s", currentThread, packageName, app.label());

    int index = Collections.binarySearch(sortedClassNames, packageName, (currentItem, key) -> {
      if (currentItem.startsWith(key)) {
        return 0;
      }
      return currentItem.compareTo(key);
    });
    return index >= MIN_INDEX;
  }
}

Move search log to level verbose


package com.github.mrloyal.flatexcelmapper;

import org.apache.poi.xssf.usermodel.XSSFSheet;

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

public class FlatExcelMapper {

    public <T extends Object>List<T> read(String fileName, int sheetIndex, Class<T> clazz){
        List<T> list = null;

        return list;
    }

    public <T extends Object>List<T> read(File file, int sheetIndex, Class<T> clazz){
        List<T> list = null;

        return list;
    }

    public <T extends Object>List<T> read(XSSFSheet sheet, Class<T> clazz){
        List<T> list = null;

        return list;
    }

    public <T extends Object> T readRow(XSSFSheet sheet, int humanReadableRow, Class<T> clazz) throws IllegalAccessException, InstantiationException {
        T object = clazz.newInstance();

        return object;
    }
}

package com.github.mrloyal.flatexcelmapper;

import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;

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

public class FlatExcelMapper {

    public <T extends Object>List<T> read(String fileName, int sheetIndex, Class<T> clazz){
        List<T> list = null;

        return list;
    }

    public <T extends Object>List<T> read(File file, int sheetIndex, Class<T> clazz){
        List<T> list = null;

        return list;
    }

    public <T extends Object>List<T> read(XSSFSheet sheet, Class<T> clazz){
        List<T> list = null;

        return list;
    }

    public <T extends Object> T readRow(XSSFSheet sheet, int humanReadableRow, Class<T> clazz) throws IllegalAccessException, InstantiationException {
        T object = clazz.newInstance();

        return object;
    }

    public <T extends Object> T readRow(XSSFRow excelRow, Class<T> clazz){
        return null;
    }
}

Add signature for reading one row


package org.fluentd.logger.sender;

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

import java.util.Deque;
import java.util.LinkedList;

/**
 * Calculate exponential delay for reconnecting
 */
public class ConstantDelayReconnector implements Reconnector {
    private static final Logger LOG = LoggerFactory.getLogger(ConstantDelayReconnector.class);

    private double wait = 50; // Default wait to 50 ms

    private static final int MAX_ERROR_HISTORY_SIZE = 100;

    private Deque<Long> errorHistory = new LinkedList<Long>();

    public ConstantDelayReconnector() {
        errorHistory = new LinkedList<Long>();
    }

    public ConstantDelayReconnector(int wait) {
        this.wait = wait;
        errorHistory = new LinkedList<Long>();
    }

    public void addErrorHistory(long timestamp) {
        errorHistory.addLast(timestamp);
        if (errorHistory.size() > MAX_ERROR_HISTORY_SIZE) {
            errorHistory.removeFirst();
        }
    }

    public boolean isErrorHistoryEmpty() {
        return errorHistory.isEmpty();
    }

    public void clearErrorHistory() {
        errorHistory.clear();
    }

    public boolean enableReconnection(long timestamp) {
        int size = errorHistory.size();
        if (size == 0) {
            return true;
        }

        return (!(timestamp - errorHistory.getLast() < wait));
    }

}

Add an empty line at the end of the file


/*
 * Copyright (c) 2009 Kathryn Huxtable and Kenneth Orr.
 *
 * This file is part of the SeaGlass Pluggable Look and Feel.
 *
 * 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.
 *
 * $Id$
 */
package com.seaglasslookandfeel.state;

import javax.swing.JComponent;
import javax.swing.text.JTextComponent;

/**
 * Is the text field a search field variant?
 */
public class TextFieldIsSearchState extends State {
    public TextFieldIsSearchState() {
        super("IsSearchField");
    }

    public boolean isInState(JComponent c) {
        return (c instanceof JTextComponent) && "search".equals(c.getClientProperty("JTextField.variant"));
    }
}

/*
 * Copyright (c) 2009 Kathryn Huxtable and Kenneth Orr.
 *
 * This file is part of the SeaGlass Pluggable Look and Feel.
 *
 * 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.
 *
 * $Id$
 */
package com.seaglasslookandfeel.state;

import javax.swing.JComponent;
import javax.swing.text.JTextComponent;

/**
 * Is the text field a search field variant?
 */
public class TextFieldIsSearchState extends State {
    public TextFieldIsSearchState() {
        super("SearchField");
    }

    public boolean isInState(JComponent c) {
        return (c instanceof JTextComponent) && "search".equals(c.getClientProperty("JTextField.variant"));
    }
}

Change name of state to SearchField. Apparently the name has to match the state.


package info.u_team.u_team_core.container;

import net.minecraft.inventory.container.*;

public abstract class FluidContainer extends Container {

	public FluidContainer(ContainerType<?> type, int id) {
		super(type, id);
	}
}

package info.u_team.u_team_core.container;

import java.util.List;

import com.google.common.collect.Lists;

import net.minecraft.inventory.container.*;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fluids.FluidStack;

public abstract class FluidContainer extends Container {

	private final NonNullList<FluidStack> fluidStacks = NonNullList.create();
	public final List<FluidSlot> fluidSlots = Lists.newArrayList();

	public FluidContainer(ContainerType<?> type, int id) {
		super(type, id);
	}

	protected FluidSlot addFluidSlot(FluidSlot slot) {
		fluidSlots.add(slot);
		fluidStacks.add(FluidStack.EMPTY);
		return slot;
	}

	public FluidSlot getFluidSlot(int slot) {
		return fluidSlots.get(slot);
	}

	public NonNullList<FluidStack> getFluids() {
		final NonNullList<FluidStack> list = NonNullList.create();

		for (int index = 0; index < fluidSlots.size(); index++) {
			list.add(fluidSlots.get(index).getStack());
		}
		return list;
	}

	// Used for sync with the client

	public void setFluidStackInSlot(int slot, FluidStack stack) {
		getFluidSlot(slot).putStack(stack);
	}

	public void setAllFluidSlots(List<FluidStack> list) {
		for (int index = 0; index < list.size(); index++) {
			getFluidSlot(index).putStack(list.get(index));
		}
	}
}

Add some more methods to the fluid container


// Security.java

package ed.security;

import ed.js.engine.*;

public class Security {

    public final static boolean OFF = Boolean.getBoolean( "NO-SECURITY" );
    final static boolean TEST_BYPASS = Boolean.getBoolean("ed.js.engine.SECURITY_BYPASS");

    final static String SECURE[] = new String[]{
        Convert.DEFAULT_PACKAGE + "._data_corejs_" ,
        Convert.DEFAULT_PACKAGE + "._data_sites_admin_" ,
        Convert.DEFAULT_PACKAGE + "._data_sites_www_" ,
        Convert.DEFAULT_PACKAGE + ".lastline"
    };

    public static boolean isCoreJS(){
        if ( OFF )
            return true;

        String topjs = getTopJS();
        if ( topjs == null ) {
            return false;
        }

        if (TEST_BYPASS && _isTestFrameworkHack()) {
            return true;
        }

        for ( int i=0; i<SECURE.length; i++ )
            if ( topjs.startsWith( SECURE[i] ) )
                return true;

        return false;
    }

    static boolean _isTestFrameworkHack() {
        StackTraceElement[] st = Thread.currentThread().getStackTrace();

        for(StackTraceElement e : st) {
            if ( e.getClassName().startsWith("ed.js.engine.JSTestInstance"))
                return true;
        }

        return false;
    }

    public static String getTopJS(){

        StackTraceElement[] st = Thread.currentThread().getStackTrace();

        for ( int i=0; i<st.length; i++ ){
            StackTraceElement e = st[i];
            if ( e.getClassName().startsWith( Convert.DEFAULT_PACKAGE + "." ) )
                return e.getClassName();
        }

        return null;
    }
}

// Security.java

package ed.security;

import ed.js.engine.*;

public class Security {

    public final static boolean OFF = Boolean.getBoolean( "NO-SECURITY" );

    final static String SECURE[] = new String[]{
        Convert.DEFAULT_PACKAGE + "._data_corejs_" ,
        Convert.DEFAULT_PACKAGE + "._data_sites_admin_" ,
        Convert.DEFAULT_PACKAGE + "._data_sites_www_" ,
        Convert.DEFAULT_PACKAGE + ".lastline"
    };

    public static boolean isCoreJS(){
        if ( OFF )
            return true;

        String topjs = getTopJS();
        if ( topjs == null ) {
            return false;
        }

        for ( int i=0; i<SECURE.length; i++ )
            if ( topjs.startsWith( SECURE[i] ) )
                return true;

        return false;
    }

    public static String getTopJS(){

        StackTraceElement[] st = Thread.currentThread().getStackTrace();

        for ( int i=0; i<st.length; i++ ){
            StackTraceElement e = st[i];
            if ( e.getClassName().startsWith( Convert.DEFAULT_PACKAGE + "." ) )
                return e.getClassName();
        }

        return null;
    }
}

Remove the security bypass hack. It's not needed anymore.


package som;

import java.util.Arrays;

public class VMOptions {
  public static final String STANDARD_PLATFORM_FILE = "core-lib/Platform.som";
  public static final String STANDARD_KERNEL_FILE   = "core-lib/Kernel.som";

  public String   platformFile = STANDARD_PLATFORM_FILE;
  public String   kernelFile   = STANDARD_KERNEL_FILE;
  public final String[] args;
  public final boolean showUsage;

  public VMOptions(final String[] args) {
    this.args = processVmArguments(args);
    showUsage = args.length == 0;
  }

  private String[] processVmArguments(final String[] arguments) {
    int currentArg = 0;

    // parse optional --platform and --kernel, need to be the first arguments
    boolean parsedArgument = true;

    while (parsedArgument) {
      if (currentArg >= arguments.length) {
        return arguments;
      } else {
        if (arguments[currentArg].equals("--platform")) {
          platformFile = arguments[currentArg + 1];
          currentArg += 2;
        } else if (arguments[currentArg].equals("--kernel")) {
          kernelFile = arguments[currentArg + 1];
          currentArg += 2;
        } else {
          parsedArgument = false;
        }
      }
    }

    // store remaining arguments
    if (currentArg < arguments.length) {
      return Arrays.copyOfRange(arguments, currentArg, arguments.length);
    } else {
      return arguments;
    }
  }
}

package som;

import java.util.Arrays;

public class VMOptions {
  public static final String STANDARD_PLATFORM_FILE = "core-lib/Platform.som";
  public static final String STANDARD_KERNEL_FILE   = "core-lib/Kernel.som";

  public String   platformFile = STANDARD_PLATFORM_FILE;
  public String   kernelFile   = STANDARD_KERNEL_FILE;
  public final String[] args;
  public final boolean showUsage;

  public VMOptions(final String[] args) {
    this.args = processVmArguments(args);
    showUsage = args.length == 0;
  }

  private String[] processVmArguments(final String[] arguments) {
    int currentArg = 0;

    // parse optional --platform and --kernel, need to be the first arguments
    boolean parsedArgument = true;

    while (parsedArgument) {
      if (currentArg >= arguments.length) {
        return null;
      } else {
        if (arguments[currentArg].equals("--platform")) {
          platformFile = arguments[currentArg + 1];
          currentArg += 2;
        } else if (arguments[currentArg].equals("--kernel")) {
          kernelFile = arguments[currentArg + 1];
          currentArg += 2;
        } else {
          parsedArgument = false;
        }
      }
    }

    // store remaining arguments
    if (currentArg < arguments.length) {
      return Arrays.copyOfRange(arguments, currentArg, arguments.length);
    } else {
      return null;
    }
  }
}

Fix bug in handling arguments


package org.javacs;

import java.util.logging.Level;
import java.util.logging.Logger;
import org.javacs.lsp.*;

public class Main {
    private static final Logger LOG = Logger.getLogger("main");

    public static void setRootFormat() {
        var root = Logger.getLogger("");

        for (var h : root.getHandlers()) h.setFormatter(new LogFormat());
    }

    private JavaLanguageServer createServer(LanguageClient client) {
        return new JavaLanguageServer(client);
    }

    public static void main(String[] args) {
        try {
            // Logger.getLogger("").addHandler(new FileHandler("javacs.%u.log", false));
            setRootFormat();

            LSP.connect(JavaLanguageServer::new, System.in, System.out);
        } catch (Throwable t) {
            LOG.log(Level.SEVERE, t.getMessage(), t);

            System.exit(1);
        }
    }
}

package org.javacs;

import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.javacs.lsp.*;

public class Main {
    private static final Logger LOG = Logger.getLogger("main");

    public static void setRootFormat() {
        var root = Logger.getLogger("");

        for (var h : root.getHandlers()) h.setFormatter(new LogFormat());
    }

    private JavaLanguageServer createServer(LanguageClient client) {
        return new JavaLanguageServer(client);
    }

    public static void main(String[] args) {
        boolean quiet = Arrays.stream(args).anyMatch("--quiet"::equals);

        if (quiet) {
          LOG.setLevel(Level.OFF);
        }

        try {
            // Logger.getLogger("").addHandler(new FileHandler("javacs.%u.log", false));
            setRootFormat();

            LSP.connect(JavaLanguageServer::new, System.in, System.out);
        } catch (Throwable t) {
            LOG.log(Level.SEVERE, t.getMessage(), t);

            System.exit(1);
        }
    }
}

Add '--quiet' option for standalone usage


package ca.ualberta.team7project.network;

public class ElasticSearchSearchResponse {

}

package ca.ualberta.team7project.network;

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

/*
 * Represents a search response from ElasticSearch.
 * Taken from https://github.com/zjullion/PicPosterComplete
 * which is taken from https://github.com/rayzhangcl/ESDemo
 */
public class ElasticSearchSearchResponse<T> {
	int took;
    boolean timed_out;
    transient Object _shards;
    Hits<T> hits;
    boolean exists;
    public Collection<ElasticSearchResponse<T>> getHits() {
        return hits.getHits();
    }
    public Collection<T> getSources() {
        Collection<T> out = new ArrayList<T>();
        for (ElasticSearchResponse<T> essrt : getHits()) {
            out.add( essrt.getSource() );
        }
        return out;
    }
    public String toString() {
        return (super.toString() + ":" + took + "," + _shards + "," + exists + ","  + hits);
    }
}

Add new changes to ElasticSearchOperation class


package com.hubspot.baragon.agent.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

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

import com.google.inject.Inject;
import com.hubspot.baragon.agent.managers.AgentRequestManager;

@Path("/renderedConfigs")
@Produces(MediaType.APPLICATION_JSON)
public class RenderedConfigsResource {
  private static final Logger LOG = LoggerFactory.getLogger(RenderedConfigsResource.class);

  private final AgentRequestManager agentRequestManager;

  @Inject
  public RenderedConfigsResource(
      AgentRequestManager agentRequestManager) {
    this.agentRequestManager = agentRequestManager;
  }

  @GET
  @Path("/{serviceId}")
  public Response getServiceId(@PathParam("serviceId") String serviceId) {
    LOG.info("Received request to view the renderedConfig of serviceId={}", serviceId);
    return agentRequestManager.getRenderedConfigs(serviceId);
  }
}

package com.hubspot.baragon.agent.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

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

import com.google.inject.Inject;
import com.hubspot.baragon.agent.managers.AgentRequestManager;
import com.hubspot.baragon.auth.NoAuth;

@Path("/renderedConfigs")
@Produces(MediaType.APPLICATION_JSON)
public class RenderedConfigsResource {
  private static final Logger LOG = LoggerFactory.getLogger(RenderedConfigsResource.class);

  private final AgentRequestManager agentRequestManager;

  @Inject
  public RenderedConfigsResource(
      AgentRequestManager agentRequestManager) {
    this.agentRequestManager = agentRequestManager;
  }

  @GET
  @NoAuth
  @Path("/{serviceId}")
  public Response getServiceId(@PathParam("serviceId") String serviceId) {
    LOG.info("Received request to view the renderedConfig of serviceId={}", serviceId);
    return agentRequestManager.getRenderedConfigs(serviceId);
  }
}

Make GET to /renderedConfigs/{serviceId} at the Agent level not require authentication


package org.robockets.stronghold.robot.commands;

import edu.wpi.first.wpilibj.command.CommandGroup;
import org.robockets.stronghold.robot.drivetrain.AssistedDrive;
import org.robockets.stronghold.robot.drivetrain.AssistedRotateType;
import org.robockets.stronghold.robot.drivetrain.AssistedTranslateType;

import org.robockets.stronghold.robot.drivetrain.TurnRelative;

public class SallyPort extends CommandGroup {
	public SallyPort() {
		addSequential(new AssistedDrive(AssistedTranslateType.ENCODER, AssistedRotateType.ENCODER, 1, 0 ));

		addSequential(new TurnRelative(50));

	}
}

package org.robockets.stronghold.robot.commands;

import edu.wpi.first.wpilibj.command.CommandGroup;
import org.robockets.stronghold.robot.drivetrain.AssistedDrive;
import org.robockets.stronghold.robot.drivetrain.AssistedRotateType;
import org.robockets.stronghold.robot.drivetrain.AssistedTranslateType;

import org.robockets.stronghold.robot.drivetrain.TurnRelative;

public class SallyPort extends CommandGroup {
	public SallyPort() {
		addSequential(new AssistedDrive(AssistedTranslateType.ENCODER, AssistedRotateType.ENCODER, 1, 0 ));

		//addSequential(new TurnRelative(50));

	}
}

Make the robot do its job.


package info.u_team.u_team_test.init;

import info.u_team.u_team_core.util.registry.BaseRegistryUtil;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.biome.BasicBiome;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.event.RegistryEvent.Register;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;

@EventBusSubscriber(modid = TestMod.MODID, bus = Bus.MOD)
public class TestBiomes {

	public static final Biome BASIC = new BasicBiome("basic");

	@SubscribeEvent
	public static void register(Register<Biome> event) {
		BaseRegistryUtil.getAllRegistryEntriesAndApplyNames(TestMod.MODID, Biome.class).forEach(event.getRegistry()::register);
	}
}

package info.u_team.u_team_test.init;

import info.u_team.u_team_core.util.registry.BaseRegistryUtil;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.biome.BasicBiome;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.event.RegistryEvent.Register;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.registries.*;

//@EventBusSubscriber(modid = TestMod.MODID, bus = Bus.MOD)
public class TestBiomes {

	//public static final Biome BASIC = new BasicBiome("basic");

	public static final DeferredRegister<Biome> BLOCKS = DeferredRegister.create(ForgeRegistries.BIOMES, TestMod.MODID);

	public static final RegistryObject<BasicBiome> BASIC = BLOCKS.register("basic", () -> new BasicBiome("basic"));

//	@SubscribeEvent
//	public static void register(Register<Biome> event) {
//		BaseRegistryUtil.getAllRegistryEntriesAndApplyNames(TestMod.MODID, Biome.class).forEach(event.getRegistry()::register);
//	}
}

Test deferred registry with biomes


package com.ilyamur.osgi.helloworld.impl;

import com.ilyamur.osgi.helloworld.service.OsgiHelloworldService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

import java.util.Hashtable;

public class Activator implements BundleActivator {

    @Override
    public void start(BundleContext bundleContext) throws Exception {
        Hashtable<String, String> props = new Hashtable<>();
        props.put("Language", "English");
        bundleContext.registerService(OsgiHelloworldService.class.getName(), new OsgiHelloworldServiceImpl(), props);
        System.out.println("osgi-helloworld start");
    }

    @Override
    public void stop(BundleContext bundleContext) throws Exception {
        System.out.println("osgi-helloworld stop");
    }
}

package com.ilyamur.osgi.helloworld.impl;

import com.ilyamur.osgi.helloworld.service.OsgiHelloworldService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

import java.util.Hashtable;

public class Activator implements BundleActivator {

    public void start(BundleContext bundleContext) throws Exception {
        Hashtable<String, String> props = new Hashtable<String, String>();
        props.put("Language", "English");
        bundleContext.registerService(OsgiHelloworldService.class.getName(), new OsgiHelloworldServiceImpl(), props);
        System.out.println("osgi-helloworld start");
    }

    public void stop(BundleContext bundleContext) throws Exception {
        System.out.println("osgi-helloworld stop");
    }
}

Fix sources to correspond with language level


package com.deuteriumlabs.dendrite.unittest;

import static org.junit.Assert.*;

import org.junit.Test;

public class PageIdTest {
    @Test
    public void test() {
        fail("Not yet implemented");
    }
}

package com.deuteriumlabs.dendrite.unittest;

import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import com.deuteriumlabs.dendrite.model.PageId;

public class PageIdTest {
    @Test
    public void testDefaultConstructor() {
        final PageId pageId = new PageId();
        assertNotNull(pageId);
    }
}

Add test for default constructor


/*
 * #%L
 * ACS AEM Commons Bundle
 * %%
 * Copyright (C) 2016 Adobe
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
@aQute.bnd.annotation.Version("2.2.0")
package com.adobe.acs.commons.fam;

/*
 * #%L
 * ACS AEM Commons Bundle
 * %%
 * Copyright (C) 2016 Adobe
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
@aQute.bnd.annotation.Version("2.3.0")
package com.adobe.acs.commons.fam;

Increment FAM due to addition of purge method


package org.msf.records.model;

import java.io.Serializable;

/**
 * Created by Gil on 03/10/2014.
 */
public class Patient implements Serializable {

    public String id;
    public String given_name;
    public String family_name;

    public String important_information;

    /**
     * Accepted values:
     * suspected, probable, confirmed, non-case, convalescent,
     * can_be_discharged, dischraged, suspected_dead, confirmed_dead
     */
    public String status;

    public boolean pregnant;

    // Must be "M" or "F".
    public String gender;

    @Deprecated
    public String movement;
    @Deprecated
    public String eating;

    public Long admission_timestamp;
    public Long created_timestamp;
    public Long first_showed_symptoms_timestamp;

    public String origin_location;
    // Not yet ready.
    public String next_of_kin;

    public PatientLocation assigned_location;
    public PatientAge age;

}

package org.msf.records.model;

import java.io.Serializable;

/**
 * Created by Gil on 03/10/2014.
 */
public class Patient implements Serializable {

    public String id;
    public String uuid;
    public String given_name;
    public String family_name;

    public String important_information;

    /**
     * Accepted values:
     * suspected, probable, confirmed, non-case, convalescent,
     * can_be_discharged, dischraged, suspected_dead, confirmed_dead
     */
    public String status;

    public boolean pregnant;

    // Must be "M" or "F".
    public String gender;

    @Deprecated
    public String movement;
    @Deprecated
    public String eating;

    public Long admission_timestamp;
    public Long created_timestamp;
    public Long first_showed_symptoms_timestamp;

    public String origin_location;
    // Not yet ready.
    public String next_of_kin;

    public PatientLocation assigned_location;
    public PatientAge age;

}

Add uuid to the patient bean in Android


//
// MessagePack for Java
//
// Copyright (C) 2009-2011 FURUHASHI Sadayuki
//
//    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.msgpack.template;

public class TemplateClassWriter {
	public static void write(Class<?> target, String directoryName) {
		if(target.isEnum()) {
			throw new UnsupportedOperationException("Not supported yet.");
		} else {
			TemplateBuilder.writeClass(target, directoryName);
		}
	}
}

//
// MessagePack for Java
//
// Copyright (C) 2009-2011 FURUHASHI Sadayuki
//
//    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.msgpack.template;

public class TemplateClassWriter {
	public static void write(Class<?> target, String directoryName) {
		if(target.isEnum()) {
			throw new UnsupportedOperationException("Not supported yet.");
		} else {
			//TemplateBuilder.writeClass(target, directoryName);
		}
	}
}

Fix compile error. This is a workaround.Please fix correctly in the future.


/*
 * Copyright 2012 - 2014 Maginatics, Inc.
 *
 * 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.maginatics.jdbclint;

import java.sql.SQLException;

/** Utility methods. */
final class Utils {
    private Utils() {
        // intentionally unimplemented
    }

    static void fail(final Configuration config, final Exception exception,
            final String message) throws SQLException {
        for (Configuration.Action action : config.getActions()) {
            action.apply(message, exception);
        }
    }

    static <T> T checkNotNull(final T obj) {
        if (obj == null) {
            throw new NullPointerException();
        }
        return obj;
    }
}

/*
 * Copyright 2012 - 2014 Maginatics, Inc.
 *
 * 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.maginatics.jdbclint;

import java.sql.SQLException;

/** Utility methods. */
final class Utils {
    private Utils() {
        throw new AssertionError("intentionally unimplemented");
    }

    static void fail(final Configuration config, final Exception exception,
            final String message) throws SQLException {
        for (Configuration.Action action : config.getActions()) {
            action.apply(message, exception);
        }
    }

    static <T> T checkNotNull(final T obj) {
        if (obj == null) {
            throw new NullPointerException();
        }
        return obj;
    }
}

Make utility constructor truly uninstantiable


package com.censoredsoftware.censoredlib.util;

import org.bukkit.Effect;
import org.bukkit.Location;

public class Spigots
{
	public static void playParticle(Location location, Effect effect, int offsetX, int offsetY, int offsetZ, float speed, int particles, int viewRadius)
	{
		location.getWorld().spigot().playEffect(location, effect, 1, 1, offsetX, offsetY, offsetZ, speed, particles, viewRadius);
	}
}

package com.censoredsoftware.censoredlib.util;

import org.bukkit.Effect;
import org.bukkit.Location;

public class Spigots
{
	public static void playParticle(Location location, Effect effect, int offsetX, int offsetY, int offsetZ, float speed, int particles, int viewRadius)
	{
		try
		{
			location.getWorld().spigot().playEffect(location, effect, 1, 1, offsetX, offsetY, offsetZ, speed, particles, viewRadius);
		}
		catch(Exception ignored)
		{}
	}
}

Fix for spigot API not being finished yet.


package mil.dds.anet.beans.search;

public abstract class AbstractSearchQuery implements ISearchQuery {

	private String text;
	private int pageNum;
	private int pageSize;

	public AbstractSearchQuery() {
		this.pageNum = 0;
		this.pageSize = 10;
	}

	@Override
	public String getText() {
		return text;
	}

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

	@Override
	public int getPageNum() {
		return pageNum;
	}

	@Override
	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	@Override
	public int getPageSize() {
		return pageSize;
	}

	@Override
	public void setPageSize(int pageSize) {
		if (pageSize == 0) { return; } // that makes no sense.
		this.pageSize = pageSize;
	}

}

package mil.dds.anet.beans.search;

public abstract class AbstractSearchQuery implements ISearchQuery {

	private String text;
	private int pageNum;
	private int pageSize;

	public AbstractSearchQuery() {
		this.pageNum = 0;
		this.pageSize = 10;
	}

	@Override
	public String getText() {
		return text;
	}

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

	@Override
	public int getPageNum() {
		return pageNum;
	}

	@Override
	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	@Override
	public int getPageSize() {
		return pageSize;
	}

	@Override
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

}

Allow pageSize to be zero (0) on searches


package org.sweetiebelle.mcprofiler.bukkit;

import java.util.UUID;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;

import net.milkbowl.vault.chat.Chat;

/**
 * This class will allow for multiple Permissions Plugins to be easily
 * supported.
 *
 */
class PermissionsController {
    private Chat chat;

    PermissionsController() {

        RegisteredServiceProvider<Chat> rsp = Bukkit.getServer().getServicesManager().getRegistration(Chat.class);
        this.chat = rsp.getProvider();

    }

    /**
     * Worker class for getting a prefix from a permissions plugin.
     *
     * @param uuid player UUID
     * @return the prefix, or b if no prefix providing plugin was found.
     */
    public String getPrefix(final UUID uuid) {

        if (chat != null) {
            Player player = Bukkit.getServer().getPlayer(uuid);
            String pref = chat.getPlayerPrefix(player);
            return pref.replace('&', ChatColor.COLOR_CHAR);
        }
        return "b";
    }
}

package org.sweetiebelle.mcprofiler.bukkit;

import java.util.UUID;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.plugin.RegisteredServiceProvider;

import net.milkbowl.vault.chat.Chat;

/**
 * This class will allow for multiple Permissions Plugins to be easily
 * supported.
 *
 */
class PermissionsController {
    private Chat chat;

    PermissionsController() {

        RegisteredServiceProvider<Chat> rsp = Bukkit.getServer().getServicesManager().getRegistration(Chat.class);
        this.chat = rsp.getProvider();

    }

    /**
     * Worker class for getting a prefix from a permissions plugin.
     *
     * @param uuid player UUID
     * @return the prefix, or &b if no prefix providing plugin was found.
     */
    public String getPrefix(final UUID uuid) {

        if (chat != null) {
            OfflinePlayer player = Bukkit.getServer().getOfflinePlayer(uuid);
            String pref = chat.getPlayerPrefix((String) null, player);
            return pref.replace('&', ChatColor.COLOR_CHAR);
        }
        return ChatColor.AQUA + "";
    }
}

Fix not being able to /status offline players


package org.webbitserver.stub;

import org.webbitserver.HttpRequest;
import org.webbitserver.WebSocketConnection;

/**
 * Implementation of WebSocketConnection that is easy to construct, and inspect results.
 * Useful for testing.
 *
 * @deprecated use {@link StubConnection}
 */
@Deprecated
public class StubWebSocketConnection extends StubConnection {
    public StubWebSocketConnection(HttpRequest httpRequest) {
        super(httpRequest);
    }

    public StubWebSocketConnection() {
        super();
    }
}

package org.webbitserver.stub;

import org.webbitserver.HttpRequest;
import org.webbitserver.WebSocketConnection;

/**
 * Implementation of {@link WebSocketConnection} that is easy to construct, and inspect results.
 * Useful for testing.
 *
 * @deprecated use {@link StubConnection}
 */
@Deprecated
public class StubWebSocketConnection extends StubConnection {
    public StubWebSocketConnection(HttpRequest httpRequest) {
        super(httpRequest);
    }

    public StubWebSocketConnection() {
        super();
    }
}

Add correct link to WebSocketConnection in docs


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

package org.apache.jmeter.threads;

import junit.framework.TestCase;

public class TestJMeterContextService extends TestCase {

    public TestJMeterContextService(String name) {
        super(name);
    }

    // Give access to the method for test code
    public static void incrNumberOfThreads(){
        JMeterContextService.incrNumberOfThreads();
    }
    // Give access to the method for test code
    public static void decrNumberOfThreads(){
        JMeterContextService.decrNumberOfThreads();
    }
}

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

package org.apache.jmeter.threads;

import junit.framework.TestCase;

public class TestJMeterContextService extends TestCase {

    public TestJMeterContextService(String name) {
        super(name);
    }

    public void testCounts(){
        assertEquals(0,JMeterContextService.getNumberOfThreads());
        assertEquals(0,JMeterContextService.getTotalThreads());
        incrNumberOfThreads();
        assertEquals(1,JMeterContextService.getNumberOfThreads());
        assertEquals(0,JMeterContextService.getTotalThreads());
        decrNumberOfThreads();
        assertEquals(0,JMeterContextService.getTotalThreads());
        assertEquals(0,JMeterContextService.getNumberOfThreads());
        JMeterContextService.addTotalThreads(27);
        JMeterContextService.addTotalThreads(27);
        assertEquals(54,JMeterContextService.getTotalThreads());
        assertEquals(0,JMeterContextService.getNumberOfThreads());
    }

    // Give access to the method for test code
    public static void incrNumberOfThreads(){
        JMeterContextService.incrNumberOfThreads();
    }
    // Give access to the method for test code
    public static void decrNumberOfThreads(){
        JMeterContextService.decrNumberOfThreads();
    }
}

Create some tests for JMeterContextService


package edu.berkeley.eecs.emission.cordova.tracker.location;

import android.content.Context;
import android.location.Location;

import com.google.android.gms.location.LocationRequest;

import edu.berkeley.eecs.emission.cordova.tracker.Constants;

/**
 * Created by shankari on 10/20/15.
 *
 * TODO: Change this to read the value from the usercache instead of the hardcoded value.
 */

public class LocationTrackingConfig {
    private Context cachedContext;

    protected LocationTrackingConfig(Context ctxt) {
        this.cachedContext = ctxt;
    }
    public static LocationTrackingConfig getConfig(Context context) {
        return new LocationTrackingConfig(context);
    }

    public boolean isDutyCycling() {
        return false;
    }

    public int getDetectionInterval() {
        return Constants.THIRTY_SECONDS;
    }

    public int getAccuracy() {
        return LocationRequest.PRIORITY_HIGH_ACCURACY;
    }

    public int getRadius() {
        return Constants.TRIP_EDGE_THRESHOLD;
    }

    public int getAccuracyThreshold() { return 200; }

    public int getResponsiveness() {
        return 5 * Constants.MILLISECONDS;
    }
}

package edu.berkeley.eecs.emission.cordova.tracker.location;

import android.content.Context;
import android.location.Location;

import com.google.android.gms.location.LocationRequest;

import edu.berkeley.eecs.emission.cordova.tracker.Constants;

/**
 * Created by shankari on 10/20/15.
 *
 * TODO: Change this to read the value from the usercache instead of the hardcoded value.
 */

public class LocationTrackingConfig {
    private Context cachedContext;

    protected LocationTrackingConfig(Context ctxt) {
        this.cachedContext = ctxt;
    }
    public static LocationTrackingConfig getConfig(Context context) {
        return new LocationTrackingConfig(context);
    }

    public boolean isDutyCycling() {
        return true;
    }

    public int getDetectionInterval() {
        return Constants.THIRTY_SECONDS;
    }

    public int getAccuracy() {
        return LocationRequest.PRIORITY_HIGH_ACCURACY;
    }

    public int getRadius() {
        return Constants.TRIP_EDGE_THRESHOLD;
    }

    public int getAccuracyThreshold() { return 200; }

    public int getResponsiveness() {
        return 5 * Constants.MILLISECONDS;
    }
}

Change the default to be geofencing with high accuracy at 30 sec intervals


package com.test.smartnotes.database;

/**
 * Created by saff on 08.06.17.
 */

public class NotesDbSchema {
    public static final class NotesTable {
        public static final String DATABASE_NAME = "NOTES";

        public static final class Cols {
            public static final String ID ="_id";
            public static final String NOTE_TITLE ="NOTE_TITLE";
            public static final String NOTE_TEXT ="NOTE_TEXT";
            public static final String IMPORTANCE ="IMPORTANCE";
            public static final String IMAGE_PATH ="IMAGE_PATH";
            public static final String LONGITUDE ="LONGITUDE";
            public static final String LATITUDE ="LATITUDE";
        }
    }
}

package com.test.smartnotes.database;

/**
 * Created by saff on 08.06.17.
 */

public class NotesDbSchema {
    public static final class NotesTable {
        public static final String NAME = "NOTES";

        public static final class Cols {
            public static final String ID ="_id";
            public static final String NOTE_TITLE ="NOTE_TITLE";
            public static final String NOTE_TEXT ="NOTE_TEXT";
            public static final String IMPORTANCE ="IMPORTANCE";
            public static final String IMAGE_PATH ="IMAGE_PATH";
            public static final String LONGITUDE ="LONGITUDE";
            public static final String LATITUDE ="LATITUDE";
        }
    }
}

Fix Schema table name variable


package io.github.vcuswimlab.stackintheflow.view;
import io.github.vcuswimlab.stackintheflow.model.Question;

import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
import java.awt.*;

/**
 * Created by batman on 11/16/16.
 */
public class QuestionRenderer extends JLabel implements ListCellRenderer<Question> {
    private static final int EXCERPT_LENGTH = 80;
    public QuestionRenderer() {
        setOpaque(true);
    }

    @Override
    public Component getListCellRendererComponent(JList<? extends Question> list, Question question, int index, boolean
            isSelected, boolean cellHasFocus) {
        String title = question.getTitle();

        if(isSelected) {
            setBackground(list.getSelectionBackground());
            setForeground(list.getSelectionForeground());
        } else {
            setBackground(list.getBackground());
            setForeground(list.getForeground());
        }
        TitledBorder focusBorder = new TitledBorder(LineBorder.createGrayLineBorder(),
                title);
        setText(generateExcerpt(question, EXCERPT_LENGTH));
        setBorder(focusBorder);
        return this;
    }

    //TODO: Maybe move this into the question object itself?
    private String generateExcerpt(Question question, int maxLength) {
        //TODO: Probably want a more advanced excerpt generation system later. This works for now, however.
        String body = question.getBody();
        if(body.length() <= maxLength) {
            return body;
        }
        return body.substring(0, maxLength-3) + "...";
    }
}

package io.github.vcuswimlab.stackintheflow.view;
import io.github.vcuswimlab.stackintheflow.model.Question;

import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
import java.awt.*;

/**
 * Created by batman on 11/16/16.
 */
public class QuestionRenderer extends JLabel implements ListCellRenderer<Question> {
    private static final int EXCERPT_LENGTH = 80;
    public QuestionRenderer() {
        setOpaque(true);
    }

    @Override
    public Component getListCellRendererComponent(JList<? extends Question> list, Question question, int index, boolean
            isSelected, boolean cellHasFocus) {
        String title = question.getTitle();

        if(isSelected) {
            setBackground(list.getSelectionBackground());
            setForeground(list.getSelectionForeground());
        } else {
            setBackground(list.getBackground());
            setForeground(list.getForeground());
        }
        TitledBorder focusBorder = new TitledBorder(LineBorder.createGrayLineBorder(),
                title);
        setText(generateExcerpt(question, EXCERPT_LENGTH));
        setBorder(focusBorder);
        return this;
    }

    //TODO: Maybe move this into the question object itself?
    private String generateExcerpt(Question question, int maxLength) {
        //TODO: Probably want a more advanced excerpt generation system later. This works for now, however.
        String body = question.getBody().replaceAll("<.*?>", "");
        if(body.length() <= maxLength) {
            return body;
        }
        return body.substring(0, maxLength-3) + "...";
    }
}

Add regex to strip html tags from question excerpt when rendering.


package plugins;

import com.google.inject.Guice;
import com.google.inject.Injector;
import io.sphere.sdk.client.PlayJavaClient;
import play.Application;
import play.GlobalSettings;

public class Global extends GlobalSettings {

    private Injector injector;

    @Override
    public void onStart(final Application app) {
        super.onStart(app);
        injector = createInjector(app);
    }

    protected Injector createInjector(Application app) {
        return Guice.createInjector(new ProductionModule(app));
    }

    @Override
    public void onStop(final Application app) {
        injector.getInstance(PlayJavaClient.class).close();
        super.onStop(app);
    }

    @Override
    public <A> A getControllerInstance(final Class<A> controllerClass) throws Exception {
        return injector.getInstance(controllerClass);
    }

}

package plugins;

import com.google.inject.Guice;
import com.google.inject.Injector;
import controllers.CountryOperations;
import io.sphere.sdk.client.PlayJavaClient;
import play.Application;
import play.GlobalSettings;

public class Global extends GlobalSettings {

    private Injector injector;

    @Override
    public void onStart(final Application app) {
        checkDefaultCountry(app);
        super.onStart(app);
        injector = createInjector(app);
    }

    protected Injector createInjector(Application app) {
        return Guice.createInjector(new ProductionModule(app));
    }

    private void checkDefaultCountry(Application app) {
        CountryOperations.of(app.configuration()).defaultCountry();
    }

    @Override
    public void onStop(final Application app) {
        injector.getInstance(PlayJavaClient.class).close();
        super.onStop(app);
    }

    @Override
    public <A> A getControllerInstance(final Class<A> controllerClass) throws Exception {
        return injector.getInstance(controllerClass);
    }

}

Check default country is defined before starting app.


package org.nanopub;

import org.openrdf.model.URI;
import org.openrdf.model.impl.URIImpl;

/**
 * Recommended third-party vocabulary to be used in provenance and publication info graphs.
 *
 * @author Tobias Kuhn
 */
public class NanopubVocab {

	private NanopubVocab() {}  // no instances allowed

	public static final URI DATETIME_TYPE = new URIImpl("http://www.w3.org/2001/XMLSchema#dateTime");
	public static final URI CREATION_TIME = new URIImpl("http://purl.org/dc/terms/created");
	public static final URI HAS_AUTHOR = new URIImpl("http://swan.mindinformatics.org/ontologies/1.2/pav/authoredBy");
	public static final URI HAS_CREATOR = new URIImpl("http://swan.mindinformatics.org/ontologies/1.2/pav/createdBy");

}

package org.nanopub;

import org.openrdf.model.URI;
import org.openrdf.model.impl.URIImpl;

/**
 * Recommended third-party vocabulary to be used in provenance and publication info graphs.
 *
 * @author Tobias Kuhn
 */
public class NanopubVocab {

	private NanopubVocab() {}  // no instances allowed

	// TODO Also support PROV-O
	// TODO Recognize different ontology versions

	public static final URI DATETIME_TYPE = new URIImpl("http://www.w3.org/2001/XMLSchema#dateTime");
	public static final URI CREATION_TIME = new URIImpl("http://purl.org/dc/terms/created");
	public static final URI HAS_AUTHOR = new URIImpl("http://purl.org/pav/authoredBy");
	public static final URI HAS_CREATOR = new URIImpl("http://purl.org/pav/createdBy");

}

Update to latest version of PAV namespace


package pro.beam.api.util;

import com.google.common.base.Function;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import org.apache.http.client.HttpResponseException;
import pro.beam.api.exceptions.BeamException;
import pro.beam.api.exceptions.tetris.MissingGameException;
import pro.beam.api.resource.tetris.RobotInfo;

public class Tetris {
    private static final int GAME_UNSET_CODE = 404;

    public static CheckedFuture<RobotInfo, BeamException> checkFutureRobotInfo(ListenableFuture<RobotInfo> future) {
        return Futures.makeChecked(future, TETRIS_EXCEPTION_TRANSFORMER);
    }

    private static final Function<Exception, BeamException> TETRIS_EXCEPTION_TRANSFORMER = new Function<Exception, BeamException>() {
        @Override public BeamException apply(Exception e) {
            Throwable cause = e.getCause();
            if (!(cause instanceof HttpResponseException)) {
                return null;
            }

            HttpResponseException hre = (HttpResponseException) cause;
            int status = hre.getStatusCode();

            if (status == GAME_UNSET_CODE) {
                return new MissingGameException();
            }

            return null;
        }
    };
}

package pro.beam.api.util;

import com.google.common.base.Function;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import org.apache.http.client.HttpResponseException;
import pro.beam.api.exceptions.BeamException;
import pro.beam.api.exceptions.tetris.MissingGameException;
import pro.beam.api.resource.tetris.RobotInfo;

public class Tetris {
    private static final int GAME_UNSET_CODE = 403;

    public static CheckedFuture<RobotInfo, BeamException> checkFutureRobotInfo(ListenableFuture<RobotInfo> future) {
        return Futures.makeChecked(future, TETRIS_EXCEPTION_TRANSFORMER);
    }

    private static final Function<Exception, BeamException> TETRIS_EXCEPTION_TRANSFORMER = new Function<Exception, BeamException>() {
        @Override public BeamException apply(Exception e) {
            Throwable cause = e.getCause();
            if (!(cause instanceof HttpResponseException)) {
                return null;
            }

            HttpResponseException hre = (HttpResponseException) cause;
            int status = hre.getStatusCode();

            if (status == GAME_UNSET_CODE) {
                return new MissingGameException();
            }

            return null;
        }
    };
}

Update to latest unset game response code


package net.megaroid.math;

public class Factors {

}

package net.megaroid.math;

public class Factors {

	private int mNumber;

	public Factors(int number) {
		mNumber = number;
	}

	public int getNumber() {
		return mNumber;
	}
}

Add a member, a Constructor and a method


package com.github.sulir.runtimesearch.shared;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class SearchOptions implements Serializable {
    public static final String PROPERTY_PREFIX = "runtimesearch.";
    private static final long serialVersionUID = 1L;

    private String text = "";

    public String getText() {
        return text;
    }

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

    public boolean isActive() {
        return !text.isEmpty();
    }

    public Map<String, String> toProperties() {
        Map<String, String> result = new HashMap<>();
        result.put(PROPERTY_PREFIX + "text", text);
        return result;
    }

    public static SearchOptions fromProperties(Properties properties) {
        SearchOptions options = new SearchOptions();
        options.setText(properties.getProperty(PROPERTY_PREFIX + "text"));
        return options;
    }
}

package com.github.sulir.runtimesearch.shared;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class SearchOptions implements Serializable {
    public static final String PROPERTY_PREFIX = "runtimesearch.";
    private static final long serialVersionUID = 1L;

    private String text = "";

    public String getText() {
        return text;
    }

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

    public boolean isActive() {
        return !text.isEmpty();
    }

    public Map<String, String> toProperties() {
        Map<String, String> result = new HashMap<>();
        result.put(PROPERTY_PREFIX + "text", text);
        return result;
    }

    public static SearchOptions fromProperties(Properties properties) {
        SearchOptions options = new SearchOptions();

        String text = properties.getProperty(PROPERTY_PREFIX + "text");
        if (text != null)
            options.setText(text);

        return options;
    }
}

Fix NullPointerException when searched text is not set via a system property


package org.joda.time.field;

import org.joda.time.DateTimeFieldType;
import org.joda.time.chrono.IslamicChronology;

public class DriveDividedDateTimeField {

    static DividedDateTimeField rdtf = new DividedDateTimeField(
            DateTimeFieldType.dayOfMonth().getField(IslamicChronology.getInstance()),
            null,
            DateTimeFieldType.dayOfMonth(),
            5);

    static void add(long instant, int value) {
        rdtf.add(instant, value);
    }

    static void add2(long instant, long value) {
        rdtf.add(instant, value);
    }

    static void set(long instant, int value) {
        rdtf.set(instant, value);
    }

    static void addWrapField(long instant, int amount) {

        rdtf.addWrapField(instant, amount);
    }

    static void getDifference(long minuendInstant, long subtrahendInstant) {
            rdtf.getDifference(minuendInstant,subtrahendInstant);
    }

    static void getDifferenceAsLong(long minuendInstant, long subtrahendInstant){
            rdtf.getDifferenceAsLong(minuendInstant,subtrahendInstant);
    }

    static void remainder(long instant){
        rdtf.remainder(instant);
    }

    public static void main(String[] args) {
        add(1L, 2);
        add2(1L, 2L);
        set(1L,2);
        addWrapField(1L,2);
        remainder(1L);

    }

}

package org.joda.time.field;

import org.joda.time.DateTimeFieldType;
import org.joda.time.chrono.IslamicChronology;

public class DriveDividedDateTimeField {

    static DividedDateTimeField rdtf = new DividedDateTimeField(
            DateTimeFieldType.dayOfMonth().getField(IslamicChronology.getInstance()),
            null,
            DateTimeFieldType.dayOfMonth(),
            5);

    static void add(long instant, int value) {
        rdtf.add(instant, value);
    }

    static void add2(long instant, long value) {
        rdtf.add(instant, value);
    }

    static void set(long instant, int value) {
        rdtf.set(instant, value);
    }

    static void addWrapField(long instant, int amount) {

        rdtf.addWrapField(instant, amount);
    }

    static void getDifference(long minuendInstant, long subtrahendInstant) {
            rdtf.getDifference(minuendInstant,subtrahendInstant);
    }

    static void getDifferenceAsLong(long minuendInstant, long subtrahendInstant){
            rdtf.getDifferenceAsLong(minuendInstant,subtrahendInstant);
    }

    static void remainder(long instant){
        rdtf.remainder(instant);
    }

    public static void main(String[] args) {
        add(1L, 2);
        add2(1L, 2L);
        set(1L,2);
        addWrapField(1L,2);
        remainder(1L);
        getDifferenceAsLong(1L,1L);
        getDifferenceAsLong(1L,1L);

    }

}

Add new jpf test cases


package top.quantic.sentry.discord.core;

import joptsimple.OptionSet;
import sx.blah.discord.handle.obj.IMessage;

public class CommandContext {

    private IMessage message;
    private String prefix;
    private Command command;
    private String[] args;
    private OptionSet optionSet;

    public IMessage getMessage() {
        return message;
    }

    public void setMessage(IMessage message) {
        this.message = message;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public Command getCommand() {
        return command;
    }

    public void setCommand(Command command) {
        this.command = command;
    }

    public String[] getArgs() {
        return args;
    }

    public void setArgs(String[] args) {
        this.args = args;
    }

    public OptionSet getOptionSet() {
        return optionSet;
    }

    public void setOptionSet(OptionSet optionSet) {
        this.optionSet = optionSet;
    }

    public String getContentAfterPrefix() {
        if (message == null || prefix == null) {
            return null;
        }
        String content = message.getContent();
        if (!content.contains(prefix)) {
            return content;
        }
        return content.substring(prefix.length());
    }

    public String getContentAfterCommand() {
        String withCommand = getContentAfterPrefix();
        return withCommand.contains(" ") ? withCommand.split(" ", 2)[1] : "";
    }
}

package top.quantic.sentry.discord.core;

import joptsimple.OptionSet;
import sx.blah.discord.handle.obj.IMessage;

public class CommandContext {

    private IMessage message;
    private String prefix;
    private Command command;
    private String[] args;
    private OptionSet optionSet;

    public IMessage getMessage() {
        return message;
    }

    public void setMessage(IMessage message) {
        this.message = message;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public Command getCommand() {
        return command;
    }

    public void setCommand(Command command) {
        this.command = command;
    }

    public String[] getArgs() {
        return args;
    }

    public void setArgs(String[] args) {
        this.args = args;
    }

    public OptionSet getOptionSet() {
        return optionSet;
    }

    public void setOptionSet(OptionSet optionSet) {
        this.optionSet = optionSet;
    }

    public String getContentAfterPrefix() {
        if (message == null || prefix == null) {
            return null;
        }
        String content = message.getContent();
        if (!content.contains(prefix)) {
            return content;
        }
        return content.substring(prefix.length());
    }

    public String getContentAfterCommand() {
        String withCommand = getContentAfterPrefix();
        if (withCommand == null) {
            return "";
        }
        return withCommand.contains(" ") ? withCommand.split(" ", 2)[1] : "";
    }
}

Fix potential NPE with command context


package techcable.minecraft.npclib;

import techcable.minecraft.npclib.citizens.CitizensNPCRegistry;

import net.citizensnpcs.api.CitizensAPI;

public class NPCLib {
	private NPCLib() {};

	public static NPCRegistry getNPCRegistry() {
	    if (hasCitizens()) {
	        return CitizensNPCRegistry.getRegistry();
	    } else {
	        throw new UnsupportedOperationException();
	    }
	}

	public static boolean hasCitizens() {
		try {
			Class.forName("net.citizensnpcs.api.CitizensAPI");
		} catch (ClassNotFoundException e) {
			return false;
		}
		return CitizensAPI.hasImplementation();
	}
	public static boolean hasNMS() {
		return false;
	}
}

package techcable.minecraft.npclib;

import techcable.minecraft.npclib.citizens.CitizensNPCRegistry;

import net.citizensnpcs.api.CitizensAPI;

public class NPCLib {
	private NPCLib() {};

	public static NPCRegistry getNPCRegistry() {
	    if (hasCitizens()) {
	        return CitizensNPCRegistry.getRegistry();
	    } else {
	        throw new UnsupportedOperationException();
	    }
	}

	public static NPCRegistry getNPCRegistry(String name) {
	    if (hasCitizens()) {
	        return CitizensNPCRegistry.getRegistry(name);
	    } else {
	        throw new UnsupportedOperationException();
	    }
	}

	public static boolean hasCitizens() {
		try {
			Class.forName("net.citizensnpcs.api.CitizensAPI");
		} catch (ClassNotFoundException e) {
			return false;
		}
		return CitizensAPI.hasImplementation();
	}
	public static boolean hasNMS() {
		return false;
	}
}

Add support for named registries


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

package tachyon.client;

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

/**
 * Tests {@link ClientUtils}.
 */
public final class ClientUtilsTest {
  /**
   * Tests if output of {@link ClientUtils#getRandomNonNegativeLong()} is non-negative.
   * Also tests for randomness property.
   *
   */
  @Test
  public void getRandomNonNegativeLongTest() throws Exception {
    Assert.assertTrue(ClientUtils.getRandomNonNegativeLong() > 0);
    Assert.assertTrue(ClientUtils.getRandomNonNegativeLong() != ClientUtils.getRandomNonNegativeLong());
  }
}

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

package tachyon.client;

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

/**
 * Tests {@link ClientUtils}.
 */
public final class ClientUtilsTest {
  /**
   * Tests if output of {@link ClientUtils#getRandomNonNegativeLong()} is non-negative.
   * Also tests for randomness property.
   *
   */
  @Test
  public void getRandomNonNegativeLongTest() throws Exception {
    long first = ClientUtils.getRandomNonNegativeLong();
    long second = ClientUtils.getRandomNonNegativeLong();
    Assert.assertTrue(first > 0);
    Assert.assertTrue(second > 0);
    Assert.assertTrue(first != second);
  }
}

Fix the two checkstyle errors originating out of the additional assertion


package roart.iclij.config;

public class MLConfig {

    // load before evolve or use
    private Boolean load;

    // enable evolve or use
    private Boolean enable;

    // ml persistence
    private Boolean persistml;

    public Boolean getLoad() {
        return load;
    }

    public void setLoad(Boolean load) {
        this.load = load;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public Boolean getPersistml() {
        return persistml;
    }

    public void setPersistml(Boolean persistml) {
        this.persistml = persistml;
    }

    public void merge(MLConfig other) {
        if (other == null) {
            return;
        }
        if (other.load != null) {
            this.load = other.load;
        }
        if (other.enable != null) {
            this.enable = other.enable;
        }
    }

}

package roart.iclij.config;

public class MLConfig {

    // load before evolve or use
    private Boolean load;

    // enable evolve or use
    private Boolean enable;

    public Boolean getLoad() {
        return load;
    }

    public void setLoad(Boolean load) {
        this.load = load;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public void merge(MLConfig other) {
        if (other == null) {
            return;
        }
        if (other.load != null) {
            this.load = other.load;
        }
        if (other.enable != null) {
            this.enable = other.enable;
        }
    }

}

Remove this, use only enable, for Machine learning persist (I114).