/*
 * Licensed to Apereo under one or more contributor license
 * agreements. See the NOTICE file distributed with this work
 * for additional information regarding copyright ownership.
 * Apereo 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 the following location:
 *
 *   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.jasig.cas.support.oauth.scope.handler.support;

import org.jasig.cas.support.oauth.scope.Scope;

import java.util.Set;

/**
 * Base class for OAuth Scope Handlers.
 *
 * @author Michael Haselton
 * @since 4.1.0
 */
public abstract class AbstractScopeHandler implements ScopeHandler {

    @Override
    public Set<Scope> getDefaults() {
        return null;
    }
}

/*
 * Licensed to Apereo under one or more contributor license
 * agreements. See the NOTICE file distributed with this work
 * for additional information regarding copyright ownership.
 * Apereo 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 the following location:
 *
 *   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.jasig.cas.support.oauth.scope.handler.support;

import org.jasig.cas.support.oauth.scope.Scope;

import java.util.HashSet;
import java.util.Set;

/**
 * Base class for OAuth Scope Handlers.
 *
 * @author Michael Haselton
 * @since 4.1.0
 */
public abstract class AbstractScopeHandler implements ScopeHandler {

    @Override
    public Set<Scope> getDefaults() {
        return new HashSet<>();
    }
}

Fix nullpointerexception when using OSF scopes.


/*
@VaadinApache2LicenseForJavaFiles@
 */

package com.vaadin.tests.minitutorials.v7a1;

import com.vaadin.Application;
import com.vaadin.terminal.WrappedRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Root;

/**
 * Mini tutorial code for
 * https://vaadin.com/wiki/-/wiki/Main/Finding%20the%20current
 * %20Root%20and%20Application
 *
 * @author Vaadin Ltd
 * @version @VERSION@
 * @since 7.0.0
 */
public class FindCurrentRootAndApplication extends Root {

    @Override
    protected void init(WrappedRequest request) {
        Button helloButton = new Button("Say Hello");
        helloButton.addListener(new ClickListener() {
            public void buttonClick(ClickEvent event) {
                String msg = "Running in ";
                msg += Application.getCurrent().isProductionMode() ? "production"
                        : "debug";
                msg += " mode in a Root with the caption "
                        + Root.getCurrent().getCaption();

                Notification.show(msg);
            }
        });

        addComponent(helloButton);
    }

}

/*
@VaadinApache2LicenseForJavaFiles@
 */

package com.vaadin.tests.minitutorials.v7a1;

import com.vaadin.Application;
import com.vaadin.terminal.WrappedRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Root;

/**
 * Mini tutorial code for
 * https://vaadin.com/wiki/-/wiki/Main/Finding%20the%20current
 * %20Root%20and%20Application
 *
 * @author Vaadin Ltd
 * @version @VERSION@
 * @since 7.0.0
 */
public class FindCurrentRootAndApplication extends Root {

    @Override
    protected void init(WrappedRequest request) {
        Button helloButton = new Button("Say Hello");
        helloButton.addListener(new ClickListener() {
            public void buttonClick(ClickEvent event) {
                String msg = "Running in ";
                msg += Application.getCurrent().isProductionMode() ? "production"
                        : "debug";
                Notification.show(msg);
            }
        });

        helloButton.addListener(new ClickListener() {
            public void buttonClick(ClickEvent event) {
                Notification.show("This Root is "
                        + Root.getCurrent().getClass().getSimpleName());
            }
        });

        addComponent(helloButton);
    }

}

Update mini tutorial to actually use Root.getCurrent()


package com.jraska.falcon.sample;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Point;
import android.os.Build;
import android.os.Bundle;
import android.view.Display;
import android.view.Menu;
import android.view.WindowManager;

public class FloatingViewActivity extends SampleActivity {
  @Override protected void onCreate(Bundle savedInstanceState) {
    setupFloatingWindow();

    super.onCreate(savedInstanceState);
  }

  @Override public boolean onCreateOptionsMenu(Menu menu) {
    return false;
  }

  private void setupFloatingWindow() {
    Point size = getSize();

    WindowManager.LayoutParams params = getWindow().getAttributes();
    params.width = size.x - 100;
    params.height = size.y / 2;
    params.alpha = 1;
    params.dimAmount = 0.4f;
    params.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
    getWindow().setAttributes(params);
  }

  @SuppressWarnings("deprecation") private Point getSize() {
    Point size = new Point();

    Display defaultDisplay = getWindow().getWindowManager().getDefaultDisplay();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
      defaultDisplay.getSize(size);
    } else {
      size.x = defaultDisplay.getWidth();
      size.y = defaultDisplay.getHeight();
    }

    return size;
  }

  static void start(Activity from) {
    Intent intent = new Intent(from, FloatingViewActivity.class);
    from.startActivity(intent);
  }
}

package com.jraska.falcon.sample;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Point;
import android.os.Build;
import android.os.Bundle;
import android.view.Display;
import android.view.Menu;
import android.view.WindowManager;

public class FloatingViewActivity extends SampleActivity {
  @Override protected void onCreate(Bundle savedInstanceState) {
    setupFloatingWindow();

    super.onCreate(savedInstanceState);
  }

  private void setupFloatingWindow() {
    Point size = getSize();

    WindowManager.LayoutParams params = getWindow().getAttributes();
    params.width = size.x - 100;
    params.height = size.y / 2;
    params.alpha = 1;
    params.dimAmount = 0.4f;
    params.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
    getWindow().setAttributes(params);
  }

  @SuppressWarnings("deprecation") private Point getSize() {
    Point size = new Point();

    Display defaultDisplay = getWindow().getWindowManager().getDefaultDisplay();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
      defaultDisplay.getSize(size);
    } else {
      size.x = defaultDisplay.getWidth();
      size.y = defaultDisplay.getHeight();
    }

    return size;
  }

  static void start(Activity from) {
    Intent intent = new Intent(from, FloatingViewActivity.class);
    from.startActivity(intent);
  }
}

Allow to start infinite number of activities


package li.strolch.execution.policy;

import li.strolch.agent.api.ComponentContainer;
import li.strolch.model.activity.Activity;
import li.strolch.persistence.api.StrolchTransaction;

public class RemoveActivityArchival extends ActivityArchivalPolicy {

	public RemoveActivityArchival(ComponentContainer container, StrolchTransaction tx) {
		super(container, tx);
	}

	@Override
	public void archive(Activity activity) {

		if (!activity.getState().isExecuted())
			throw new IllegalStateException("Can not archive non-executed " + activity.getLocator());

		tx().remove(activity);

		logger.info("Removing " + activity.getLocator());
	}
}

package li.strolch.execution.policy;

import li.strolch.agent.api.ComponentContainer;
import li.strolch.model.activity.Activity;
import li.strolch.persistence.api.StrolchTransaction;

public class RemoveActivityArchival extends ActivityArchivalPolicy {

	public RemoveActivityArchival(ComponentContainer container, StrolchTransaction tx) {
		super(container, tx);
	}

	@Override
	public void archive(Activity activity) {

		if (!activity.getState().isExecuted() && !activity.getState().isClosed())
			throw new IllegalStateException("Can not archive non-executed " + activity.getLocator());

		tx().remove(activity);

		logger.info("Removing " + activity.getLocator());
	}
}

Allow to archive activities in state CLOSED


package ti.modules.titanium.ui.android;

import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.util.TiRHelper;

import android.os.Bundle;
import android.preference.PreferenceFragment;

public class TiPreferencesFragment extends PreferenceFragment {

    private static final String TAG = "TiPreferencesFragment";

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

        String prefsName = getArguments().getString(TiPreferencesActivity.PREFS_KEY);

        // Find the layout file, do nothing if not found
        try {
            getPreferenceManager().setSharedPreferencesName(TiApplication.APPLICATION_PREFERENCES_NAME);
            int resid = TiRHelper.getResource("xml." + prefsName);
            if (resid != 0) {
                addPreferencesFromResource(resid);
            } else {
                Log.e(TAG, "xml." + prefsName + " preferences not found.");
                return;
            }
        } catch (TiRHelper.ResourceNotFoundException e) {
            Log.e(TAG, "Error loading preferences: " + e.getMessage());
            return;
        }
    }
}

package ti.modules.titanium.ui.android;

import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.util.TiRHelper;

import android.os.Bundle;
import android.preference.PreferenceFragment;

public class TiPreferencesFragment extends PreferenceFragment {

    private static final String TAG = "TiPreferencesFragment";
    private CharSequence title = null;

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

        String prefsName = getArguments().getString(TiPreferencesActivity.PREFS_KEY);

        // Find the layout file, do nothing if not found
        try {
            getPreferenceManager().setSharedPreferencesName(TiApplication.APPLICATION_PREFERENCES_NAME);
            int resid = TiRHelper.getResource("xml." + prefsName);
            if (resid != 0) {
                addPreferencesFromResource(resid);
                if (getPreferenceScreen() != null) {
                	title = getPreferenceScreen().getTitle();
                }
            } else {
                Log.e(TAG, "xml." + prefsName + " preferences not found.");
                return;
            }
        } catch (TiRHelper.ResourceNotFoundException e) {
            Log.e(TAG, "Error loading preferences: " + e.getMessage());
            return;
        }
    }

	@Override
	public void onResume() {
		super.onResume();
		if (title != null && getActivity() != null) {
			getActivity().setTitle(title);
		}
	}

}

Allow for setting of the Title


package org.ihtsdo.buildcloud.service.fileprocessing;

public enum InputSources {

    TERM_SERVER("terminology-server"), REFSET_TOOL("reference-set-tool"), MAPPING_TOOLS("mapping-tools"), MANUAL("manual");

    private String sourceName;

    InputSources(String sourceName) {
        this.sourceName = sourceName;
    }

    public String getSourceName() {
        return sourceName;
    }

    public static InputSources getSource(String sourceName) {
        for (InputSources sourceType : InputSources.values()) {
            if(sourceType.getSourceName().equalsIgnoreCase(sourceName)) {
                return sourceType;
            }
        }
        return null;
    }
}

package org.ihtsdo.buildcloud.service.fileprocessing;

public enum InputSources {

    TERM_SERVER("terminology-server"), REFSET_TOOL("reference-set-tool"), MAPPING_TOOLS("mapping-tools"), MANUAL("manual"), EXTERNALY_MAINTAINED("externally-maintained");

    private String sourceName;

    InputSources(String sourceName) {
        this.sourceName = sourceName;
    }

    public String getSourceName() {
        return sourceName;
    }

    public static InputSources getSource(String sourceName) {
        for (InputSources sourceType : InputSources.values()) {
            if(sourceType.getSourceName().equalsIgnoreCase(sourceName)) {
                return sourceType;
            }
        }
        return null;
    }
}

Add externally maintained source type


/*
 * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. 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 io.siddhi.core.exception;

/**
 * Exception class to be used when an error occurs while executing on-demand queries.
 * This is deprecated and use OnDemandQueryRuntimeException instead.
 */
@Deprecated
public abstract class StoreQueryRuntimeException extends RuntimeException {
    boolean classLoadingIssue = false;

    protected StoreQueryRuntimeException() {
        super();
    }

    protected StoreQueryRuntimeException(String message) {
        super(message);
    }

    protected StoreQueryRuntimeException(String message, Throwable throwable) {
        super(message, throwable);
    }

    protected StoreQueryRuntimeException(Throwable throwable) {
        super(throwable);
    }

    public abstract boolean isClassLoadingIssue();
}

/*
 * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. 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 io.siddhi.core.exception;

/**
 * Exception class to be used when an error occurs while executing on-demand queries.
 * This is deprecated and use OnDemandQueryRuntimeException instead.
 */
@Deprecated
public abstract class StoreQueryRuntimeException extends RuntimeException {

    protected StoreQueryRuntimeException() {
        super();
    }

    protected StoreQueryRuntimeException(String message) {
        super(message);
    }

    protected StoreQueryRuntimeException(String message, Throwable throwable) {
        super(message, throwable);
    }

    protected StoreQueryRuntimeException(Throwable throwable) {
        super(throwable);
    }

    public abstract boolean isClassLoadingIssue();
}

Refactor Store Query to On-Demand Query with backward compatibility.


package com.consol.citrus;

/**
 * @author Christoph Deppisch
 */
public interface TestActionRunner {

    /**
     * Runs given test action.
     * @param action
     * @param <T>
     * @return
     */
    default <T extends TestAction> T run(T action) {
        return run((TestActionBuilder<T>) () -> action);
    }

    /**
     * Builds and runs given test action.
     * @param builder
     * @param <T>
     * @return
     */
    <T extends TestAction> T run(TestActionBuilder<T> builder);

    /**
     * Apply test behavior on this test action runner.
     * @param behavior
     * @return
     */
    <T extends TestAction> TestActionBuilder<T> applyBehavior(TestBehavior behavior);
}

package com.consol.citrus;

/**
 * @author Christoph Deppisch
 */
public interface TestActionRunner {

    /**
     * Runs given test action.
     * @param action
     * @param <T>
     * @return
     */
    default <T extends TestAction> T run(T action) {
        return run((TestActionBuilder<T>) () -> action);
    }

    /**
     * Runs given test action.
     * @param action
     * @param <T>
     * @return
     */
    default <T extends TestAction> T $(T action) {
        return run((TestActionBuilder<T>) () -> action);
    }

    /**
     * Builds and runs given test action.
     * @param builder
     * @param <T>
     * @return
     */
    default <T extends TestAction> T $(TestActionBuilder<T> builder) {
        return run(builder);
    }

    /**
     * Builds and runs given test action.
     * @param builder
     * @param <T>
     * @return
     */
    <T extends TestAction> T run(TestActionBuilder<T> builder);

    /**
     * Apply test behavior on this test action runner.
     * @param behavior
     * @return
     */
    <T extends TestAction> TestActionBuilder<T> applyBehavior(TestBehavior behavior);
}

Add short hand for run methods on test action runner


package com.homeadvisor.kafdrop.config;

import org.hibernate.validator.constraints.NotBlank;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

@Configuration
public class SchemaRegistryConfiguration {

    @Component
    @ConfigurationProperties(prefix = "schemaregistry")
    public static class SchemaRegistryProperties
    {
        public static final Pattern CONNECT_SEPARATOR = Pattern.compile("\\s*,\\s*");
        @NotBlank
        private String connect;

        public String getConnect()
        {
            return connect;
        }

        public void setConnect(String connect)
        {
            this.connect = connect;
        }

        public List<String> getConnectList()
        {
            return CONNECT_SEPARATOR.splitAsStream(this.connect)
                    .map(String::trim)
                    .filter(s -> s.length() > 0)
                    .collect(Collectors.toList());
        }

    }

}

package com.homeadvisor.kafdrop.config;

import org.hibernate.validator.constraints.NotBlank;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration
public class SchemaRegistryConfiguration {

    @Component
    @ConfigurationProperties(prefix = "schemaregistry")
    public static class SchemaRegistryProperties
    {
        @NotBlank
        private String connect;

        public String getConnect()
        {
            return connect;
        }

        public void setConnect(String connect)
        {
            this.connect = connect;
        }

    }

}

Remove list-parsing code from schema registry config parser


package ca.corefacility.bioinformatics.irida.repositories;

import org.springframework.data.repository.PagingAndSortingRepository;

import ca.corefacility.bioinformatics.irida.exceptions.EntityNotFoundException;
import ca.corefacility.bioinformatics.irida.model.Project;
import ca.corefacility.bioinformatics.irida.model.Sample;

/**
 * A repository for storing Sample objects
 *
 * @author Thomas Matthews <thomas.matthews@phac-aspc.gc.ca>
 */
public interface SampleRepository extends PagingAndSortingRepository<Sample, Long> {

	/**
	 * Get a {@link Sample} with the given string sample identifier from a
	 * specific project.
	 *
	 * @param project
	 *            The {@link Project} that the {@link Sample} belongs to.
	 * @param externalSampleId
	 *            The string sample identifier for a sample
	 * @return The {@link Sample} for this identifier
	 * @throws EntityNotFoundException
	 *             if a sample with this identifier doesn't exist
	 */
	public Sample getSampleByExternalSampleId(Project p, String externalSampleId) throws EntityNotFoundException;
}

package ca.corefacility.bioinformatics.irida.repositories;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import ca.corefacility.bioinformatics.irida.exceptions.EntityNotFoundException;
import ca.corefacility.bioinformatics.irida.model.Project;
import ca.corefacility.bioinformatics.irida.model.Sample;

/**
 * A repository for storing Sample objects
 *
 * @author Thomas Matthews <thomas.matthews@phac-aspc.gc.ca>
 * @author Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>
 */
public interface SampleRepository extends PagingAndSortingRepository<Sample, Long> {

	/**
	 * Get a {@link Sample} with the given string sample identifier from a
	 * specific project.
	 *
	 * @param project
	 *            The {@link Project} that the {@link Sample} belongs to.
	 * @param externalSampleId
	 *            The string sample identifier for a sample
	 * @return The {@link Sample} for this identifier
	 * @throws EntityNotFoundException
	 *             if a sample with this identifier doesn't exist
	 */
	@Query("select j.sample from ProjectSampleJoin j where j.project = ?1 and j.sample.externalSampleId = ?2")
	public Sample getSampleByExternalSampleId(Project p, String externalSampleId) throws EntityNotFoundException;
}

Add query for getting sample by external identifier.


package io.siddhi.distribution.editor.core.commons.request;

import java.util.Map;

/**
 * Bean class to represent the Siddhi application start request
 */
public class AppStartRequest {
    private String siddhiAppName;
    private Map<String, String> variables;

    public String getSiddhiAppName() {
        return siddhiAppName;
    }

    public Map<String, String> getVariables() {
        return variables;
    }

    public void setVariables(Map<String, String> variables) {
        this.variables = variables;
    }
}

package io.siddhi.distribution.editor.core.commons.request;

import java.util.Map;

/**
 * Bean class to represent the Siddhi application start request.
 */
public class AppStartRequest {
    private String siddhiAppName;
    private Map<String, String> variables;

    public String getSiddhiAppName() {
        return siddhiAppName;
    }

    public Map<String, String> getVariables() {
        return variables;
    }

    public void setVariables(Map<String, String> variables) {
        this.variables = variables;
    }
}

Fix checkstyle failure in windows


// Copyright 2019 Google LLC
//
// 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
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.sps.servlets;

import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/** Servlet that takes in audio stream and retrieves
 ** user input string to display. */

@WebServlet("/textinput")
public class TextInputServlet extends HttpServlet {

  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    response.setContentType("text/html;");
    response.getWriter().println("
Hello world!
");
  }
}

// Copyright 2019 Google LLC
//
// 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
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.sps.servlets;

import java.io.IOException;
import java.io.BufferedReader;
import java.util.stream.Collectors;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.cloud.dialogflow.v2.QueryInput;
import com.google.cloud.dialogflow.v2.QueryResult;

import com.google.sps.utils.TextUtils;

/** Servlet that takes in user text input and retrieves
 ** QueryResult from Dialogflow input string to display. */

@WebServlet("/text-input")
public class TextInputServlet extends HttpServlet {

  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
    String userQuestion = request.getParameter("request-input");
    QueryResult result = TextUtils.detectIntentStream(userQuestion);
    String agentResponse = result.getFulfillmentText();
    System.out.println(agentResponse);
  }
}

Add servlet to handle text request submissions and send to Dialogflow


package org.zalando.problem.spring.web.advice.validation;

import org.zalando.problem.spring.web.advice.AdviceTrait;

/**
 * @see AdviceTrait
 */
public interface ValidationAdviceTrait extends
        ConstraintViolationAdviceTrait,
        MethodArgumentNotValidAdviceTrait {
}

package org.zalando.problem.spring.web.advice.validation;

import org.zalando.problem.spring.web.advice.AdviceTrait;

/**
 * Advice trait to handle any validation exceptions.
 *

 * Be careful if you use {@link org.springframework.validation.beanvalidation.MethodValidationPostProcessor}
 * in order to validate method parameter field directly but {@code violations[].field} value looks like {@code arg0}
 * instead of parameter name, you have to configure a
 * {@link org.springframework.validation.beanvalidation.LocalValidatorFactoryBean} with your
 * {@link org.springframework.validation.beanvalidation.MethodValidationPostProcessor} like following:
 *
 *

 *  @Bean
 *  public Validator validator() {
 *      return new LocalValidatorFactoryBean();
 *  }
 *
 *  @Bean
 *  public MethodValidationPostProcessor methodValidationPostProcessor() {
 *      MethodValidationPostProcessor methodValidationPostProcessor = new MethodValidationPostProcessor();
 *      methodValidationPostProcessor.setValidator(validator());
 *      return methodValidationPostProcessor;
 *  }
 *

 *
 * @see AdviceTrait
 */
public interface ValidationAdviceTrait extends
        ConstraintViolationAdviceTrait,
        MethodArgumentNotValidAdviceTrait {
}

Add some tips when using Spring method validation


/*
 * Copyright (C) 2013 Michał Charmas (http://blog.charmas.pl)
 *
 * 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 pl.charmas.serializablegenerator.typeserializers.serializers;

import com.intellij.psi.PsiField;

import pl.charmas.serializablegenerator.typeserializers.TypeSerializer;

public class UnknownTypeSerializer implements TypeSerializer {

    @Override
    public String writeValue(PsiField field, String out) {
        return out + ".writeObject(this." + field.getName() + ");";
    }

    @Override
    public String readValue(PsiField field, String in) {
        return "this." + field.getName() + " = " + in + ".readObject();";
    }
}

/*
 * Copyright (C) 2013 Michał Charmas (http://blog.charmas.pl)
 *
 * 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 pl.charmas.serializablegenerator.typeserializers.serializers;

import com.intellij.psi.PsiField;

import pl.charmas.serializablegenerator.typeserializers.TypeSerializer;

public class UnknownTypeSerializer implements TypeSerializer {

    @Override
    public String writeValue(PsiField field, String out) {
        return out + ".writeObject(this." + field.getName() + ");";
    }

    @Override
    public String readValue(PsiField field, String in) {
        return "this." + field.getName() + " = (" + field.getType().getCanonicalText() + ") " + in + ".readObject();";
    }
}

Add missing cast for unknown types


package org.knowm.xchange.bitbay.v3.service;

import java.io.IOException;
import java.util.UUID;
import java.util.regex.Pattern;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.bitbay.v3.dto.trade.BitbayUserTrades;
import org.knowm.xchange.bitbay.v3.dto.trade.BitbayUserTradesQuery;
import org.knowm.xchange.exceptions.ExchangeException;
import org.knowm.xchange.utils.ObjectMapperHelper;

/** @author walec51 */
public class BitbayTradeServiceRaw extends BitbayBaseService {

  private static final Pattern WHITESPACES = Pattern.compile("\\s\\s");

  BitbayTradeServiceRaw(Exchange exchange) {
    super(exchange);
  }

  public BitbayUserTrades getBitbayTransactions(BitbayUserTradesQuery query)
      throws IOException, ExchangeException {
    String jsonQuery = ObjectMapperHelper.toJSON(query);
    jsonQuery = WHITESPACES.matcher(jsonQuery).replaceAll("");
    BitbayUserTrades response =
        bitbayAuthenticated.getTransactionHistory(
            apiKey, sign, exchange.getNonceFactory(), UUID.randomUUID(), jsonQuery);
    checkError(response);
    return response;
  }
}

package org.knowm.xchange.bitbay.v3.service;

import java.io.IOException;
import java.util.UUID;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.bitbay.v3.dto.trade.BitbayUserTrades;
import org.knowm.xchange.bitbay.v3.dto.trade.BitbayUserTradesQuery;
import org.knowm.xchange.exceptions.ExchangeException;
import org.knowm.xchange.utils.ObjectMapperHelper;

/** @author walec51 */
public class BitbayTradeServiceRaw extends BitbayBaseService {

  BitbayTradeServiceRaw(Exchange exchange) {
    super(exchange);
  }

  public BitbayUserTrades getBitbayTransactions(BitbayUserTradesQuery query)
      throws IOException, ExchangeException {
    final String jsonQuery = ObjectMapperHelper.toCompactJSON(query);
    final BitbayUserTrades response =
        bitbayAuthenticated.getTransactionHistory(
            apiKey, sign, exchange.getNonceFactory(), UUID.randomUUID(), jsonQuery);
    checkError(response);
    return response;
  }
}

Use compact JSON instead of replacing whitespaces in String


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

import org.jspecify.annotations.DefaultNonNull;
import org.jspecify.annotations.Nullable;
import org.jspecify.annotations.NullnessUnspecified;

@DefaultNonNull
class InstanceOfMethodCheck {
  Object x0(Object o) {
    if (Object.class.isInstance(o)) {
      return o;
    } else {
      return o;
    }
  }

  Object x1(@NullnessUnspecified Object o) {
    if (Object.class.isInstance(o)) {
      return o;
    } else {
      // jspecify_nullness_not_enough_information
      return o;
    }
  }

  Object x2(@Nullable Object o) {
    if (Object.class.isInstance(o)) {
      return o;
    } else {
      // jspecify_nullness_mismatch
      return o;
    }
  }
}

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

import org.jspecify.annotations.DefaultNonNull;
import org.jspecify.annotations.Nullable;
import org.jspecify.annotations.NullnessUnspecified;

@DefaultNonNull
class InstanceOfMethodCheck {
  Object x0(Object o) {
    if (Foo.class.isInstance(o)) {
      return o;
    } else {
      return o;
    }
  }

  Object x1(@NullnessUnspecified Object o) {
    if (Foo.class.isInstance(o)) {
      return o;
    } else {
      // jspecify_nullness_not_enough_information
      return o;
    }
  }

  Object x2(@Nullable Object o) {
    if (Foo.class.isInstance(o)) {
      return o;
    } else {
      // jspecify_nullness_mismatch
      return o;
    }
  }

  class Foo {}
}

Check Foo.class.isInstance instead of Object.class.isInstance.


package de.pitkley.jenkins.plugins.dockerswarmslave;

import hudson.Extension;
import hudson.model.Build;
import hudson.model.Project;
import hudson.model.Run;
import hudson.model.listeners.RunListener;

@Extension
public class DockerSwarmSlaveRunListener extends RunListener<Run<?, ?>> {
    @Override
    public void onFinalized(Run<?, ?> run) {
        // Check that we have a build
        if (!Build.class.isAssignableFrom(run.getClass())) {
            return;
        }
        Build<?, ?> b = (Build) run;

        // Check that it is a project
        if (!Project.class.isAssignableFrom(b.getProject().getClass())) {
            return;
        }
        Project<?, ?> project = b.getProject();

        // Was our build-wrapper active?
        DockerSwarmSlaveBuildWrapper buildWrapper = DockerSwarmSlaveLabelAssignment.getDockerSwarmSlaveBuildWrapper(project);
        if (buildWrapper == null) {
            return;
        }

        // Do we have a matching DockerSwarmSlave?
        DockerSwarmSlave dockerSwarmSlave = DockerSwarmSlave.get(project);
        if (dockerSwarmSlave == null) {
            return;
        }

        // Clean everything up
        dockerSwarmSlave.cleanup();
    }
}

package de.pitkley.jenkins.plugins.dockerswarmslave;

import hudson.Extension;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildableItemWithBuildWrappers;
import hudson.model.Run;
import hudson.model.listeners.RunListener;

@Extension
public class DockerSwarmSlaveRunListener extends RunListener<Run<?, ?>> {
    @Override
    public void onFinalized(Run<?, ?> run) {
        // Check that we have a build
        if (!AbstractBuild.class.isAssignableFrom(run.getClass())) {
            return;
        }
        AbstractBuild<?, ?> b = (AbstractBuild) run;

        // Check that it is a project
        if (!AbstractProject.class.isAssignableFrom(b.getProject().getClass())) {
            return;
        }
        AbstractProject<?, ?> project = b.getProject();

        if (!BuildableItemWithBuildWrappers.class.isAssignableFrom(project.getClass())) {
            return;
        }

        // Was our build-wrapper active?
        DockerSwarmSlaveBuildWrapper buildWrapper = DockerSwarmSlaveLabelAssignment.getDockerSwarmSlaveBuildWrapper((BuildableItemWithBuildWrappers) project);
        if (buildWrapper == null) {
            return;
        }

        // Do we have a matching DockerSwarmSlave?
        DockerSwarmSlave dockerSwarmSlave = DockerSwarmSlave.get(project);
        if (dockerSwarmSlave == null) {
            return;
        }

        // Clean everything up
        dockerSwarmSlave.cleanup();
    }
}

Use abstract classes in the runlistener


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sleuthkit.autopsy.keywordsearch;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
 *
 * @author
 */
@RunWith(Suite.class)
@Suite.SuiteClasses({CreditCardValidatorTest.class})
public class KeywordSearchTestSuite {
    public KeywordSearchTestSuite() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() throws Exception {
    }

    @After
    public void tearDown() throws Exception {
    }

    @Ignore
    public static void main(String[] args) {
        System.out.println("main method");
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sleuthkit.autopsy.keywordsearch;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
 *
 * @author
 */
@RunWith(Suite.class)
@Suite.SuiteClasses({CreditCardValidatorTest.class})
public class KeywordSearchTestSuite {
    public KeywordSearchTestSuite() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() throws Exception {
    }

    @After
    public void tearDown() throws Exception {
    }

    @Ignore
    public static void main(String[] args) {
    }
}

Clean up the debug output line


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

package org.gradle.internal.console;

public class UnixConsoleMetaData implements ConsoleMetaData {
    public int getCols() {
        final String width = System.getenv("COLUMNS");
        try{
            return Integer.parseInt(width);
        }catch(NumberFormatException ex){
            return 0;
        }
    }
}

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

package org.gradle.internal.console;

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

public class UnixConsoleMetaData implements ConsoleMetaData {

    public static final Logger LOGGER = LoggerFactory.getLogger(UnixConsoleMetaData.class);

    public int getCols() {
        final String columns = System.getenv("COLUMNS");
        if (columns != null) {
            try {
                return Integer.parseInt(columns);
            } catch (NumberFormatException ex) {
                LOGGER.debug("Cannot parse COLUMNS environment variable to get console width. Value: '%s'", columns);
            }
        }
        return 0;
    }
}

Add Null check and give decent debug message if COLUMN env var cannot be parsed.


// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.application.validation;

import java.util.Optional;

/**
 * Ids of validations that can be overridden
 *
 * @author bratseth
 */
public enum ValidationId {

    indexingChange("indexing-change"),
    indexModeChange("indexing-mode-change"),
    fieldTypeChange("field-type-change"),
    clusterSizeReduction("cluster-size-reduction"),
    contentClusterRemoval("content-cluster-removal"),
    configModelVersionMismatch("config-model-version-mismatch"),
    skipOldConfigModels("skip-old-config-models");

    private final String id;

    ValidationId(String id) { this.id = id; }

    public String value() { return id; }

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

    /**
     * Returns the validation id from this string.
     * Use this instead of valueOf to match string on the (canonical) dash-separated form.
     *
     * @return the matching validation id or empty if none
     */
    public static Optional<ValidationId> from(String id) {
        for (ValidationId candidate : ValidationId.values())
            if (id.equals(candidate.toString())) return Optional.of(candidate);
        return Optional.empty();
    }

}

// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.application.validation;

import java.util.Optional;

/**
 * Ids of validations that can be overridden
 *
 * @author bratseth
 */
public enum ValidationId {

    indexingChange("indexing-change"),
    indexModeChange("indexing-mode-change"),
    fieldTypeChange("field-type-change"),
    clusterSizeReduction("cluster-size-reduction"),
    contentClusterRemoval("content-cluster-removal"),
    configModelVersionMismatch("config-model-version-mismatch"),
    skipOldConfigModels("skip-old-config-models"),
    skipVespaStagingTests("skip-vespa-staging-tests");

    private final String id;

    ValidationId(String id) { this.id = id; }

    public String value() { return id; }

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

    /**
     * Returns the validation id from this string.
     * Use this instead of valueOf to match string on the (canonical) dash-separated form.
     *
     * @return the matching validation id or empty if none
     */
    public static Optional<ValidationId> from(String id) {
        for (ValidationId candidate : ValidationId.values())
            if (id.equals(candidate.toString())) return Optional.of(candidate);
        return Optional.empty();
    }

}

Add validation id for staging tests.


package codeu.chat.util;

public final class Tokenizer {

    public Tokenizer(String source) {

    }

    public String next() throws IOException {

    }
}

package codeu.chat.util;

import java.io.IOException;

public final class Tokenizer {

    public Tokenizer(String source) {

    }

    public String next() throws IOException {
        return "";
    }
}

Test commit attempt 2 :|


package com.xrtb.bidder;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MimeTypes {

	static Map<String,String> mimes = new HashMap();
	static List<String> types = new ArrayList();
	static {
		add("gif","image/gif");
		add("png","image/png");
		add("gif","image/gif");
		add("jpg","image/jpg");
		add("js","text/javascript;charset=utf-8");
		add("css","text/css");
		add("mp4","video/mp4");
		add("ogv","video/ogg");
	}

	static void add(String a, String b) {
		mimes.put(a,b);
	}

	public static String substitute(String key) {
		return mimes.get(key);
	}
}

package com.xrtb.bidder;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * A simple class to encode mime types in the embedded web server, RTBServer.java
 * @author Ben M. Faul
 *
 */
public class MimeTypes {

	/** The mime types hash */
	static Map<String,String> mimes = new HashMap<String, String>();
	static {
		add("gif","image/gif");
		add("png","image/png");
		add("gif","image/gif");
		add("jpg","image/jpg");
		add("js","text/javascript;charset=utf-8");
		add("css","text/css");
		add("mp4","video/mp4");
		add("ogv","video/ogg");
	}

	/**
	 * Add suffix/mine-type to hash
	 * @param a String. The file suffix
	 * @param b String. The mime type.
	 */
	static void add(String a, String b) {
		mimes.put(a,b);
	}

	/**
	 * Given the file suffix, return the mime type.
	 * @param key String. The file suffix.
	 * @return String. The mime type, or null
	 */
	public static String substitute(String key) {
		return mimes.get(key);
	}
}

Fix the unchecked type and add javadoc


package com.nguyenmp.starclient.test;

import com.nguyenmp.starclient.STAR;
import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

public class STAR_Test {
	@Test
	public void login_Test() throws IOException {
		Assert.assertEquals(STAR.login("mpnasf8", "asoidfu"), null);
	}
}

package com.nguyenmp.starclient.test;

import com.nguyenmp.starclient.STAR;
import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

public class STAR_Test {
	@Test
	public void login_Test() throws IOException {
		//TODO: Write realistic test for logging in
		Assert.assertEquals(STAR.login("mpnasf8", "asoidfu"), null);
	}
}

Write realistic test for logging in


package com.github.sherter.googlejavaformatgradleplugin;

import org.gradle.api.tasks.SourceTask;

abstract class FormatTask extends SourceTask {

  protected SharedContext sharedContext;

  abstract void accept(TaskConfigurator configurator);

  boolean hasSources() {
    return !source.isEmpty();
  }
}

package com.github.sherter.googlejavaformatgradleplugin;

import org.gradle.api.tasks.SourceTask;

abstract class FormatTask extends SourceTask {

  protected SharedContext sharedContext;

  abstract void accept(TaskConfigurator configurator);

  boolean hasSources() {
    return !getSource().isEmpty();
  }
}

Use getSource to access SourceTask source


package org.bds.test;

import org.bds.Config;
import org.bds.util.Gpr;
import org.junit.Before;
import org.junit.Test;

/**
 * Quick test cases when creating a new feature...
 *
 * @author pcingola
 *
 */
public class TestCasesZzz extends TestCasesBase {

	@Before
	public void beforeEachTest() {
		Config.reset();
		Config.get().load();
	}

	@Test
	public void test223_switch_case_return() {
		Gpr.debug("Test");
		runAndCheck("test/z.bds", "res", "1");
	}

}

package org.bds.test;

import org.bds.Config;
import org.bds.util.Gpr;
import org.junit.Before;
import org.junit.Test;

/**
 * Quick test cases when creating a new feature...
 *
 * @author pcingola
 *
 */
public class TestCasesZzz extends TestCasesBase {

	@Before
	public void beforeEachTest() {
		Config.reset();
		Config.get().load();
	}

	@Test
	public void test166_switch_case_return() {
		Gpr.debug("Test");
		runAndCheck("test/run_166.bds", "res", "1");
	}

}

Switch + case + return was leaving values on the vm stack. Fixed


package org.bouncycastle.crypto.tls;

public class SecurityParameters
{
    int entity = -1;
    int prfAlgorithm = -1;
    short compressionAlgorithm = -1;
    int verifyDataLength = -1;
    byte[] masterSecret = null;
    byte[] clientRandom = null;
    byte[] serverRandom = null;

    // TODO Keep this internal, since it's not the ideal place for it
    boolean truncatedHMac = false;

    /**
     * @return {@link ConnectionEnd}
     */
    public int getEntity()
    {
        return entity;
    }

    /**
     * @return {@link PRFAlgorithm}
     */
    public int getPrfAlgorithm()
    {
        return prfAlgorithm;
    }

    /**
     * @return {@link CompressionMethod}
     */
    public short getCompressionAlgorithm()
    {
        return compressionAlgorithm;
    }

    public int getVerifyDataLength()
    {
        return verifyDataLength;
    }

    public byte[] getMasterSecret()
    {
        return masterSecret;
    }

    public byte[] getClientRandom()
    {
        return clientRandom;
    }

    public byte[] getServerRandom()
    {
        return serverRandom;
    }
}

package org.bouncycastle.crypto.tls;

import org.bouncycastle.util.Arrays;

public class SecurityParameters
{
    int entity = -1;
    int cipherSuite = -1;
    short compressionAlgorithm = -1;
    int prfAlgorithm = -1;
    int verifyDataLength = -1;
    byte[] masterSecret = null;
    byte[] clientRandom = null;
    byte[] serverRandom = null;

    // TODO Keep this internal, since it's not the ideal place for it
    boolean truncatedHMac = false;

    void copySessionParametersFrom(SecurityParameters other)
    {
        this.entity = other.entity;
        this.cipherSuite = other.cipherSuite;
        this.compressionAlgorithm = other.compressionAlgorithm;
        this.prfAlgorithm = other.prfAlgorithm;
        this.verifyDataLength = other.verifyDataLength;
        this.masterSecret = Arrays.clone(other.masterSecret);
    }

    void clear()
    {
        if (this.masterSecret != null)
        {
            Arrays.fill(this.masterSecret, (byte)0);
            this.masterSecret = null;
        }
    }

    /**
     * @return {@link ConnectionEnd}
     */
    public int getEntity()
    {
        return entity;
    }

    /**
     * @return {@link CipherSuite}
     */
    public int getCipherSuite()
    {
        return cipherSuite;
    }

    /**
     * @return {@link CompressionMethod}
     */
    public short getCompressionAlgorithm()
    {
        return compressionAlgorithm;
    }

    /**
     * @return {@link PRFAlgorithm}
     */
    public int getPrfAlgorithm()
    {
        return prfAlgorithm;
    }

    public int getVerifyDataLength()
    {
        return verifyDataLength;
    }

    public byte[] getMasterSecret()
    {
        return masterSecret;
    }

    public byte[] getClientRandom()
    {
        return clientRandom;
    }

    public byte[] getServerRandom()
    {
        return serverRandom;
    }
}

Add new fields to support session resumption


package play.test;

import java.util.List;

import play.Play;
import play.modules.morphia.Model;
import play.modules.morphia.MorphiaPlugin;
import play.test.Fixtures;

import com.google.code.morphia.Datastore;

public class MorphiaFixtures extends Fixtures {

	private static Datastore ds() {
        return MorphiaPlugin.ds();
    }

    public static void deleteAll() {
        Datastore ds = ds();
        for (Class<Model> clz: Play.classloader.getAssignableClasses(Model.class)) {
            ds.getCollection(clz).drop();
        }
    }

    public static void delete(Class<? extends Model> ... types) {
        for (Class<? extends Model> type: types) {
            ds().getCollection(type).drop();
        }
    }

    public static void delete(List<Class<? extends Model>> classes) {
        for (Class<? extends Model> type: classes) {
            ds().getCollection(type).drop();
        }
    }

    public static void deleteAllModels() {
        deleteAll();
    }
}

package play.test;

import java.util.List;

import play.Play;
import play.modules.morphia.Model;
import play.modules.morphia.MorphiaPlugin;
import play.test.Fixtures;

import com.google.code.morphia.Datastore;

public class MorphiaFixtures extends Fixtures {

	private static Datastore ds() {
        return MorphiaPlugin.ds();
    }

    public static void deleteAll() {
    	idCache.clear();
        Datastore ds = ds();
        for (Class<Model> clz: Play.classloader.getAssignableClasses(Model.class)) {
            ds.getCollection(clz).drop();
        }
    }

    public static void delete(Class<? extends Model> ... types) {
    	idCache.clear();
        for (Class<? extends Model> type: types) {
            ds().getCollection(type).drop();
        }
    }

    public static void delete(List<Class<? extends Model>> classes) {
    	idCache.clear();
        for (Class<? extends Model> type: classes) {
            ds().getCollection(type).drop();
        }
    }

    public static void deleteAllModels() {
        deleteAll();
    }
}

Revert "reverse changes to MorhiaFixtures which is specific to 1.2.1"


package com.google.cloud.anviltop.hbase.adapters;

import com.google.bigtable.anviltop.AnviltopServices;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.client.Result;

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

/**
 * Adapt an AppendRowResponse from Anviltop to an HBase Result
 */
public class AppendResponseAdapter implements ResponseAdapter<AnviltopServices.AppendRowResponse, Result> {
  protected final RowAdapter rowAdapter;

  public AppendResponseAdapter(RowAdapter rowAdapter) {
    this.rowAdapter = rowAdapter;
  }

  @Override
  public Result adaptResponse(AnviltopServices.AppendRowResponse response) {
    List<Cell> cells = new ArrayList<Cell>();
    if (response.hasRow()) {
      return rowAdapter.adaptResponse(response.getRow());
    }
    return new Result();
  }
}

package com.google.cloud.anviltop.hbase.adapters;

import com.google.bigtable.anviltop.AnviltopServices;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.client.Result;

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

/**
 * Adapt an AppendRowResponse from Anviltop to an HBase Result
 */
public class AppendResponseAdapter implements ResponseAdapter<AnviltopServices.AppendRowResponse, Result> {
  protected final RowAdapter rowAdapter;

  public AppendResponseAdapter(RowAdapter rowAdapter) {
    this.rowAdapter = rowAdapter;
  }

  @Override
  public Result adaptResponse(AnviltopServices.AppendRowResponse response) {
    List<Cell> cells = new ArrayList<Cell>();
    if (response.hasRow()) {
      return rowAdapter.adaptResponse(response.getRow());
    }
    return null;
  }
}

Fix Appends when no results were asked.


package com.antonyt.coveredimageview.example;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

import com.antonyt.coveredimageview.CoveredImageView;
import com.antonyt.coveredimageview.R;

/**
 * Example activity to demonstrate the {@link CoveredImageView}. Click on the
 * image to repeat the reveal animation.
 */
public class CoveredImageViewActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final CoveredImageView image = (CoveredImageView) findViewById(R.id.image);
        image.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                image.reveal(2000);
            }
        });
    }
}

package com.antonyt.coveredimageview.example;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView.ScaleType;

import com.antonyt.coveredimageview.CoveredImageView;
import com.antonyt.coveredimageview.R;

/**
 * Example activity to demonstrate the {@link CoveredImageView}. Click on the
 * image to repeat the reveal animation.
 */
public class CoveredImageViewActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final CoveredImageView image = (CoveredImageView) findViewById(R.id.image);
        image.setScaleType(ScaleType.FIT_START);
        image.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                image.reveal(2000);
            }
        });
    }
}

Use ScaleType.FIT_START to align graph and plot better.


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

public interface EconomyAccount {

    String getAccountName();

    double getBalance();

    void setBalance();

    boolean hasCashFlow();

    TransactionHistory getCashFlow();

    String getCurrencyNameSingular();

    String getCurrencyNamePlural();
}

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

public interface EconomyAccount {

    String getAccountName();

    double getBalance();
    void setBalance();

    boolean hasHistory();
    TransactionHistory getHistory();

    String getCurrencyNameSingular();
    String getCurrencyNamePlural();
}

Rename cash flow getter to getHistory


package org.apache.lucene.spatial.base.context;

import org.apache.lucene.spatial.base.context.simple.SimpleSpatialContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * TODO -- i think there is a more standard way to approach this problem
 */
public class SpatialContextProvider {
  static final Logger log = LoggerFactory.getLogger(SpatialContextProvider.class);

  private static SpatialContext instance = null;

  private SpatialContextProvider() {
  }

  @SuppressWarnings("unchecked")
  public static synchronized SpatialContext getContext() {
    if (instance != null) {
      return instance;
    }

    String cname = System.getProperty("SpatialContextProvider");
    if (cname != null) {
      try {
        Class<? extends SpatialContext> clazz = (Class<? extends SpatialContext>) Class.forName(cname);
        instance = clazz.newInstance();
        return instance;
      } catch (Exception e) {
        //don't log full stack trace
        log.warn("Using default SpatialContext because: " + e.toString());
      }
    }
    instance = new SimpleSpatialContext();
    return instance;
  }

  static void clear() {
    instance = null;
  }
}

package org.apache.lucene.spatial.base.context;

import org.apache.lucene.spatial.base.context.simple.SimpleSpatialContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * TODO -- i think there is a more standard way to approach this problem
 */
public class SpatialContextProvider {
  static final Logger log = LoggerFactory.getLogger(SpatialContextProvider.class);

  private static SpatialContext instance = null;

  private SpatialContextProvider() {
  }

  @SuppressWarnings("unchecked")
  public static synchronized SpatialContext getContext() {
    if (instance != null) {
      return instance;
    }

    String cname = System.getProperty("SpatialContextProvider");
    if (cname != null) {
      try {
        Class<? extends SpatialContext> clazz = (Class<? extends SpatialContext>) Class.forName(cname);
        instance = clazz.newInstance();
        return instance;
      } catch (Exception e) {
        //don't log full stack trace
        log.warn("Using default SpatialContext because: " + e.toString());
      }
    }
    instance = new SimpleSpatialContext();
    return instance;
  }

  static synchronized void clear() {
    instance = null;
  }
}

Synchronize access to static instance in clear()


package com.paritytrading.parity.reporter;

import com.paritytrading.parity.net.pmr.PMR;
import com.paritytrading.parity.net.pmr.PMRListener;
import java.util.Locale;

abstract class MarketReportListener implements PMRListener {

    protected static final double PRICE_FACTOR = 10000.0;

    protected static final long NANOS_PER_MILLI = 1000 * 1000;

    @Override
    public void order(PMR.Order message) {
    }

    @Override
    public void cancel(PMR.Cancel message) {
    }

    protected void printf(String format, Object... args) {
        System.out.printf(Locale.US, format, args);
    }

}

package com.paritytrading.parity.reporter;

import com.paritytrading.parity.net.pmr.PMR;
import com.paritytrading.parity.net.pmr.PMRListener;
import java.util.Locale;

abstract class MarketReportListener implements PMRListener {

    protected static final double PRICE_FACTOR = 10000.0;

    protected static final long NANOS_PER_MILLI = 1_000_000;

    @Override
    public void order(PMR.Order message) {
    }

    @Override
    public void cancel(PMR.Cancel message) {
    }

    protected void printf(String format, Object... args) {
        System.out.printf(Locale.US, format, args);
    }

}

Clean up integer literals in trade reporter


package cc.blynk.common.handlers.common.encoders;

import cc.blynk.common.enums.Command;
import cc.blynk.common.model.messages.Message;
import cc.blynk.common.model.messages.MessageBase;
import cc.blynk.common.utils.Config;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * Encodes java message into a bytes array.
 *
 * The Blynk Project.
 * Created by Dmitriy Dumanskiy.
 * Created on 2/1/2015.
 */
public class MessageEncoder extends MessageToByteEncoder<MessageBase> {

    @Override
    protected void encode(ChannelHandlerContext ctx, MessageBase message, ByteBuf out) throws Exception {
        out.writeByte(message.command);
        out.writeShort(message.id);
        out.writeShort(message.length);

        if (message.command != Command.RESPONSE && message.length > 0) {
            out.writeBytes(((Message) message).body.getBytes(Config.DEFAULT_CHARSET));
        }
    }
}

package cc.blynk.common.handlers.common.encoders;

import cc.blynk.common.enums.Command;
import cc.blynk.common.model.messages.Message;
import cc.blynk.common.model.messages.MessageBase;
import cc.blynk.common.utils.Config;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * Encodes java message into a bytes array.
 *
 * The Blynk Project.
 * Created by Dmitriy Dumanskiy.
 * Created on 2/1/2015.
 */
public class MessageEncoder extends MessageToByteEncoder<MessageBase> {

    @Override
    protected void encode(ChannelHandlerContext ctx, MessageBase message, ByteBuf out) throws Exception {
        out.writeByte(message.command);
        out.writeShort(message.id);

        if (message.command == Command.RESPONSE) {
            out.writeShort(message.length);
        } else {
            byte[] body = ((Message) message).body.getBytes(Config.DEFAULT_CHARSET);
            out.writeShort(body.length);
            if (body.length > 0) {
                out.writeBytes(body);
            }
        }
    }
}

Correct message body length for unicode chars.


// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.completion;

import com.intellij.lang.Language;
import com.intellij.lang.LanguageExtension;
import com.intellij.lang.MetaLanguage;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;

import java.util.List;
import java.util.Set;

class CompletionExtension<T> extends LanguageExtension<T> {

  CompletionExtension(String epName) {
    super(epName);
  }

  @NotNull
  @Override
  protected List<T> buildExtensions(@NotNull String stringKey, @NotNull Language key) {
    return buildExtensions(getAllBaseLanguageIdsWithAny(key));
  }

  @NotNull
  private Set<String> getAllBaseLanguageIdsWithAny(@NotNull Language key) {
    Set<String> allowed = new THashSet<>();
    while (key != null) {
      allowed.add(keyToString(key));
      key = key.getBaseLanguage();
    }
    allowed.add("any");
    for (MetaLanguage metaLanguage : MetaLanguage.all()) {
      allowed.add(metaLanguage.getID());
    }
    return allowed;
  }
}

// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.completion;

import com.intellij.lang.Language;
import com.intellij.lang.LanguageExtension;
import com.intellij.lang.MetaLanguage;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;

import java.util.List;
import java.util.Set;

class CompletionExtension<T> extends LanguageExtension<T> {

  CompletionExtension(String epName) {
    super(epName);
  }

  @NotNull
  @Override
  protected List<T> buildExtensions(@NotNull String stringKey, @NotNull Language key) {
    return buildExtensions(getAllBaseLanguageIdsWithAny(key));
  }

  @NotNull
  private Set<String> getAllBaseLanguageIdsWithAny(@NotNull Language key) {
    Set<String> allowed = new THashSet<>();
    while (key != null) {
      allowed.add(keyToString(key));
      for (MetaLanguage metaLanguage : MetaLanguage.all()) {
        if (metaLanguage.matchesLanguage(key))
          allowed.add(metaLanguage.getID());
      }
      key = key.getBaseLanguage();
    }
    allowed.add("any");
    return allowed;
  }
}

Check metalanguage applicability in getAllBaseLanguageIdsWithAny()


package org.dataportabilityproject.job;

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

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import org.junit.Test;

public class CrypterImplTest {
  @Test
  public void testRoundTripSecretKey() throws Exception {
    KeyGenerator generator = KeyGenerator.getInstance("AES");
    SecretKey key = generator.generateKey();
    CrypterImpl impl = new CrypterImpl(key);
    String data = "The lazy dog didn't jump over anything";
    assertThat(impl.decrypt(impl.encrypt(data))).isEqualTo(data);
  }
}

package org.dataportabilityproject.job;

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

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import org.junit.Test;

public class CrypterImplTest {
  @Test
  public void testRoundTripSecretKey() throws Exception {
    KeyGenerator generator = KeyGenerator.getInstance("AES");
    SecretKey key = generator.generateKey();
    CrypterImpl impl = new CrypterImpl(key);
    String data = "The lazy dog didn't jump over anything except \u2614, and a \u26F5";
    assertThat(impl.decrypt(impl.encrypt(data))).isEqualTo(data);
  }
}

Add special charecters to the test as per chuy's request


package com.avairebot.orion.database.transformers;

import com.avairebot.orion.contracts.database.transformers.Transformer;
import com.avairebot.orion.database.collection.DataRow;
import com.google.gson.Gson;

public class GuildTypeTransformer extends Transformer {

    private static final Gson GSON = new Gson();

    private String name = "Default";
    private GuildTypeLimits limits = new GuildTypeLimits();

    GuildTypeTransformer(DataRow data) {
        super(data);

        if (hasData()) {
            if (data.getString("type_name", null) != null) {
                name = data.getString("type_name");
            }

            if (data.getString("type_limits", null) != null) {
                GuildTypeLimits typeLimits = GSON.fromJson(data.getString("type_limits"), GuildTypeLimits.class);
                if (typeLimits != null) {
                    limits = typeLimits;
                }
            }
        }
    }

    public String getName() {
        return name;
    }

    public GuildTypeLimits getLimits() {
        return limits;
    }

    public class GuildTypeLimits {
        private GuildTypePlaylist playlist = new GuildTypePlaylist();
        private int aliases = 20;

        public int getAliases() {
            return aliases;
        }

        public GuildTypePlaylist getPlaylist() {
            return playlist;
        }

        public class GuildTypePlaylist {
            private int lists;
            private int songs;

            public int getPlaylists() {
                return lists;
            }

            public int getSongs() {
                return songs;
            }
        }
    }
}

package com.avairebot.orion.database.transformers;

import com.avairebot.orion.contracts.database.transformers.Transformer;
import com.avairebot.orion.database.collection.DataRow;
import com.google.gson.Gson;

public class GuildTypeTransformer extends Transformer {

    private static final Gson GSON = new Gson();

    private String name = "Default";
    private GuildTypeLimits limits = new GuildTypeLimits();

    GuildTypeTransformer(DataRow data) {
        super(data);

        if (hasData()) {
            if (data.getString("type_name", null) != null) {
                name = data.getString("type_name");
            }

            if (data.getString("type_limits", null) != null) {
                GuildTypeLimits typeLimits = GSON.fromJson(data.getString("type_limits"), GuildTypeLimits.class);
                if (typeLimits != null) {
                    limits = typeLimits;
                }
            }
        }
    }

    public String getName() {
        return name;
    }

    public GuildTypeLimits getLimits() {
        return limits;
    }

    public class GuildTypeLimits {
        private GuildTypePlaylist playlist = new GuildTypePlaylist();
        private int aliases = 20;

        public int getAliases() {
            return aliases;
        }

        public GuildTypePlaylist getPlaylist() {
            return playlist;
        }

        public class GuildTypePlaylist {
            private int lists = 5;
            private int songs = 30;

            public int getPlaylists() {
                return lists;
            }

            public int getSongs() {
                return songs;
            }
        }
    }
}

Add defaults to guild type playlist settings


package org.openmhealth.shim.fitbit.mapper;

import com.fasterxml.jackson.databind.JsonNode;
import org.openmhealth.schema.domain.omh.BodyWeight;
import org.openmhealth.schema.domain.omh.DataPoint;
import org.openmhealth.schema.domain.omh.MassUnit;
import org.openmhealth.schema.domain.omh.MassUnitValue;

import java.time.*;
import java.util.Optional;

import static org.openmhealth.shim.common.mapper.JsonNodeMappingSupport.*;

/**
 * Created by Chris Schaefbauer on 6/10/15.
 */
public class FitbitBodyWeightDataPointMapper extends FitbitDataPointMapper<BodyWeight>{

    @Override
    protected Optional<DataPoint<BodyWeight>> asDataPoint(JsonNode node, int offsetInMilliseconds) {
        MassUnitValue bodyWeight = new MassUnitValue(MassUnit.KILOGRAM,asRequiredDouble(node,"weight"));
        BodyWeight.Builder builder = new BodyWeight.Builder(bodyWeight);

        Optional<LocalDateTime> dateTime = asOptionalLocalDateTime(node,"date","time");

        if(dateTime.isPresent()){
            OffsetDateTime offsetDateTime = OffsetDateTime.of(dateTime.get(), ZoneOffset.ofTotalSeconds(offsetInMilliseconds / 1000));
            builder.setEffectiveTimeFrame(offsetDateTime);
        }

        Optional<Long> externalId = asOptionalLong(node, "logId");
        BodyWeight measure = builder.build();

        return Optional.of(newDataPoint(measure, externalId.orElse(null)));

    }

    @Override
    protected String getListNodeName() {
        return "weight";
    }
}

package org.openmhealth.shim.fitbit.mapper;

import com.fasterxml.jackson.databind.JsonNode;
import org.openmhealth.schema.domain.omh.BodyWeight;
import org.openmhealth.schema.domain.omh.DataPoint;
import org.openmhealth.schema.domain.omh.MassUnit;
import org.openmhealth.schema.domain.omh.MassUnitValue;

import java.time.*;
import java.util.Optional;

import static org.openmhealth.shim.common.mapper.JsonNodeMappingSupport.*;

/**
 * Created by Chris Schaefbauer on 6/10/15.
 */
public class FitbitBodyWeightDataPointMapper extends FitbitDataPointMapper<BodyWeight>{

    @Override
    protected Optional<DataPoint<BodyWeight>> asDataPoint(JsonNode node, int UTCOffsetInMilliseconds) {
        MassUnitValue bodyWeight = new MassUnitValue(MassUnit.KILOGRAM,asRequiredDouble(node,"weight"));
        BodyWeight.Builder builder = new BodyWeight.Builder(bodyWeight);

        Optional<LocalDateTime> dateTime = asOptionalLocalDateTime(node,"date","time");

        if(dateTime.isPresent()){
            OffsetDateTime offsetDateTime = OffsetDateTime.of(dateTime.get(), ZoneOffset.ofTotalSeconds(UTCOffsetInMilliseconds / 1000));
            builder.setEffectiveTimeFrame(offsetDateTime);
        }

        Optional<Long> externalId = asOptionalLong(node, "logId");
        BodyWeight measure = builder.build();

        return Optional.of(newDataPoint(measure, externalId.orElse(null)));

    }

    @Override
    protected String getListNodeName() {
        return "weight";
    }
}

Rename offset in body weight mapper with UTC


package codechicken.lib.world;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.ChunkEvent;

public class TileChunkLoadHook
{
    private static boolean init;
    public static void init() {
        if(init) return;
        init = true;

        MinecraftForge.EVENT_BUS.register(new TileChunkLoadHook());
    }

    @SubscribeEvent
    public void onChunkLoad(ChunkEvent.Load event) {
        for(TileEntity t : ((Iterable<TileEntity>)event.getChunk().chunkTileEntityMap.values()))
            if(t instanceof IChunkLoadTile)
                ((IChunkLoadTile)t).onChunkLoad();
    }
}

package codechicken.lib.world;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.ChunkEvent;

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

public class TileChunkLoadHook
{
    private static boolean init;
    public static void init() {
        if(init) return;
        init = true;

        MinecraftForge.EVENT_BUS.register(new TileChunkLoadHook());
    }

    @SubscribeEvent
    public void onChunkLoad(ChunkEvent.Load event) {
        List<TileEntity> list = new ArrayList<TileEntity>(event.getChunk().chunkTileEntityMap.values());
        for(TileEntity t : list)
            if(t instanceof IChunkLoadTile)
                ((IChunkLoadTile)t).onChunkLoad();
    }
}

Fix ConcurrentModificationException in tile chunk load hook


package org.robockets.runqueue.client;

import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import org.robockets.runqueue.client.controllers.Controllers;

public class Main {

	public static void main(String args[]) {
        try { // Nimbus theme
            for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (Exception e) {
        	System.out.println(e);
        }

		SwingUtilities.invokeLater(new Runnable () {
			public void run () {
				Controllers.main.show();
			}
		});
	}
}

package org.robockets.runqueue.client;

import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import org.robockets.runqueue.client.controllers.Controllers;

public class Main {

	public static void main(String args[]) {
        try { // Nimbus theme
            for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (Exception e) {
        	e.printStackTrace();
        }

		SwingUtilities.invokeLater(new Runnable () {
			public void run () {
				Controllers.main.show();
			}
		});
	}
}

Print stack trace if Nimbus is not avaible


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

import com.google.idea.common.experiments.FeatureRolloutExperiment;

/**
 * A utility class that manages the experiment to use studio's built in deployer for deploying apks
 * instead of using the one present in mobile-install.
 */
public class StudioDeployerExperiment {
  /** Indicates if we should deploy via Studio or via MI. */
  private static final FeatureRolloutExperiment useStudioDeployer =
      new FeatureRolloutExperiment("aswb.use.studio.deployer");

  /** Returns whether mobile install deployments should happen via the studio deployer. */
  public static boolean isEnabled() {
    return useStudioDeployer.isEnabled();
  }

  private StudioDeployerExperiment() {}
}

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

import com.google.idea.common.experiments.FeatureRolloutExperiment;
import com.intellij.openapi.util.SystemInfo;

/**
 * A utility class that manages the experiment to use studio's built in deployer for deploying apks
 * instead of using the one present in mobile-install.
 */
public class StudioDeployerExperiment {
  /** Indicates if we should deploy via Studio or via MI. */
  private static final FeatureRolloutExperiment useStudioDeployer =
      new FeatureRolloutExperiment("aswb.use.studio.deployer");

  /** Returns whether mobile install deployments should happen via the studio deployer. */
  public static boolean isEnabled() {
    // The Studio deployer experiment is specific to local builds on Linux. For other platforms,
    // we'll rely entirely on the new Blaze specific deployment flow.
    if (!SystemInfo.isLinux) {
      return false;
    }

    return useStudioDeployer.isEnabled();
  }

  private StudioDeployerExperiment() {}
}

Make Studio deployer specific to workstations


/*
 * Copyright (C) 2012-2013 Facebook, 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.facebook.nifty.perf;

import com.facebook.nifty.core.NettyServerConfig;
import com.facebook.nifty.core.NettyServerConfigBuilder;
import com.google.inject.Provider;

public class LoadTesterNettyConfigProvider implements Provider<NettyServerConfig> {
    private final NiftyLoadTester.LoadTesterConfig config;

    @Inject
    public LoadTesterNettyConfigProvider(NiftyLoadTester.LoadTesterConfig config)
    {
        this.config = config;
    }

    @Override
    public NettyServerConfig get() {
        NettyServerConfigBuilder configBuilder = new NettyServerConfigBuilder();
        configBuilder.getServerSocketChannelConfig().setBacklog(config.getAcceptBacklog());
        return configBuilder.build();
    }
}

/*
 * Copyright (C) 2012-2013 Facebook, 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.facebook.nifty.perf;

import com.facebook.nifty.core.NettyServerConfig;
import com.facebook.nifty.core.NettyServerConfigBuilder;
import com.google.inject.Inject;
import com.google.inject.Provider;

public class LoadTesterNettyConfigProvider implements Provider<NettyServerConfig> {
    private final NiftyLoadTester.LoadTesterConfig config;

    @Inject
    public LoadTesterNettyConfigProvider(NiftyLoadTester.LoadTesterConfig config)
    {
        this.config = config;
    }

    @Override
    public NettyServerConfig get() {
        NettyServerConfigBuilder configBuilder = new NettyServerConfigBuilder();
        configBuilder.getServerSocketChannelConfig().setBacklog(config.getAcceptBacklog());
        return configBuilder.build();
    }
}

Add missing import to fix build


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

package org.gradle.api.internal.tasks.testing;

import org.gradle.api.Task;
import org.gradle.api.reporting.ConfigureableReport;
import org.gradle.api.reporting.DirectoryReport;
import org.gradle.api.reporting.internal.TaskGeneratedSingleDirectoryReport;
import org.gradle.api.reporting.internal.TaskReportContainer;
import org.gradle.api.tasks.testing.TestReports;

public class DefaultTestReports extends TaskReportContainer<ConfigureableReport> implements TestReports {

    public DefaultTestReports(Task task) {
        super(ConfigureableReport.class, task);

        add(TaskGeneratedSingleDirectoryReport.class, "junitXml", task, null);
        add(TaskGeneratedSingleDirectoryReport.class, "html", task, "index.html");
    }

    public DirectoryReport getHtml() {
        return (DirectoryReport) getByName("html");
    }

    public DirectoryReport getJunitXml() {
        return (DirectoryReport) getByName("junitXml");
    }

}

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

package org.gradle.api.internal.tasks.testing;

import org.gradle.api.Task;
import org.gradle.api.reporting.ConfigurableReport;
import org.gradle.api.reporting.DirectoryReport;
import org.gradle.api.reporting.internal.TaskGeneratedSingleDirectoryReport;
import org.gradle.api.reporting.internal.TaskReportContainer;
import org.gradle.api.tasks.testing.TestReports;

public class DefaultTestReports extends TaskReportContainer<ConfigurableReport> implements TestReports {

    public DefaultTestReports(Task task) {
        super(ConfigurableReport.class, task);

        add(TaskGeneratedSingleDirectoryReport.class, "junitXml", task, null);
        add(TaskGeneratedSingleDirectoryReport.class, "html", task, "index.html");
    }

    public DirectoryReport getHtml() {
        return (DirectoryReport) getByName("html");
    }

    public DirectoryReport getJunitXml() {
        return (DirectoryReport) getByName("junitXml");
    }

}

Fix compile error due to class rename.


package com.shc.silenceengine.core.gameloops;

import com.shc.silenceengine.core.IGameLoop;
import com.shc.silenceengine.core.SilenceEngine;
import com.shc.silenceengine.graphics.opengl.GLContext;
import com.shc.silenceengine.utils.TimeUtils;

import static com.shc.silenceengine.graphics.IGraphicsDevice.Constants.*;

/**
 * @author Sri Harsha Chilakapati
 */
public class VariableTimeSteppedLoop implements IGameLoop
{
    private float prevTime = (int) TimeUtils.currentTime();

    @Override
    public void performLoopFrame()
    {
        float currTime = (float) TimeUtils.currentTime();
        float elapsedTime = currTime - prevTime;

        prevTime = currTime;

        SilenceEngine.eventManager.raiseUpdateEvent(elapsedTime);

        GLContext.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        SilenceEngine.eventManager.raiseRenderEvent(elapsedTime);
    }
}

package com.shc.silenceengine.core.gameloops;

import com.shc.silenceengine.core.IGameLoop;
import com.shc.silenceengine.core.SilenceEngine;
import com.shc.silenceengine.graphics.opengl.GLContext;
import com.shc.silenceengine.utils.TimeUtils;

import static com.shc.silenceengine.graphics.IGraphicsDevice.Constants.*;

/**
 * @author Sri Harsha Chilakapati
 */
public class VariableTimeSteppedLoop implements IGameLoop
{
    private float prevTime;

    @Override
    public void performLoopFrame()
    {
        if (prevTime == 0)
            prevTime = (int) TimeUtils.currentTime();

        float currTime = (float) TimeUtils.currentTime();
        float elapsedTime = currTime - prevTime;

        prevTime = currTime;

        SilenceEngine.eventManager.raiseUpdateEvent(elapsedTime);

        GLContext.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        SilenceEngine.eventManager.raiseRenderEvent(elapsedTime);
    }
}

Fix exception in initialization error in GameLoop


/**
 * See {@link org.cojen.tupl.Database} to get started with Tupl.
 */
module org.cojen.tupl {
    exports org.cojen.tupl;
    exports org.cojen.tupl.ext;
    exports org.cojen.tupl.io;
    exports org.cojen.tupl.repl;
    exports org.cojen.tupl.tools;
    exports org.cojen.tupl.util;

    requires transitive java.logging;

    requires transitive jdk.unsupported;

    requires transitive com.sun.jna;
    requires transitive com.sun.jna.platform;

    requires transitive org.cojen.maker;

    requires static java.management;

    requires static org.lz4.java;

    requires static org.slf4j;
}

/**
 * See {@link org.cojen.tupl.Database} to get started with Tupl.
 */
module org.cojen.tupl {
    exports org.cojen.tupl;
    exports org.cojen.tupl.ext;
    exports org.cojen.tupl.io;
    exports org.cojen.tupl.repl;
    exports org.cojen.tupl.tools;
    exports org.cojen.tupl.util;

    requires jdk.unsupported;

    requires com.sun.jna;
    requires com.sun.jna.platform;

    requires org.cojen.maker;

    // Could be transitive because it's part of the public API, but only in EventListener.
    // I doubt that the java.logging module is used much.
    requires static java.logging;

    requires static java.management;

    requires static org.lz4.java;

    requires static org.slf4j;
}

Remove transitive modifier from dependencies.


/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.types.requests.idol.actions.answer.params;

@SuppressWarnings({"WeakerAccess", "unused"})
public enum GetResourcesSortParam {
    ID("id"),
    CREATED_TIME("createdTime"),
    METADATA("metadata"),
    MODIFIED_TIME("modifiedTime"),
    POPULARITY("popularity"),
    RANDOM("random"),
    STATUS("status");

    private final String value;

    GetResourcesSortParam(final String value) {
        this.value = value;
    }

    public String value() {
        return value;
    }
}

/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.types.requests.idol.actions.answer.params;

@SuppressWarnings({"WeakerAccess", "unused"})
public enum GetResourcesSortParam {
    ID("id"),
    CREATED_TIME("createdTime"),
    LIKELIHOOD("likelihood"),
    METADATA("metadata"),
    MODIFIED_TIME("modifiedTime"),
    POPULARITY("popularity"),
    RANDOM("random"),
    STATUS("status");

    private final String value;

    GetResourcesSortParam(final String value) {
        this.value = value;
    }

    public String value() {
        return value;
    }
}

Add support for AnswerServer likelihood


package com.jonasgerdes.schauburgr.usecase.home.movies.movie_list;

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

import com.jonasgerdes.schauburgr.R;
import com.jonasgerdes.schauburgr.model.Movie;

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

/**
 * Created by jonas on 05.03.2017.
 */

public class MovieListAdapter extends RecyclerView.Adapter<MovieHolder> {

    private List<Movie> mMovies = new ArrayList<>();

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

    @Override
    public void onBindViewHolder(MovieHolder holder, int position) {
        Movie movie = mMovies.get(position);
        holder.onBind(movie);
    }

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

    public void setMovies(List<Movie> movies) {
        mMovies = movies;
        notifyDataSetChanged();
    }
}

package com.jonasgerdes.schauburgr.usecase.home.movies.movie_list;

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

import com.jonasgerdes.schauburgr.R;
import com.jonasgerdes.schauburgr.model.Movie;

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

import io.realm.RealmChangeListener;
import io.realm.RealmResults;

/**
 * Created by jonas on 05.03.2017.
 */

public class MovieListAdapter extends RecyclerView.Adapter<MovieHolder> {

    private List<Movie> mMovies = new ArrayList<>();

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

    @Override
    public void onBindViewHolder(MovieHolder holder, int position) {
        Movie movie = mMovies.get(position);
        holder.onBind(movie);
    }

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

    public void setMovies(RealmResults<Movie> movies) {
        mMovies = movies;
        notifyDataSetChanged();
        movies.addChangeListener(new RealmChangeListener<RealmResults<Movie>>() {
            @Override
            public void onChange(RealmResults<Movie> element) {
                notifyDataSetChanged();
            }
        });
    }
}

Add automatic refresh of movies when new data is available


package org.motechproject.server.pillreminder.util;

import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

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

public class Util {

    public static DateTime currentDateTime() {
        return new DateTime(DateTimeZone.UTC);
    }

    public static Date newDate(int year, int month, int day) {
        Calendar cal = Calendar.getInstance();
        cal.set(year, month, day);
        return cal.getTime();
    }

    public static boolean areDatesSame(Date date1, Date date2) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
        return dateFormat.format(date1).equals(dateFormat.format(date2));
    }

    public static Date getDateAfter(Date date, int numOfMonth) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.add(Calendar.MONTH, numOfMonth);
        return cal.getTime();
    }
}

package org.motechproject.server.pillreminder.util;

import org.joda.time.DateTime;

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

public class Util {

    public static DateTime currentDateTime() {
        return new DateTime();
    }

    public static Date newDate(int year, int month, int day) {
        Calendar cal = Calendar.getInstance();
        cal.set(year, month, day);
        return cal.getTime();
    }

    public static boolean areDatesSame(Date date1, Date date2) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
        return dateFormat.format(date1).equals(dateFormat.format(date2));
    }

    public static Date getDateAfter(Date date, int numOfMonth) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.add(Calendar.MONTH, numOfMonth);
        return cal.getTime();
    }
}

Remove UTC from time util<Manohar/Shruthi>


/**
 * $$\\ToureNPlaner\\$$
 */
package algorithms;

import com.carrotsearch.hppc.IntArrayList;

public class Points {
	private IntArrayList points;

	public Points() {
		points = new IntArrayList();
	}

	public void addPoint(int lat, int lon) {
		points.add(lat);
		points.add(lon);
	}

	public void addEmptyPoints(int num) {
		points.resize(this.size() + num*2);
	}

	public int getPointLat(int index) {
		return points.get(index * 2);
	}

	public int getPointLon(int index) {
		return points.get(index * 2 + 1);
	}

	public void setPointLat(int index, int lat) {
		points.set(index * 2, lat);
	}

	public void setPointLon(int index, int lon) {
		points.set(index * 2 + 1, lon);
	}

	public int size() {
		return points.size() / 2;
	}

}

/**
 * $$\\ToureNPlaner\\$$
 */
package algorithms;

import com.carrotsearch.hppc.IntArrayList;

public class Points {
	private IntArrayList points;

	public Points() {
		points = new IntArrayList();
	}

	public void addPoint(int lat, int lon) {
		points.add(lat);
		points.add(lon);
	}

	public void addEmptyPoints(int num) {
		points.resize(points.size() + num*2);
	}

	public int getPointLat(int index) {
		return points.get(index * 2);
	}

	public int getPointLon(int index) {
		return points.get(index * 2 + 1);
	}

	public void setPointLat(int index, int lat) {
		points.set(index * 2, lat);
	}

	public void setPointLon(int index, int lon) {
		points.set(index * 2 + 1, lon);
	}

	public int size() {
		return points.size() / 2;
	}

}

Fix allocation of points array for real