package no.deichman.services.utils;

import no.deichman.services.repository.Repository;
import no.deichman.services.uridefaults.BaseURI;
import org.apache.commons.lang3.RandomStringUtils;

public class UniqueURI {

    public static final int NO_OF_DIGITS = 12;

    private String getRandom() {
        return RandomStringUtils.randomNumeric(NO_OF_DIGITS);
    }

    private String getRandom(String type, BaseURI baseURI) {
        String random;
        switch (type) {
            case "work":        random = baseURI.getWorkURI() + "w" + getRandom();
                break;
            case "publication": random = baseURI.getPublicationURI() + "p" + getRandom();
                break;
            default:            random = null;
                break;
        }

        if (random == null) {
            throw new IllegalArgumentException("Unknown URI-type");
        }
        return random;

    }

    public String getNewURI(String type, Repository repository, BaseURI baseURI) {
        String random = null;
        boolean exists = true;

        while (exists) {
            random = getRandom(type, baseURI);
            exists = checkResourceExistence(random, repository);
        }
        return random;

    }

    public boolean checkResourceExistence(String random, Repository repository) {
        return repository.askIfResourceExists(random);
    }

}

package no.deichman.services.utils;

import no.deichman.services.repository.Repository;
import no.deichman.services.uridefaults.BaseURI;
import org.apache.commons.lang3.RandomStringUtils;

public class UniqueURI {

    public static final int NO_OF_DIGITS = 12;

    private String getRandom() {
        return RandomStringUtils.randomNumeric(NO_OF_DIGITS);
    }

    private String getRandom(String type, BaseURI baseURI) {
        String random;
        switch (type) {
            case "work":        random = baseURI.getWorkURI() + "w" + getRandom();
                break;
            case "publication": random = baseURI.getPublicationURI() + "p" + getRandom();
                break;
            default:            random = null;
                break;
        }

        if (random == null) {
            throw new IllegalArgumentException("Unknown URI-type");
        }
        return random;

    }

    public String getNewURI(String type, Repository repository, BaseURI baseURI) {
        String random = null;
        boolean exists = true;

        while (exists) {
            random = getRandom(type, baseURI);
            exists = checkResourceExistence(random, repository);
        }
        return random;

    }

    boolean checkResourceExistence(String random, Repository repository) {
        return repository.askIfResourceExists(random);
    }

}

Reduce scope of method (used in tests only).


/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.sip.communicator.impl.neomedia.device;

import javax.media.*;

import net.java.sip.communicator.impl.neomedia.imgstreaming.*;
import net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming.*;

/**
 * Add ImageStreaming capture device.
 *
 * @author Sebastien Vincent
 */
public class ImageStreamingAuto
{
    /**
     * Add capture devices.
     *
     * @throws Exception if problem when adding capture devices
     */
    public ImageStreamingAuto() throws Exception
    {
        String name = "Experimental desktop streaming";
        CaptureDeviceInfo devInfo
            = new CaptureDeviceInfo(
                    name,
                    new MediaLocator(
                            ImageStreamingUtils.LOCATOR_PROTOCOL + ":" + name),
                    DataSource.getFormats());

        /* add to JMF device manager */
        CaptureDeviceManager.addDevice(devInfo);
        CaptureDeviceManager.commit();
    }
}

/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.sip.communicator.impl.neomedia.device;

import javax.media.*;

import net.java.sip.communicator.impl.neomedia.imgstreaming.*;
import net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.imgstreaming.*;

/**
 * Add ImageStreaming capture device.
 *
 * @author Sebastien Vincent
 */
public class ImageStreamingAuto
{
    /**
     * Add capture devices.
     *
     * @throws Exception if problem when adding capture devices
     */
    public ImageStreamingAuto() throws Exception
    {
        String name = "Desktop Streaming (Experimental)";
        CaptureDeviceInfo devInfo
            = new CaptureDeviceInfo(
                    name,
                    new MediaLocator(
                            ImageStreamingUtils.LOCATOR_PROTOCOL + ":" + name),
                    DataSource.getFormats());

        /* add to JMF device manager */
        CaptureDeviceManager.addDevice(devInfo);
        CaptureDeviceManager.commit();
    }
}

Change name displayed for desktop streaming device in the media configuration panel.


// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision.zone;

/**
 * The routing methods supported by a zone.
 *
 * @author mpolden
 */
public enum RoutingMethod {

    /** Routing happens through shared routing layer */
    shared,

    /** Routing happens through a dedicated layer 4 load balancer */
    exclusive,

}

// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision.zone;

/**
 * The routing methods supported by a zone.
 *
 * @author mpolden
 */
public enum RoutingMethod {

    /** Routing happens through shared routing layer */
    shared,

    /** Routing happens through a dedicated layer 4 load balancer */
    exclusive,

    /** Routing happens through a shared layer 4 load balancer */
    shared_layer_4
}

Add shared layer 4 routing method

Add shared layer 4 routing method


package uk.ac.ebi.spot.goci.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import uk.ac.ebi.spot.goci.model.Event;

/**
 * Created by emma on 06/05/16.
 *
 * @author emma
 *         <p>
 *         Repository accessing Evnet entity object
 */
@RepositoryRestResource
public interface EventRepository extends JpaRepository<Event, Long> {

}

package uk.ac.ebi.spot.goci.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import uk.ac.ebi.spot.goci.model.Event;

import java.util.List;

/**
 * Created by emma on 06/05/16.
 *
 * @author emma
 *         <p>
 *         Repository accessing Event entity object
 */
@RepositoryRestResource
public interface EventRepository extends JpaRepository<Event, Long> {
    List<Event> findByUserId(Long id);
}

Add method to find by user id

Add method to find by user id


/*
 * Copyright 2014 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.frontend.configuration;

public class LoginTypes {

    public static final String DEFAULT = "default";
    public static final String CAS = "cas";
    public static final String EXTERNAL = "external";
    public static final String SINGLE_USER = "singleUser";

}

/*
 * Copyright 2014 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.frontend.configuration;

/**
 * Constants representing different ways of logging into an application.  Used by other configuration modules and other
 * frontend libraries.
 */
public class LoginTypes {

    public static final String DEFAULT = "default";
    public static final String CAS = "cas";
    public static final String EXTERNAL = "external";
    public static final String SINGLE_USER = "singleUser";

}

Add documentation to Login types.

Add documentation to Login types.


package com.clementscode.mmi.swing;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JPanel;

public class ActionForCategoryItemGui extends AbstractAction {
	private static final long serialVersionUID = 1L;
	private String cmd;
	private GuiForCategoryItem guiForCategoryItem;

	public ActionForCategoryItemGui(String cmd,
			GuiForCategoryItem guiForCategoryItem, String text) {
		super(text);
		this.cmd = cmd;
		this.guiForCategoryItem = guiForCategoryItem;

	}

	public void actionPerformed(ActionEvent e) {
		CrudFrame crudFrame = guiForCategoryItem.getCrudFrame();

		if (CrudFrame.ADD_CATEGORY_ITEM.equals(cmd)) {

			GuiForCategoryItem g4ci = new GuiForCategoryItem(crudFrame);
			crudFrame.getLstGuiForCategoryItems().add(g4ci);
			crudFrame.getDiyTable().add(g4ci);
		} else if (CrudFrame.DELETE_CATEGORY_ITEM.equals(cmd)) {
			JPanel diyTable = crudFrame.getDiyTable();
			diyTable.remove(guiForCategoryItem);
		}
		crudFrame.refreshGui();

	}

}

package com.clementscode.mmi.swing;

import java.awt.Component;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JPanel;

public class ActionForCategoryItemGui extends AbstractAction {
	private static final long serialVersionUID = 1L;
	private String cmd;
	private GuiForCategoryItem guiForCategoryItem;

	public ActionForCategoryItemGui(String cmd,
			GuiForCategoryItem guiForCategoryItem, String text) {
		super(text);
		this.cmd = cmd;
		this.guiForCategoryItem = guiForCategoryItem;

	}

	public void actionPerformed(ActionEvent e) {
		CrudFrame crudFrame = guiForCategoryItem.getCrudFrame();
		JPanel diyTable = crudFrame.getDiyTable();
		if (CrudFrame.ADD_CATEGORY_ITEM.equals(cmd)) {

			GuiForCategoryItem g4ci = new GuiForCategoryItem(crudFrame);
			crudFrame.getLstGuiForCategoryItems().add(g4ci);
			int oneBellow = 0;
			int numComponents = diyTable.getComponentCount();
			for (int n = 0; n < numComponents; ++n) {
				Component comp = diyTable.getComponent(n);
				if (comp.equals(guiForCategoryItem)) {
					oneBellow = n + 1;
					break;
				}
			}
			crudFrame.getDiyTable().add(g4ci, oneBellow);
		} else if (CrudFrame.DELETE_CATEGORY_ITEM.equals(cmd)) {

			diyTable.remove(guiForCategoryItem);
		}
		crudFrame.refreshGui();

	}

}

Add another button in CrudFrame now adds below the current category item.


// Copyright: (c) 2014 Christopher Davis <http://christopherdavis.me>
// License: MIT http://opensource.org/licenses/MIT

package org.chrisguitarguy.beanstalkc;

import java.util.Map;

class ConnectionHelper
{
    private static Map<String, String> env = System.getenv();
    private static String host = null;
    private static Integer port = null;

    public static Client create() throws Exception
    {
        return new DefaultClient(getHost(), getPort());
    }

    private static int getPort() throws Exception
    {
        if (port != null) {
            return port;
        }

        if (!env.containsKey("BEANSTALKD_PORT")) {
            throw new Exception("BEANSTALKD_PORT not set");
        }

        port = Integer.parseInt(env.get("BEANSTALKD_PORT"));

        return port;
    }

    private static String getHost() throws Exception
    {
        if (host != null) {
            return host;
        }

        if (!env.containsKey("BEANSTALKD_HOST")) {
            throw new Exception("BEANSTALKD_HOST not set");
        }

        host = env.get("BEANSTALKD_HOST");

        return host;
    }
}

// Copyright: (c) 2014 Christopher Davis <http://christopherdavis.me>
// License: MIT http://opensource.org/licenses/MIT

package org.chrisguitarguy.beanstalkc;

import java.util.Properties;

class ConnectionHelper
{
    private static Properties env = System.getProperties();
    private static String host = null;
    private static Integer port = null;

    public static Client create() throws Exception
    {
        return new DefaultClient(getHost(), getPort());
    }

    private static int getPort() throws Exception
    {
        if (port != null) {
            return port;
        }

        if (!env.containsKey("BEANSTALKD_PORT")) {
            throw new Exception("BEANSTALKD_PORT not set");
        }

        port = Integer.parseInt((String)env.get("BEANSTALKD_PORT"));

        return port;
    }

    private static String getHost() throws Exception
    {
        if (host != null) {
            return host;
        }

        if (!env.containsKey("BEANSTALKD_HOST")) {
            throw new Exception("BEANSTALKD_HOST not set");
        }

        host = (String)env.get("BEANSTALKD_HOST");

        return host;
    }
}

Use system properties instead of environment variables


/*
 * Copyright 2012 Ryan W Tenney (http://ryan.10e.us)
 *            and Martello Technologies (http://martellotech.com)
 *
 * 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.ryantenney.metrics.spring;

import org.junit.Assert;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.yammer.metrics.HealthChecks;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.HealthCheckRegistry;
import com.yammer.metrics.core.MetricsRegistry;

public class NamedRegistryTest {

	@Test
	public void testNamedRegistry() {
		ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:named-registry.xml");
		Assert.assertSame("MetricsRegistry should have name.", "SpecifiedRegistryName", ctx.getBean(MetricsRegistry.class).getName());
	}

}

/*
 * Copyright 2012 Ryan W Tenney (http://ryan.10e.us)
 *            and Martello Technologies (http://martellotech.com)
 *
 * 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.ryantenney.metrics.spring;

import org.junit.Assert;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.yammer.metrics.HealthChecks;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.HealthCheckRegistry;
import com.yammer.metrics.core.MetricsRegistry;

public class NamedRegistryTest {

	@Test
	public void testNamedRegistry() {
		ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:named-registry.xml");
		Assert.assertEquals("MetricsRegistry should have name.", "SpecifiedRegistryName", ctx.getBean(MetricsRegistry.class).getName());
	}

}

Test failing in OpenJDK6 (but not OracleJDK7?) due to using assertSame to compare strings, switch to assertEquals.


package com.testfabrik.webmate.javasdk.testmgmt;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Optional;
import com.testfabrik.webmate.javasdk.JacksonMapper;

/**
 * Contains TestExecutionId and optionally TestRunId.
 */
class CreateTestExecutionResponse {
    public final TestExecutionId executionId;

    public final Optional<TestRunId> optTestRunId;

    CreateTestExecutionResponse(TestExecutionId executionId, Optional<TestRunId> optTestRunId) {
        this.executionId = executionId;
        this.optTestRunId = optTestRunId;
    }

    @JsonCreator()
    public static CreateTestExecutionResponse fromJson(JsonNode json) {
        TestExecutionId executionId = TestExecutionId.of(json.get("textExecutionId").asText());
        Optional<TestRunId> testRunId = Optional.absent();

        if (json.has("testRunId")) {
            testRunId = Optional.of(TestRunId.of(json.get("testRunId").asText()));
        }
        return new CreateTestExecutionResponse(executionId, testRunId);
    }
}

package com.testfabrik.webmate.javasdk.testmgmt;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Optional;
import com.testfabrik.webmate.javasdk.JacksonMapper;

/**
 * Contains TestExecutionId and optionally TestRunId.
 */
public class CreateTestExecutionResponse {
    public final TestExecutionId executionId;

    public final Optional<TestRunId> optTestRunId;

    public CreateTestExecutionResponse(TestExecutionId executionId, Optional<TestRunId> optTestRunId) {
        this.executionId = executionId;
        this.optTestRunId = optTestRunId;
    }

    @JsonCreator()
    public static CreateTestExecutionResponse fromJson(JsonNode json) {
        TestExecutionId executionId = TestExecutionId.of(json.get("testExecutionId").textValue());
        Optional<TestRunId> testRunId = Optional.absent();

        if (json.has("testRunId")) {
            testRunId = Optional.of(TestRunId.of(json.get("testRunId").textValue()));
        }
        return new CreateTestExecutionResponse(executionId, testRunId);
    }
}

Fix for changed createTestExecution API WMKNBN-6045


/*
 * Copyright (c) 2019, 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 org.wso2.carbon.dashboards.core.internal.authorizer;

import feign.Headers;
import feign.Param;
import feign.RequestLine;
import feign.Response;

/**
 * Feign client to send request to admin rest api to get tenant info.
 */
public interface DashboardAuthorizerServiceStub {

    @RequestLine("GET /api/am/admin/v0.15/tenant-info/{username}")
    @Headers("Content-Type: application/json")
    Response getTenantId(@Param("username") String username);
}

/*
 * Copyright (c) 2019, 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 org.wso2.carbon.dashboards.core.internal.authorizer;

import feign.Headers;
import feign.Param;
import feign.RequestLine;
import feign.Response;

/**
 * Feign client to send request to admin rest api to get tenant info.
 */
public interface DashboardAuthorizerServiceStub {

    @RequestLine("GET /api/am/admin/v0.16/tenant-info/{username}")
    @Headers("Content-Type: application/json")
    Response getTenantId(@Param("username") String username);
}

Update the admin rest api version

Update the admin rest api version


package org.sagebionetworks.bridge.models.surveys;

import java.util.EnumSet;

public class NumericalConstraints extends Constraints {

    private Unit unit;
    private Double minValue;
    private Double maxValue;
    private Double step;

    public NumericalConstraints() {
        setSupportedHints(EnumSet.of(UIHint.NUMBERFIELD, UIHint.SLIDER));
    }

    public Unit getUnit() {
        return unit;
    }
    public void setUnit(Unit unit) {
        this.unit = unit;
    }
    public Double getMinValue() {
        return minValue;
    }
    public void setMinValue(Double minValue) {
        this.minValue = minValue;
    }
    public Double getMaxValue() {
        return maxValue;
    }
    public void setMaxValue(Double maxValue) {
        this.maxValue = maxValue;
    }
    public Double getStep() {
        return step;
    }
    public void setStep(Double step) {
        this.step = step;
    }
}

package org.sagebionetworks.bridge.models.surveys;

import java.util.EnumSet;

public class NumericalConstraints extends Constraints {

    private Unit unit;
    private Double minValue;
    private Double maxValue;
    private Double step;

    public NumericalConstraints() {
        setSupportedHints(EnumSet.of(UIHint.NUMBERFIELD, UIHint.SLIDER, UIHint.SELECT));
    }

    public Unit getUnit() {
        return unit;
    }
    public void setUnit(Unit unit) {
        this.unit = unit;
    }
    public Double getMinValue() {
        return minValue;
    }
    public void setMinValue(Double minValue) {
        this.minValue = minValue;
    }
    public Double getMaxValue() {
        return maxValue;
    }
    public void setMaxValue(Double maxValue) {
        this.maxValue = maxValue;
    }
    public Double getStep() {
        return step;
    }
    public void setStep(Double step) {
        this.step = step;
    }
}

Add UIHint.SELECT to NumericaContraint's supported hints


package org.commcare.android.tasks.templates;

/**
 * @author ctsims
 */
public interface CommCareTaskConnector<R> {

     /**
      * IMPORTANT: Any implementing class of CommCareTaskConnector should be
      * implemented such that it will only automatically manage the dialog of a
      * connected task IF the task id is non-negative. If the user does NOT
      * want to implement a dialog, or is implementing the dialog in a
      * different way, they should be able to use a negative task id in order
      * to avoid this.
      */
    public <A, B, C> void connectTask(CommCareTask<A,B,C,R> task);

    /**
     * Should call showProgressDialog() for a task if its id is non-negative,
     * and if there is no dialog already showing
     */
    public void startBlockingForTask(int id);

    /**
     * Should call dismissProgressDialog() for a task if its id is
     * non-negative, and if shouldDismissDialog is true (this flag should be
     * controlled by the task transition)
     */
    public void stopBlockingForTask(int id);

    public void taskCancelled(int id);

    public R getReceiver();

    /**
     * Should be called at the beginning of onPostExecute or onCancelled for
     * any CommCareTask, indicating that we are starting a potential transition
     * from one task to another (if the end of the first task triggers the
     * start of another)
     */
    public void startTaskTransition();

    /**
     * Should be called at the end of onPreExecute or onCancelled for any
     * CommCareTask, indicating that we are ending a potential transition from
     * one task to another
     */
    public void stopTaskTransition();
}

package org.commcare.android.tasks.templates;

/**
 * @author ctsims
 */
public interface CommCareTaskConnector<R> {

     /**
      * IMPORTANT: Any implementing class of CommCareTaskConnector should be
      * implemented such that it will only automatically manage the dialog of a
      * connected task IF the task id is non-negative. If the user does NOT
      * want to implement a dialog, or is implementing the dialog in a
      * different way, they should be able to use a negative task id in order
      * to avoid this.
      */
    <A, B, C> void connectTask(CommCareTask<A,B,C,R> task);

    /**
     * Should call showProgressDialog() for a task if its id is non-negative,
     * and if there is no dialog already showing
     */
    void startBlockingForTask(int id);

    /**
     * Should call dismissProgressDialog() for a task if its id is
     * non-negative, and if shouldDismissDialog is true (this flag should be
     * controlled by the task transition)
     */
    void stopBlockingForTask(int id);

    void taskCancelled(int id);

    R getReceiver();

    /**
     * Should be called at the beginning of onPostExecute or onCancelled for
     * any CommCareTask, indicating that we are starting a potential transition
     * from one task to another (if the end of the first task triggers the
     * start of another)
     */
    void startTaskTransition();

    /**
     * Should be called at the end of onPreExecute or onCancelled for any
     * CommCareTask, indicating that we are ending a potential transition from
     * one task to another
     */
    void stopTaskTransition();
}

Remove public keyword from interface declarations


package vanilla.java.echo;

import net.openhft.affinity.AffinityLock;
import net.openhft.chronicle.Chronicle;
import net.openhft.chronicle.ChronicleQueueBuilder;
import net.openhft.chronicle.ExcerptAppender;
import net.openhft.chronicle.ExcerptTailer;

import java.io.IOException;

public class QueueServerMain {
    public static void main(String... args) throws IOException {
        String host = args[0];
        if (!host.equals("localhost"))
            AffinityLock.acquireLock();

        Chronicle inbound = ChronicleQueueBuilder
                .indexed("/tmp/server-inbound")
                .sink().connectAddress(host, 54001)
                .build();
        ExcerptTailer tailer = inbound.createTailer().toEnd();

        Chronicle outbound = ChronicleQueueBuilder
                .indexed("/tmp/server-outbound")
                .source().bindAddress(54002)
                .build();

        ExcerptAppender appender = outbound.createAppender();

        long count = 0, next = 1000000;
        while (true) {
            if (tailer.nextIndex()) {
                appender.startExcerpt();
                appender.write(tailer);
                appender.finish();
                count++;
/*
                System.out.print(".");
                if ((count & 127) == 0)
                    System.out.println();
*/
            } else {
                if (count >= next)
                    System.out.println(count);
                next += 1000000;
            }
        }
    }
}

package vanilla.java.echo;

import net.openhft.affinity.AffinityLock;
import net.openhft.chronicle.Chronicle;
import net.openhft.chronicle.ChronicleQueueBuilder;
import net.openhft.chronicle.ExcerptAppender;
import net.openhft.chronicle.ExcerptTailer;

import java.io.IOException;

public class QueueServerMain {
    public static void main(String... args) throws IOException {
        String host = args[0];

        Chronicle inbound = ChronicleQueueBuilder
                .indexed("/tmp/server-inbound")
                .sink().connectAddress(host, 54001)
                .build();
        ExcerptTailer tailer = inbound.createTailer().toEnd();

        Chronicle outbound = ChronicleQueueBuilder
                .indexed("/tmp/server-outbound")
                .source().bindAddress(54002)
                .build();

        ExcerptAppender appender = outbound.createAppender();

        if (!host.equals("localhost"))
            AffinityLock.acquireLock();

        long count = 0, next = 1000000;
        while (true) {
            if (tailer.nextIndex()) {
                appender.startExcerpt();
                appender.write(tailer);
                appender.finish();
                count++;
/*
                System.out.print(".");
                if ((count & 127) == 0)
                    System.out.println();
*/
            } else {
                if (count >= next)
                    System.out.println(count);
                next += 1000000;
            }
        }
    }
}

Add test for round tripping via chronicle indexed.


//J-
package com.whippy.poker.common.beans;

public class ClientTable {

        private ClientSeat[] seats;
        private int id;
        private TableState state;
        private int dealerPosition;
        private int currentPot;

        public ClientTable(ClientSeat[] seats, int id, TableState state, int dealerPosition, int currentPot) {
                this.seats = seats;
                this.id = id;
                this.state = state;
                this.dealerPosition = dealerPosition;
                this.currentPot = currentPot;
        }

        public void setSeats(ClientSeat[] seats) {
                this.seats = seats;
        }

        public void setId(int id) {
                this.id = id;
        }

        public void setState(TableState state) {
                this.state = state;
        }

        public void setDealerPosition(int dealerPosition) {
                this.dealerPosition = dealerPosition;
        }

        public ClientTable(){

        }

        public ClientSeat[] getSeats() {
                return seats;
        }

        public int getId() {
                return id;
        }

        public TableState getState() {
                return state;
        }

        public int getDealerPosition() {
                return dealerPosition;
        }

}
//J+

//J-
package com.whippy.poker.common.beans;

import java.util.List;

public class ClientTable {

        private ClientSeat[] seats;
        private int id;
        private TableState state;
        private int dealerPosition;
        private int currentPot;
        private List<Card> currentCards;

        public ClientTable(ClientSeat[] seats, int id, TableState state, int dealerPosition, int currentPot, List<Card> currentCards) {
                this.seats = seats;
                this.id = id;
                this.state = state;
                this.dealerPosition = dealerPosition;
                this.setCurrentPot(currentPot);
                this.currentCards = currentCards;
        }

        public void setSeats(ClientSeat[] seats) {
                this.seats = seats;
        }

        public void setId(int id) {
                this.id = id;
        }

        public void setState(TableState state) {
                this.state = state;
        }

        public void setDealerPosition(int dealerPosition) {
                this.dealerPosition = dealerPosition;
        }

        public ClientTable(){

        }

        public ClientSeat[] getSeats() {
                return seats;
        }

        public int getId() {
                return id;
        }

        public TableState getState() {
                return state;
        }

        public int getDealerPosition() {
                return dealerPosition;
        }

        public int getCurrentPot() {
                return currentPot;
        }

        public void setCurrentPot(int currentPot) {
                this.currentPot = currentPot;
        }

        public List<Card> getCurrentCards() {
                return currentCards;
        }

        public void setCurrentCards(List<Card> currentCards) {
                this.currentCards = currentCards;
        }

}
//J+

Add current pot and cards to client table representation


package com.barefootcoders.android.react.KDSocialShare;

import android.app.Activity;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

public class KDSocialShare implements ReactPackage {
    public KDSocialShare(Activity activity) {
    } // backwards compatability

    public KDSocialShare() {
    }

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        return Arrays.<NativeModule>asList(new KDSocialShareModule(reactContext));
    }

    @Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }
}

package com.barefootcoders.android.react.KDSocialShare;

import android.app.Activity;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

public class KDSocialShare implements ReactPackage {
    public KDSocialShare(Activity activity) {
    } // backwards compatability

    public KDSocialShare() {
    }

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        return Arrays.<NativeModule>asList(new KDSocialShareModule(reactContext));
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }
}

Fix breaking change for RN 0.47

Fix breaking change for RN 0.47


package org.spoofax.jsglr2;

import org.metaborg.parsetable.IParseTable;
import org.spoofax.interpreter.terms.IStrategoTerm;
import org.spoofax.jsglr2.parser.observing.LogParserObserver;

public class JSGLR2Spec {

    public final JSGLR2Variant.Preset variant;
    public final JSGLR2Logging logging;

    public JSGLR2Spec(JSGLR2Variant.Preset variant, JSGLR2Logging logging) {
        this.variant = variant;
        this.logging = logging;
    }

    public JSGLR2<IStrategoTerm> getJSGLR2(IParseTable parseTable) {
        JSGLR2<IStrategoTerm> jsglr2 = variant.getJSGLR2(parseTable);

        if(logging != JSGLR2Logging.None)
            jsglr2.attachObserver(new LogParserObserver(logging));

        return jsglr2;
    }

}

package org.spoofax.jsglr2;

import java.util.function.Consumer;

import org.metaborg.parsetable.IParseTable;
import org.metaborg.util.log.ILogger;
import org.metaborg.util.log.LoggerUtils;
import org.spoofax.interpreter.terms.IStrategoTerm;
import org.spoofax.jsglr2.parser.observing.LogParserObserver;

public class JSGLR2Spec {

    private static final ILogger logger = LoggerUtils.logger(JSGLR2.class);
    private static final Consumer<String> loggerConsumer = logger::info;

    public final JSGLR2Variant.Preset variant;
    public final JSGLR2Logging logging;

    public JSGLR2Spec(JSGLR2Variant.Preset variant, JSGLR2Logging logging) {
        this.variant = variant;
        this.logging = logging;
    }

    public JSGLR2<IStrategoTerm> getJSGLR2(IParseTable parseTable) {
        JSGLR2<IStrategoTerm> jsglr2 = variant.getJSGLR2(parseTable);

        if(logging != JSGLR2Logging.None)
            jsglr2.attachObserver(new LogParserObserver(loggerConsumer, logging));

        return jsglr2;
    }

}

Use logger instead of stdout for JSGLR2 logging


// Copyright 2000-2019 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.openapi.vcs.changes;

import com.intellij.diff.editor.VCSContentVirtualFile;
import com.intellij.openapi.fileEditor.impl.EditorTabTitleProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class VcsEditorTabTitleProvider implements EditorTabTitleProvider {

  @Nullable
  @Override
  public String getEditorTabTitle(@NotNull Project project, @NotNull VirtualFile file) {
    return getEditorTabName(file);
  }

  @Nullable
  @Override
  public String getEditorTabTooltipText(@NotNull Project project, @NotNull VirtualFile virtualFile) {
    return getEditorTabName(virtualFile);
  }

  @Nullable
  private static String getEditorTabName(@NotNull VirtualFile file) {
    if (file instanceof PreviewDiffVirtualFile) {
      return ((PreviewDiffVirtualFile)file).getProvider().getEditorTabName();
    }

    if (file instanceof VCSContentVirtualFile) {
      return ((VCSContentVirtualFile)file).getTabName();
    }

    return null;
  }
}

// Copyright 2000-2020 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.openapi.vcs.changes;

import com.intellij.diff.editor.VCSContentVirtualFile;
import com.intellij.openapi.fileEditor.impl.EditorTabTitleProvider;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class VcsEditorTabTitleProvider implements EditorTabTitleProvider, DumbAware {

  @Nullable
  @Override
  public String getEditorTabTitle(@NotNull Project project, @NotNull VirtualFile file) {
    return getEditorTabName(file);
  }

  @Nullable
  @Override
  public String getEditorTabTooltipText(@NotNull Project project, @NotNull VirtualFile virtualFile) {
    return getEditorTabName(virtualFile);
  }

  @Nullable
  private static String getEditorTabName(@NotNull VirtualFile file) {
    if (file instanceof PreviewDiffVirtualFile) {
      return ((PreviewDiffVirtualFile)file).getProvider().getEditorTabName();
    }

    if (file instanceof VCSContentVirtualFile) {
      return ((VCSContentVirtualFile)file).getTabName();
    }

    return null;
  }
}

vcs: Fix editor diff preview tab title in dumb mode

GitOrigin-RevId: c0a28542fe11dce1c283c58a5c5c3501f973645d


package org.apache.mesos.elasticsearch.scheduler.state;

import org.apache.log4j.Logger;

import java.io.IOException;
import java.security.InvalidParameterException;

/**
 * Path utilities
 */
public class StatePath {
    private static final Logger LOGGER = Logger.getLogger(StatePath.class);
    private SerializableState zkState;
    public StatePath(SerializableState zkState) {
        this.zkState = zkState;
    }

    /**
     * Creates the zNode if it does not exist. Will create parent directories.
     * @param key the zNode path
     */
    public void mkdir(String key) throws IOException {
        key = key.replace(" ", "");
        if (key.endsWith("/") && !key.equals("/")) {
            throw new InvalidParameterException("Trailing slash not allowed in zookeeper path");
        }
        String[] split = key.split("/");
        StringBuilder builder = new StringBuilder();
        for (String s : split) {
            builder.append(s);
            if (!s.isEmpty() && !exists(builder.toString())) {
                zkState.set(builder.toString(), null);
            }
            builder.append("/");
        }
    }

    public Boolean exists(String key) throws IOException {
        Boolean exists = true;
        Object value = zkState.get(key);
        if (value == null) {
            exists = false;
        }
        return exists;
    }

    public void rm(String key) throws IOException {
        key = key.replace(" ", "");
        zkState.delete(key);
    }
}

package org.apache.mesos.elasticsearch.scheduler.state;

import java.io.IOException;
import java.security.InvalidParameterException;

/**
 * Path utilities
 */
public class StatePath {
    private SerializableState zkState;
    public StatePath(SerializableState zkState) {
        this.zkState = zkState;
    }

    /**
     * Creates the zNode if it does not exist. Will create parent directories.
     * @param key the zNode path
     */
    public void mkdir(String key) throws IOException {
        key = key.replace(" ", "");
        if (key.endsWith("/") && !key.equals("/")) {
            throw new InvalidParameterException("Trailing slash not allowed in zookeeper path");
        }
        String[] split = key.split("/");
        StringBuilder builder = new StringBuilder();
        for (String s : split) {
            builder.append(s);
            if (!s.isEmpty() && !exists(builder.toString())) {
                zkState.set(builder.toString(), null);
            }
            builder.append("/");
        }
    }

    public Boolean exists(String key) throws IOException {
        Boolean exists = true;
        Object value = zkState.get(key);
        if (value == null) {
            exists = false;
        }
        return exists;
    }

    /**
     * Remove a zNode or zFolder.
     *
     * @param key the path to remove.
     * @throws IOException If unable to remove
     */
    public void rm(String key) throws IOException {
        zkState.delete(key);
    }
}

Add comments. Remove space removal.

Review: Add comments. Remove space removal.


package me.jesensky.dan.playertracker.net.packets;

import me.jesensky.dan.playertracker.exceptions.InvalidPacketException;

public class DataResponsePacket extends Packet{
    public DataResponsePacket(byte... data) throws InvalidPacketException{
        super(PacketType.SEND_DATA, data);
    }
}

package me.jesensky.dan.playertracker.net.packets;

import me.jesensky.dan.playertracker.exceptions.InvalidPacketException;

public class DataResponsePacket extends Packet{
    public DataResponsePacket(byte... data) throws InvalidPacketException{
    super(PacketType.DATA_RESPONSE, data);
    }
}

Complete refactor of SEND_DATA -> DATA_RESPONSE


package me.samthompson.bubbleactions_sample;

import android.app.Application;

import com.facebook.stetho.Stetho;

/**
 * Created by sam on 12/9/15.
 */
public class BubbleActionsApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        Stetho.initializeWithDefaults(this);
    }

}

package me.samthompson.bubbleactions_sample;

import android.app.Application;

/**
 * Created by sam on 12/9/15.
 */
public class BubbleActionsApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
    }

}

Remove stetho. Will write test cases instead of checking layout hierarchy manually.


package com.containersol.minimesos.mesos;

import com.containersol.minimesos.MesosCluster;
import com.containersol.minimesos.container.AbstractContainer;
import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.CreateContainerCmd;
import com.github.dockerjava.api.model.ExposedPort;

/**
 * Base zookeeper class
 */
public class ZooKeeper extends AbstractContainer {
    public static final String MESOS_LOCAL_IMAGE = "jplock/zookeeper";
    public static final String REGISTRY_TAG = "latest";
    public static final int DEFAULT_ZOOKEEPER_PORT = 2181;

    protected ZooKeeper(DockerClient dockerClient) {
        super(dockerClient);
    }

    @Override
    protected void pullImage() {
        pullImage(MESOS_LOCAL_IMAGE, REGISTRY_TAG);
    }

    @Override
    protected CreateContainerCmd dockerCommand() {
        return dockerClient.createContainerCmd(MESOS_LOCAL_IMAGE + ":" + REGISTRY_TAG)
                .withName("minimesos-zookeeper-" + MesosCluster.getClusterId() + "-" + getRandomId())
                .withExposedPorts(new ExposedPort(DEFAULT_ZOOKEEPER_PORT), new ExposedPort(2888), new ExposedPort(3888));
    }

    public static String formatZKAddress(String ipAddress) {
        return "zk://" + ipAddress + ":" + DEFAULT_ZOOKEEPER_PORT;
    }
}

package com.containersol.minimesos.mesos;

import com.containersol.minimesos.MesosCluster;
import com.containersol.minimesos.container.AbstractContainer;
import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.CreateContainerCmd;
import com.github.dockerjava.api.model.ExposedPort;

/**
 * Base zookeeper class
 */
public class ZooKeeper extends AbstractContainer {
    public static final String MESOS_LOCAL_IMAGE = "jplock/zookeeper";
    public static final String REGISTRY_TAG = "3.4.6";
    public static final int DEFAULT_ZOOKEEPER_PORT = 2181;

    protected ZooKeeper(DockerClient dockerClient) {
        super(dockerClient);
    }

    @Override
    protected void pullImage() {
        pullImage(MESOS_LOCAL_IMAGE, REGISTRY_TAG);
    }

    @Override
    protected CreateContainerCmd dockerCommand() {
        return dockerClient.createContainerCmd(MESOS_LOCAL_IMAGE + ":" + REGISTRY_TAG)
                .withName("minimesos-zookeeper-" + MesosCluster.getClusterId() + "-" + getRandomId())
                .withExposedPorts(new ExposedPort(DEFAULT_ZOOKEEPER_PORT), new ExposedPort(2888), new ExposedPort(3888));
    }

    public static String formatZKAddress(String ipAddress) {
        return "zk://" + ipAddress + ":" + DEFAULT_ZOOKEEPER_PORT;
    }
}

Make the jplock/zookeeper tag explicit (3.4.6 instead of 'latest')


package io.github.aquerr.eaglefactions.common.commands;

import io.github.aquerr.eaglefactions.api.EagleFactions;
import io.github.aquerr.eaglefactions.common.PluginInfo;
import io.github.aquerr.eaglefactions.common.messaging.Messages;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.text.Text;

public class ReloadCommand extends AbstractCommand
{
    public ReloadCommand(EagleFactions plugin)
    {
        super(plugin);
    }

    @Override
    public CommandResult execute(CommandSource source, CommandContext context) throws CommandException
    {
        try
        {
            super.getPlugin().getConfiguration().reloadConfiguration();
            super.getPlugin().getStorageManager().reloadStorage();

            source.sendMessage(Text.of(PluginInfo.PLUGIN_PREFIX, Messages.CONFIG_HAS_BEEN_RELOADED));
        }
        catch (Exception exception)
        {
            exception.printStackTrace();
        }

        return CommandResult.success();
    }
}

package io.github.aquerr.eaglefactions.common.commands;

import io.github.aquerr.eaglefactions.api.EagleFactions;
import io.github.aquerr.eaglefactions.common.PluginInfo;
import io.github.aquerr.eaglefactions.common.messaging.Messages;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColors;

public class ReloadCommand extends AbstractCommand
{
    public ReloadCommand(EagleFactions plugin)
    {
        super(plugin);
    }

    @Override
    public CommandResult execute(CommandSource source, CommandContext context) throws CommandException
    {
        try
        {
            super.getPlugin().getConfiguration().reloadConfiguration();
            super.getPlugin().getStorageManager().reloadStorage();

            source.sendMessage(Text.of(PluginInfo.PLUGIN_PREFIX, TextColors.GREEN, Messages.CONFIG_HAS_BEEN_RELOADED));
        }
        catch (Exception exception)
        {
            exception.printStackTrace();
        }

        return CommandResult.success();
    }
}

Change color of reload commands message to green


package org.knowm.xchange.binance.dto.trade;

import com.fasterxml.jackson.annotation.JsonProperty;

public final class BinanceCancelledOrder {

  public final String symbol;
  public final String origClientOrderId;
  public final long orderId;
  public final String clientOrderId;

  public BinanceCancelledOrder(
      @JsonProperty("symbol") String symbol,
      @JsonProperty("origClientOrderId") String origClientOrderId,
      @JsonProperty("orderId") long orderId,
      @JsonProperty("clientOrderId") String clientOrderId) {
    super();
    this.symbol = symbol;
    this.origClientOrderId = origClientOrderId;
    this.orderId = orderId;
    this.clientOrderId = clientOrderId;
  }
}

package org.knowm.xchange.binance.dto.trade;

import com.fasterxml.jackson.annotation.JsonProperty;

public final class BinanceCancelledOrder {

    public final String symbol;
    public final String origClientOrderId;
    public final long orderId;
    public final String clientOrderId;
    public String price;
    public String origQty;
    public String executedQty;
    public String cummulativeQuoteQty;
    public String status;
    public String timeInForce;
    public String type;
    public String side;

    public BinanceCancelledOrder(
            @JsonProperty("symbol") String symbol,
            @JsonProperty("origClientOrderId") String origClientOrderId,
            @JsonProperty("orderId") long orderId,
            @JsonProperty("clientOrderId") String clientOrderId,
            @JsonProperty("price") String price,
            @JsonProperty("origQty") String origQty,
            @JsonProperty("executedQty") String executedQty,
            @JsonProperty("cummulativeQuoteQty") String cummulativeQuoteQty,
            @JsonProperty("status") String status,
            @JsonProperty("timeInForce") String timeInForce,
            @JsonProperty("type") String type,
            @JsonProperty("side") String side) {
        super();
        this.symbol = symbol;
        this.origClientOrderId = origClientOrderId;
        this.orderId = orderId;
        this.clientOrderId = clientOrderId;
        this.price = price;
        this.origQty = origQty;
        this.executedQty = executedQty;
        this.cummulativeQuoteQty = cummulativeQuoteQty;
        this.status = status;
        this.timeInForce = timeInForce;
        this.type = type;
        this.side = side;
    }
}

Add all response CancelOrder fields

Add all response CancelOrder fields


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

package net.oauth.client.httpclient4;

import net.oauth.OAuthAccessor;
import org.apache.http.auth.UsernamePasswordCredentials;

/**
 * @author John Kristian
 */
public class OAuthCredentials extends UsernamePasswordCredentials {

    private final OAuthAccessor accessor;

    public OAuthCredentials(OAuthAccessor accessor) {
        super(accessor.consumer.consumerKey, accessor.consumer.consumerSecret);
        this.accessor = accessor;
    }

    public OAuthAccessor getAccessor() {
        return accessor;
    }

}

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

package net.oauth.client.httpclient4;

import net.oauth.OAuthAccessor;
import org.apache.http.auth.UsernamePasswordCredentials;

/**
 * An OAuthAccessor, to be used as credentials for an AuthScheme based on OAuth.
 * The OAuthAccessor is contained by reference, so you can change it to contain
 * the OAuth tokens and secrets that you receive from a service provider.
 *
 * @author John Kristian
 */
public class OAuthCredentials extends UsernamePasswordCredentials {

    private final OAuthAccessor accessor;

    public OAuthCredentials(OAuthAccessor accessor) {
        super(accessor.consumer.consumerKey, accessor.consumer.consumerSecret);
        this.accessor = accessor;
    }

    public OAuthAccessor getAccessor() {
        return accessor;
    }

    /** Get the current consumer secret, to be used as a password. */
    @Override
    public String getPassword() {
        return getAccessor().consumer.consumerSecret;
    }

    /** Get the current consumer key, to be used as a password. */
    @Override
    public String getUserName() {
        return getAccessor().consumer.consumerKey;
    }

}

Enable changing the userName or password.

git-svn-id: ee4ab06e2b80aa0503c7056b29ac4b88b48aacce@933 f7ae4463-c52f-0410-a7dc-93bad6e629e8


package com.wrapp.android.webimageexample;

public class WebImageContainerView {
}

package com.wrapp.android.webimageexample;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import com.wrapp.android.webimage.WebImageView;

import java.net.MalformedURLException;
import java.net.URL;

@SuppressWarnings({"UnusedDeclaration"})
public class WebImageContainerView extends LinearLayout {
  private WebImageView webImageView;

  public WebImageContainerView(Context context) {
    super(context);
    initialize(context);
  }

  public WebImageContainerView(Context context, AttributeSet attrs) {
    super(context, attrs);
    initialize(context);
  }

  private void initialize(Context context) {
    LayoutInflater layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    layoutInflater.inflate(R.layout.web_image_container_view, this, true);
    webImageView = (WebImageView)findViewById(R.id.WebImageView);
  }

  public void setImageUrl(String imageUrlString) {
    try {
      URL imageUrl = new URL(imageUrlString);
      webImageView.setImageResource(R.drawable.person_placeholder);
      webImageView.setImageUrl(imageUrl, true);
    }
    catch(MalformedURLException e) {
      e.printStackTrace();
    }
  }
}

Implement web image container class

Implement web image container class


package de.marza.firstspirit.modules.logging.console.utilities;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.SystemErrRule;

import javax.swing.JEditorPane;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

public class ReadTextFromFileTest {

  public static final String EOL = System.lineSeparator();
  @Rule
  public SystemErrRule rule = new SystemErrRule();

  private ReadTextFromFile testling;

  @Before
  public void setUp() throws Exception {
    testling = new ReadTextFromFile("/test.txt");
  }

  @Test
  public void readAsJEditor() throws Exception {
    final JEditorPane editorPane = testling.readAsJEditor();

    final String expectedText = "<html>\n  " +
        "<head>\n    \n  </head>\n  " +
        "<body>\n    This is a test!\n  </body>\n" +
        "</html>\n";
    assertThat(editorPane.getText(), is(expectedText));
  }

  @Test(expected = IllegalArgumentException.class)
  public void testNullArgumentConstructor() throws Exception {
    new ReadTextFromFile(null);
  }

  @Test
  @Ignore
  public void testFileNotFound() throws Exception {

    rule.enableLog();

    testling = new ReadTextFromFile("/test.text");

    testling.readAsJEditor();

    assertThat("An error occurred while reading the about text: java.lang.NullPointerException" + EOL,
        is(rule.getLog()));
  }
}

package de.marza.firstspirit.modules.logging.console.utilities;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.SystemErrRule;

import javax.swing.JEditorPane;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

public class ReadTextFromFileTest {

  public static final String EOL = System.lineSeparator();
  @Rule
  public SystemErrRule rule = new SystemErrRule();

  private ReadTextFromFile testling;

  @Before
  public void setUp() throws Exception {
    testling = new ReadTextFromFile("/test.txt");
  }

  @Test
  public void readAsJEditor() throws Exception {
    final JEditorPane editorPane = testling.readAsJEditor();

    final String expectedText = "<html>\n  " +
        "<head>\n    \n  </head>\n  " +
        "<body>\n    This is a test!\n  </body>\n" +
        "</html>\n";
    assertThat(editorPane.getText(), is(expectedText));
  }

  @Test(expected = IllegalArgumentException.class)
  public void testNullArgumentConstructor() throws Exception {
    new ReadTextFromFile(null);
  }

  @Test
  @Ignore
  public void testFileNotFound() throws Exception {

    rule.enableLog();

    testling = new ReadTextFromFile("/test.text");

    testling.readAsJEditor();

    assertThat("An error occurred while reading the about text: java.lang.NullPointerException" + EOL,
        is(rule.getLog()));
  }
}

Fix compilation error & ignore test since it fails sometimes in parallel test execution


package com.codahale.metrics;

import org.junit.Test;

import java.lang.management.ManagementFactory;

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

public class CpuTimeClockTest {

    @Test
    public void cpuTimeClock() throws Exception {
        final CpuTimeClock clock = new CpuTimeClock();

        assertThat((double) clock.getTime())
                .isEqualTo(System.currentTimeMillis(),
                        offset(100.0));

        assertThat((double) clock.getTick())
                .isEqualTo(ManagementFactory.getThreadMXBean().getCurrentThreadCpuTime(),
                        offset(1000000.0));
    }
}

package com.codahale.metrics;

import org.junit.Test;

import java.lang.management.ManagementFactory;

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

public class CpuTimeClockTest {

    @Test
    public void cpuTimeClock() throws Exception {
        final CpuTimeClock clock = new CpuTimeClock();

        assertThat((double) clock.getTime())
                .isEqualTo(System.currentTimeMillis(),
                        offset(200.0));

        assertThat((double) clock.getTick())
                .isEqualTo(ManagementFactory.getThreadMXBean().getCurrentThreadCpuTime(),
                        offset(1000000.0));
    }
}

Increase the margin of error for the clock time test


package ch.elexis.core.services.holder;

import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

import ch.elexis.core.services.ILocalLockService;

@Component
public class LocalLockServiceHolder {

	private static ILocalLockService localLockService;

	@Reference
	public void setLocalLockService(ILocalLockService localLockService){
		LocalLockServiceHolder.localLockService = localLockService;
	}

	public static ILocalLockService get(){
		return localLockService;
	}
}

package ch.elexis.core.services.holder;

import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

import ch.elexis.core.services.ILocalLockService;

@Component
public class LocalLockServiceHolder {

	private static ILocalLockService localLockService;

	@Reference
	public void setLocalLockService(ILocalLockService localLockService){
		LocalLockServiceHolder.localLockService = localLockService;
	}

	public static ILocalLockService get(){
		if (localLockService == null) {
			throw new IllegalStateException("No ILocalLockService available");
		}
		return localLockService;
	}
}

[15204] Throw IllegalStateException for non available ILocalLockService


package andraus.bluetoothhidemu.spoof;

import android.bluetooth.BluetoothAdapter;
import android.content.Context;

public final class BluetoothAdapterSpooferFactory {

    private static BluetoothAdapterSpoofer mInstance = null;

    /**
     *
     * @param appContext
     * @param adapter
     * @return
     */
    public static BluetoothAdapterSpoofer getInstance(Context appContext, BluetoothAdapter adapter) {
        if (mInstance == null) {
            //mInstance = new BluetoothAdapterSpooferMotoReflect(adapter);
            mInstance = new BluetoothAdapterSpooferGeneric(appContext, adapter);
        }

        return mInstance;
    }

}

package andraus.bluetoothhidemu.spoof;

import android.bluetooth.BluetoothAdapter;
import android.content.Context;

public final class BluetoothAdapterSpooferFactory {

    private static BluetoothAdapterSpoofer mInstance = null;

    /**
     *
     * @param appContext
     * @param adapter
     * @return
     */
    public static BluetoothAdapterSpoofer getInstance(Context appContext, BluetoothAdapter adapter) {
        if (mInstance == null) {
            mInstance = new BluetoothAdapterSpooferMotoReflect(adapter);
            //mInstance = new BluetoothAdapterSpooferGeneric(appContext, adapter);
        }

        return mInstance;
    }

}

Switch to frameworks spoofing implementation


package com.animedetour.android.framework.dependencyinjection.module;

import com.facebook.stetho.okhttp.StethoInterceptor;
import com.squareup.okhttp.OkHttpClient;
import dagger.Module;
import dagger.Provides;

import javax.inject.Singleton;

@Module(library = true, complete = false)
public class NetworkModule
{
    @Provides @Singleton OkHttpClient provideOkHttp()
    {
        OkHttpClient client = new OkHttpClient();
        client.networkInterceptors().add(new StethoInterceptor());

        return client;
    }
}

package com.animedetour.android.framework.dependencyinjection.module;

import android.app.Application;
import com.facebook.stetho.okhttp.StethoInterceptor;
import com.squareup.okhttp.Cache;
import com.squareup.okhttp.OkHttpClient;
import dagger.Module;
import dagger.Provides;

import javax.inject.Singleton;
import java.io.File;
import java.io.IOException;

@Module(library = true, complete = false)
public class NetworkModule
{
    @Provides @Singleton OkHttpClient provideOkHttp(
        Application application
    ) {
        try {
            OkHttpClient client = new OkHttpClient();
            File cacheDir = new File(application.getCacheDir(), "http");
            long cacheSize = 80 * 1024 * 1024; // 80MB
            Cache cache =  new Cache(cacheDir, cacheSize);
            client.setCache(cache);
            client.networkInterceptors().add(new StethoInterceptor());

            return client;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Add 80MB cache to OkHttpClient.

Add 80MB cache to OkHttpClient.

OkHttp did not come with a default cache, so this adds one in.


package org.apache.cordova.appsettings;

import java.util.Locale;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class AppSettings extends CordovaPlugin {

    @Override
    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    	JSONObject options = new JSONObject();
        if (action.equals("get")) {
        	try{
                for(int i=0;i<args.length();i++){
        	        String key=args.getString(i);
                    String keyvalue = cordova.getActivity().getIntent().getStringExtra(key.toLowerCase(Locale.getDefault()));
                    if (keyvalue != null) {
                        options.put(key, keyvalue);
                    }
                }
                callbackContext.success(options);
        	} catch (Exception ex) {
            	callbackContext.error(0);
            }
            return true;
        }
        return false;
    }
}

package org.apache.cordova.appsettings;

import java.util.Locale;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaPreferences;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class AppSettings extends CordovaPlugin {

    @Override
    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    	JSONObject options = new JSONObject();
        if (action.equals("get")) {
        	try{
                CordovaPreferences preferences = webView.getPreferences();
                for(int i=0;i<args.length();i++){
        	        String key=args.getString(i);
                    String keyvalue = preferences.getString(key, null);
                    if (keyvalue != null) {
                        options.put(key, keyvalue);
                    }
                }
                callbackContext.success(options);
        	} catch (Exception ex) {
            	callbackContext.error(0);
            }
            return true;
        }
        return false;
    }
}

Fix for Cordova Android 4.x to use CordovaPreferences.


package uk.co.ticklethepanda.carto.apps.web.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import uk.co.ticklethepanda.carto.core.projection.Projector;

@Configuration
public class ProjectionConfig {

    @Bean(name = "projector")
    public Projector projector(
            @Value("${location.history.heatmap.projector}") String projectorName
    ) throws ClassNotFoundException, IllegalAccessException, InstantiationException {

        Class<?> projectorClass = Class.forName(projectorName);

        Object projector = projectorClass.newInstance();

        if (!(projector instanceof Projector)) {
            throw new IllegalArgumentException("\"location.history.heatmap.projector\" must be a type of Projector");
        }

        return (Projector) projector;

    }
}

package uk.co.ticklethepanda.carto.apps.web.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import uk.co.ticklethepanda.carto.core.projection.Projector;

import java.lang.reflect.InvocationTargetException;

@Configuration
public class ProjectionConfig {

    @Bean(name = "projector")
    public Projector projector(
            @Value("${location.history.heatmap.projector}") String projectorName
    ) throws ClassNotFoundException,
            IllegalAccessException,
            InstantiationException,
            NoSuchMethodException,
            InvocationTargetException {

        Class<?> projectorClass = Class.forName(projectorName);

        Object projector = projectorClass.getDeclaredConstructor().newInstance();

        if (!(projector instanceof Projector)) {
            throw new IllegalArgumentException("\"location.history.heatmap.projector\" must be a type of Projector");
        }

        return (Projector) projector;

    }
}

Use non-deprecated new instance method

Use non-deprecated new instance method


package de.haw.vs.nameservice.connectionhandler;

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

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

public class Server implements IServer {

    private ServerSocket serverSocket;
    private volatile boolean stopping;
    private final Logger log = LoggerFactory.getLogger(Server.class);
    private final int maxConcurrentConnections = 30;
    private final Executor threadPool = Executors.newFixedThreadPool(maxConcurrentConnections);

    @Override
    public void initServer(int port) {
        try {
            serverSocket = new ServerSocket(port);
            this.stopping = false;
        } catch (IOException e) {
            this.stopping = true;
            log.error("Could not start server at port: " + String.valueOf(port), e);
        }
    }

    @Override
    public void run() {
        log.info("Started server");
        while (!stopping) {
            try {
                Socket clientSocket = serverSocket.accept();
                IClientRequestHandler clientRequest = new ClientRequestHandler(clientSocket);
                threadPool.execute(clientRequest);
            } catch (IOException e) {
                log.warn("Error while client tried to connect", e);
            }
        }
        try {
            serverSocket.close();
        } catch (IOException e) {
            log.warn("Could not close server socket");
        }
        log.info("Stopped server");
    }

    public boolean isStopping() {
        return stopping;
    }

    public void stop() {
        this.stopping = true;
    }
}

package de.haw.vs.nameservice.connectionhandler;

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

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Server implements IServer {

    private ServerSocket serverSocket;
    private volatile boolean stopping;
    private final Logger log = LoggerFactory.getLogger(Server.class);
    private final int maxConcurrentConnections = 30;
    private final ExecutorService threadPool = Executors.newFixedThreadPool(maxConcurrentConnections);

    @Override
    public void initServer(int port) {
        try {
            serverSocket = new ServerSocket(port);
            this.stopping = false;
        } catch (IOException e) {
            this.stopping = true;
            log.error("Could not start server at port: " + String.valueOf(port), e);
        }
    }

    @Override
    public void run() {
        log.info("Started server");
        while (!stopping) {
            try {
                Socket clientSocket = serverSocket.accept();
                IClientRequestHandler clientRequest = new ClientRequestHandler(clientSocket);
                threadPool.submit(clientRequest);
            } catch (IOException e) {
                log.warn("Error while client tried to connect", e);
            }
        }
        try {
            serverSocket.close();
        } catch (IOException e) {
            log.warn("Could not close server socket");
        }
        log.info("Stopped server");
    }

    public boolean isStopping() {
        return stopping;
    }

    public void stop() {
        this.stopping = true;
    }
}

Use ExecutorService instead of Executor

Use ExecutorService instead of Executor


package io.joss.graphql.jersey.resource;

import java.util.List;

import io.joss.graphql.jersey.auth.RegistryAuthValue;
import lombok.ToString;

@ToString
public class UnverifiedCredentials
{

  private List<RegistryAuthValue> values;

  public UnverifiedCredentials(List<RegistryAuthValue> values)
  {
    this.values = values;
  }

}

package io.joss.graphql.jersey.resource;

import java.util.List;

import io.joss.graphql.jersey.auth.RegistryAuthValue;
import lombok.ToString;

@ToString
public class UnverifiedCredentials
{

  private List<RegistryAuthValue> values;

  public UnverifiedCredentials(List<RegistryAuthValue> values)
  {
    this.values = values;
  }

  public List<RegistryAuthValue> values()
  {
    return values;
  }

}

Add getter for unverified credentials

Add getter for unverified credentials


package edu.northwestern.bioinformatics.studycalendar.web.template;

import edu.northwestern.bioinformatics.studycalendar.web.ReturnSingleObjectController;
import edu.northwestern.bioinformatics.studycalendar.domain.Arm;
import edu.northwestern.bioinformatics.studycalendar.utils.accesscontrol.AccessControl;
import edu.northwestern.bioinformatics.studycalendar.utils.accesscontrol.StudyCalendarProtectionGroup;

/**
 * @author Rhett Sutphin
 */
@AccessControl(protectionGroups = StudyCalendarProtectionGroup.STUDY_COORDINATOR)
public class SelectArmController extends ReturnSingleObjectController<Arm> {
    public SelectArmController() {
        setParameterName("arm");
        setViewName("template/ajax/selectArm");
    }

    @Override
    protected Object wrapObject(Arm loaded) {
        return new ArmTemplate(loaded);
    }
}

package edu.northwestern.bioinformatics.studycalendar.web.template;

import edu.northwestern.bioinformatics.studycalendar.web.ReturnSingleObjectController;
import edu.northwestern.bioinformatics.studycalendar.domain.Arm;
import edu.northwestern.bioinformatics.studycalendar.utils.accesscontrol.AccessControl;
import edu.northwestern.bioinformatics.studycalendar.utils.accesscontrol.StudyCalendarProtectionGroup;

/**
 * @author Rhett Sutphin
 */
@AccessControl(protectionGroups = StudyCalendarProtectionGroup.BASE)
public class SelectArmController extends ReturnSingleObjectController<Arm> {
    public SelectArmController() {
        setParameterName("arm");
        setViewName("template/ajax/selectArm");
    }

    @Override
    protected Object wrapObject(Arm loaded) {
        return new ArmTemplate(loaded);
    }
}

Use base because everyone can use the template view

git-svn-id: 4b387fe5ada7764508e2ca96c335714e4c1692c6@750 0d517254-b314-0410-acde-c619094fa49f


package fr.paris10.projet.assogenda.assogenda.util;

/**
 * Created by valentin on 22/01/17.
 */

public class Period {
    private int begin;
    private int end;

    public Period(int begin, int end) throws PeriodException{
        if(begin > end || begin == end)
            throw new PeriodException("Begin must be lower or different than end");
        if(begin < 0 || begin > 24 || end < 0 || begin > 24 || begin > end)
            throw new PeriodException("A period can't exceed 24hours or have negative values");
        this.begin = begin;
        this.end = end;
    }
}

package fr.paris10.projet.assogenda.assogenda.util;

/**
 * Created by valentin on 22/01/17.
 */

public class Period {
    private int begin;
    private int end;

    public Period(int begin, int end) throws PeriodException {
        if (begin > end || begin == end)
            throw new PeriodException("Begin must be inferior to the end of the period");
        if (begin < 0 || begin > 24)
            throw new PeriodException("Begin of period can't be negative of exceed 24 hours");
        if (end < 0 || end > 24)
            throw new PeriodException("End of a period can't be negative or exceed 24 hours");
        this.begin = begin;
        this.end = end;
    }
}

Fix constructor to identify wrong period


package info.izumin.android.bletia;

import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;

import org.jdeferred.Promise;

import info.izumin.android.bletia.action.Action;
import info.izumin.android.bletia.wrapper.BluetoothGattWrapper;

/**
 * Created by izumin on 9/14/15.
 */
public class BleMessageThread extends Handler {

    private static final int DELAY_MILLIS = 10;

    private final HandlerThread mHandlerThread;
    private final BluetoothGattWrapper mGattWrapper;
    private final BleActionStore mActionStore;

    public BleMessageThread(HandlerThread handlerThread, BluetoothGattWrapper gattWrapper, BleActionStore actionStore) {
        super(handlerThread.getLooper());
        mHandlerThread = handlerThread;
        mGattWrapper = gattWrapper;
        mActionStore = actionStore;
    }

    public void stop() {
        mHandlerThread.quitSafely();
    }

    public <T> Promise<T, BletiaException, Object> execute(Action<T> action) {
        mActionStore.enqueue(action);
        dispatchMessage(action.obtainMessage());

        return action.getDeferred().promise();
    }

    @Override
    public void handleMessage(Message msg) {
        Action.Type type = Action.Type.valueOf(msg.what);

        if (mActionStore.isRunning(type)) {
            sendMessageDelayed(msg, DELAY_MILLIS);
        } else {
            mActionStore.execute(type, mGattWrapper);
        }
    }
}

package info.izumin.android.bletia;

import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;

import org.jdeferred.Promise;

import info.izumin.android.bletia.action.Action;
import info.izumin.android.bletia.wrapper.BluetoothGattWrapper;

/**
 * Created by izumin on 9/14/15.
 */
public class BleMessageThread extends Handler {

    private static final int DELAY_MILLIS = 10;

    private final HandlerThread mHandlerThread;
    private final BluetoothGattWrapper mGattWrapper;
    private final BleActionStore mActionStore;

    public BleMessageThread(HandlerThread handlerThread, BluetoothGattWrapper gattWrapper, BleActionStore actionStore) {
        super(handlerThread.getLooper());
        mHandlerThread = handlerThread;
        mGattWrapper = gattWrapper;
        mActionStore = actionStore;
    }

    public void stop() {
        mHandlerThread.quitSafely();
    }

    public <T> Promise<T, BletiaException, Object> execute(Action<T> action) {
        mActionStore.enqueue(action);
        dispatchMessage(action.obtainMessage());

        return action.getDeferred().promise();
    }

    @Override
    public void handleMessage(Message msg) {
        Action.Type type = Action.Type.valueOf(msg.what);

        if (mActionStore.isRunning(type)) {
            Message delayed = obtainMessage();
            delayed.copyFrom(msg);
            sendMessageDelayed(delayed, DELAY_MILLIS);
        } else {
            mActionStore.execute(type, mGattWrapper);
        }
    }
}

Fix send message delayed when the message has conflict


package com.infonuascape.osrshelper.tracker.cml;

import com.android.volley.Request;
import com.infonuascape.osrshelper.utils.exceptions.PlayerNotFoundException;
import com.infonuascape.osrshelper.utils.http.NetworkStack;

import java.io.IOException;
import java.net.URLEncoder;

/**
 * This class contains a single method that updates a user on RuneTracker. This
 * is defined as calling an HTTP endpoint which adds a point of data in the
 * user's stats history table.
 *
 * @author Cynthia of irc.rscript.org
 */
public class Updater {
	/**
	 * Updates the given user on RuneTracker.
	 *
	 * @param user
	 *            Name of the user to update. Since 2009-10-01, this is the
	 *            display name of the user, not his or her login name.
	 * @throws IOException
	 *             if the HTTP endpoint connection needed to update the
	 *             user throws <tt>IOException</tt>
	 * @throws PlayerNotFoundException
	 */
	public static void perform(final String user) throws IOException, PlayerNotFoundException {
		android.util.Log.i("Updater", "Hey! I'm updating!");
		String connectionString = "http://runetracker.org/updateUser.php?user=" + URLEncoder.encode(user, "utf-8");
		NetworkStack.getInstance().performRequest(connectionString, Request.Method.GET);
	}
}

package com.infonuascape.osrshelper.tracker.cml;

import com.android.volley.Request;
import com.infonuascape.osrshelper.utils.exceptions.PlayerNotFoundException;
import com.infonuascape.osrshelper.utils.http.NetworkStack;

import java.io.IOException;
import java.net.URLEncoder;

public class Updater {

	public static void perform(final String user) throws IOException, PlayerNotFoundException {
		android.util.Log.i("Updater", "Hey! I'm updating!");
		String connectionString = "https://crystalmathlabs.com/tracker/api.php?type=update&player=" + URLEncoder.encode(user, "utf-8");
		NetworkStack.getInstance().performRequest(connectionString, Request.Method.GET);
	}
}

Fix CML Update to proper API endpoint

Fix CML Update to proper API endpoint


package com.servinglynk.hmis.warehouse.core.model;

import java.util.ArrayList;
import java.util.List;
import com.servinglynk.hmis.warehouse.PaginatedModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;

@JsonRootName("rhybcpStatuses")
public class Rhybcpstatuses extends PaginatedModel{

       @JsonProperty("rhybcpstatuses")
       List<Rhybcpstatus>rhybcpstatuses = new ArrayList<Rhybcpstatus>();
       public List<Rhybcpstatus> getRhybcpstatuses() {
           return rhybcpstatuses;
       }

        public void setRhybcpstatuses(List<Rhybcpstatus> rhybcpstatuses) {
           this.rhybcpstatuses = rhybcpstatuses;
       }

       public void addRhybcpstatus(Rhybcpstatus rhybcpstatus) {
           this.rhybcpstatuses.add(rhybcpstatus);
       }
 }

package com.servinglynk.hmis.warehouse.core.model;

import java.util.ArrayList;
import java.util.List;
import com.servinglynk.hmis.warehouse.PaginatedModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;

@JsonRootName("rhybcpStatuses")
public class Rhybcpstatuses extends PaginatedModel{

       @JsonProperty("rhybcpStatuses")
       List<Rhybcpstatus>rhybcpstatuses = new ArrayList<Rhybcpstatus>();
       public List<Rhybcpstatus> getRhybcpstatuses() {
           return rhybcpstatuses;
       }

        public void setRhybcpstatuses(List<Rhybcpstatus> rhybcpstatuses) {
           this.rhybcpstatuses = rhybcpstatuses;
       }

       public void addRhybcpstatus(Rhybcpstatus rhybcpstatus) {
           this.rhybcpstatuses.add(rhybcpstatus);
       }
 }

Fix rhybcpStatuses in the get response

Fix rhybcpStatuses in the get response


/*
 * Copyright 2015-2016 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.hod.client.api.authentication.tokeninformation;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.hp.autonomy.hod.client.api.userstore.user.Account;
import lombok.Data;

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

/**
 * Information about the user component of an authentication token.
 */
@Data
public class UserInformation implements Serializable {
    private static final long serialVersionUID = -2610523494602694306L;

    /**
     * @return The UUID of the user
     */
    private final UUID uuid;

    /**
     * @return Information about the mechanism used to authenticate the user
     */
    private final AuthenticationInformation authentication;

    /**
     * @return Groups directly associated with the user
     */
    private final List<String> directGroups;

    /**
     * @return Groups either directly or transitively associated with the user
     */
    private final List<String> groups;

    /**
     * @return Accounts associated with the user
     */
    private final List<Account> accounts;

    public UserInformation(
        @JsonProperty("uuid") final UUID uuid,
        @JsonProperty("auth") final AuthenticationInformation authentication,
        @JsonProperty("direct_groups") final List<String> directGroups,
        @JsonProperty("groups") final List<String> groups,
        @JsonProperty("accounts") final List<Account> accounts
    ) {
        this.uuid = uuid;
        this.authentication = authentication;
        this.directGroups = directGroups;
        this.groups = groups;
        this.accounts = accounts;
    }
}

/*
 * Copyright 2015-2016 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.hod.client.api.authentication.tokeninformation;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.hp.autonomy.hod.client.api.userstore.user.Account;
import lombok.Data;

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

/**
 * Information about the user component of an authentication token.
 */
@Data
public class UserInformation implements Serializable {
    private static final long serialVersionUID = -2610523494602694306L;

    /**
     * @return The UUID of the user
     */
    private final UUID uuid;

    /**
     * @return Information about the mechanism used to authenticate the user
     */
    private final AuthenticationInformation authentication;

    /**
     * @return Accounts associated with the user
     */
    private final List<Account> accounts;

    public UserInformation(
        @JsonProperty("uuid") final UUID uuid,
        @JsonProperty("auth") final AuthenticationInformation authentication,
        @JsonProperty("accounts") final List<Account> accounts
    ) {
        this.uuid = uuid;
        this.authentication = authentication;
        this.accounts = accounts;
    }
}

Fix user information parsing that had a different response format than expected - for now remove group info


package com.proxerme.library.util;

import android.support.test.InstrumentationRegistry;

import com.proxerme.library.connection.ProxerConnection;

import org.junit.AfterClass;
import org.junit.BeforeClass;

import java.io.IOException;

import okhttp3.mockwebserver.MockWebServer;

/**
 * Base class for all {@link com.proxerme.library.connection.ProxerRequest} subclass tests.
 *
 * @author Ruben Gees
 */
public class RequestTest {

    protected static MockWebServer server = new MockWebServer();
    protected static ProxerConnection connection = new ProxerConnection.Builder("test",
            InstrumentationRegistry.getContext()).build();

    protected RequestTest() {

    }

    @BeforeClass
    public static void setUpServer() throws IOException {
        server.start();
    }

    @AfterClass
    public static void tearDownServer() throws IOException {
        server.shutdown();
    }
}

package com.proxerme.library.util;

import android.support.test.InstrumentationRegistry;

import com.proxerme.library.connection.ProxerConnection;

import org.junit.After;
import org.junit.Before;

import java.io.IOException;

import okhttp3.mockwebserver.MockWebServer;

/**
 * Base class for all {@link com.proxerme.library.connection.ProxerRequest} subclass tests.
 *
 * @author Ruben Gees
 */
public class RequestTest {

    protected MockWebServer server;
    protected ProxerConnection connection;

    protected RequestTest() {

    }

    @Before
    public void setUp() throws IOException {
        server = new MockWebServer();
        connection = new ProxerConnection.Builder("test",
                InstrumentationRegistry.getContext()).build();

        server.start();
    }

    @After
    public void tearDown() throws IOException {
        server.shutdown();
    }
}

Fix tests by constructing a new server and connection in setup


// Copyright (C) 2009 The Android Open Source Project
//
// 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.googlesource.gerrit.plugins.replication;

import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.account.GroupMembership;

public class RemoteSiteUser extends CurrentUser {
  private final GroupMembership effectiveGroups;

  public RemoteSiteUser(GroupMembership authGroups) {
    effectiveGroups = authGroups;
  }

  @Override
  public GroupMembership getEffectiveGroups() {
    return effectiveGroups;
  }
}

// Copyright (C) 2009 The Android Open Source Project
//
// 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.googlesource.gerrit.plugins.replication;

import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.account.GroupMembership;

public class RemoteSiteUser extends CurrentUser {
  private final GroupMembership effectiveGroups;

  public RemoteSiteUser(GroupMembership authGroups) {
    effectiveGroups = authGroups;
  }

  @Override
  public GroupMembership getEffectiveGroups() {
    return effectiveGroups;
  }

  @Override
  public Object getCacheKey() {
    // Never cache a remote user
    return new Object();
  }
}

Revert "Adjust to changes in Gerrit core"

Revert submission 283559-currentuser-remove-cache-key

Reason for revert: Causes a latency regression for some hosts
Reverted Changes:
I76bfd3ebc:Adjust to changes in Gerrit core
If7ccfd9a4:Remove unused CurrentUser#cacheKey method
I1378ad083:Remove PerThreadCache

Change-Id: I84965f655d62c258c226ad5d585cee24dea047cc
(cherry picked from commit a6a6ec5982e41a0ee9bfe24a46be96d4f13fcaaa)


package net.openhft.chronicle.core.time;

public class BackgroundTimeProviderMain {
    public static void main(String[] args) throws InterruptedException {
        int under = 0, over = 0;
        for (int i = 0; i < 6_000; i++) {
            BackgroundTimeProvider tp = BackgroundTimeProvider.INSTANCE;
            long nowMS;
            long nowNS;
            if (i % 2 == 0) {
                nowMS = System.currentTimeMillis();
                nowNS = tp.currentTimeNanos();
            } else {
                nowNS = tp.currentTimeNanos();
                nowMS = System.currentTimeMillis();
            }
            long diff = nowNS - nowMS * 1000000;
            if (diff < 0) {
                under += 1 + (diff / -1e4);
            }
            if (diff > 1e6) {
                over += 1 + (diff - 1e6) / 1e4;
            }
            Thread.sleep(1);
        }
        System.out.println("under: " + under + ", over: " + over);
    }

}

package net.openhft.chronicle.core.time;

public class BackgroundTimeProviderMain {
    public static void main(String[] args) throws InterruptedException {
        int under = 0, over = 0;
        for (int i = 0; i < 6_000; i++) {
            BackgroundTimeProvider tp = BackgroundTimeProvider.INSTANCE;
            long nowMS;
            long nowNS;
            if (i % 2 == 0) {
                nowMS = System.currentTimeMillis();
                nowNS = tp.currentTimeNanos();
            } else {
                nowNS = tp.currentTimeNanos();
                nowMS = System.currentTimeMillis();
            }
            long diff = nowNS - nowMS * 1000000;
            if (diff < -1e5 || diff > 11e5)
                System.out.println("diff: " + diff);
            if (diff < 0) {
                under += 1 + (diff / -1e4);
            }
            if (diff > 1e6) {
                over += 1 + (diff - 1e6) / 1e4;
            }
            Thread.sleep(1);
        }
        System.out.println("under: " + under + ", over: " + over);
    }

}

Add warning if a MethodReader tries to read for an overloaded interface.


/**
 *
 * Defines a set of themes for the maps
 * in the arena.

 *
 *
 *

 * The themes are:
 *

 *
 Continental
 *
 Artical
 *
 Desertic
 *
 Tropical
 *

 *
 * @see Weather
 */
package random;

/**
 *
 * Defines a set of themes for the maps
 * in the arena.

 *
 *
 *

 * The themes are:
 *

 *
 Continental
 *
 Artical
 *
 Desertic
 *
 Tropical
 *

 */
package random;

Fix in link at @see

Fix in link at @see


package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.Period;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Rhett Sutphin
 */
@Transactional(readOnly = true)
public class PeriodDao extends StudyCalendarMutableDomainObjectDao<Period> {
    @Override
    public Class<Period> domainClass() {
        return Period.class;
    }

    public void evict(Period period) {
        getHibernateTemplate().evict(period);
    }

    public void delete(Period period) {
        getHibernateTemplate().delete(period);
    }
}

package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.Period;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Rhett Sutphin
 */
@Transactional(readOnly = true)
public class PeriodDao extends StudyCalendarMutableDomainObjectDao<Period> {
    @Override
    public Class<Period> domainClass() {
        return Period.class;
    }

    /**
    * To manage caching of a period, this method will remove the period specified from hibernate's first level cache
    *
    * @param  period the period to remove from the cache
    */
    public void evict(Period period) {
        getHibernateTemplate().evict(period);
    }

    /**
    * Deletes a period
    *
    * @param  period the period to delete
    */
    public void delete(Period period) {
        getHibernateTemplate().delete(period);
    }
}

Add javadoc to period dao.

Add javadoc to period dao.


package de.gesellix.gradle.docker.testutil;

import de.gesellix.docker.client.DockerClient;

import java.util.Objects;

public class TestImage {

  private final DockerClient dockerClient;
  private final String repository;
  private final String tag;
  private final boolean isWindows;

  public TestImage(DockerClient dockerClient) {
    this.dockerClient = dockerClient;

    this.isWindows = Objects.requireNonNull(dockerClient.version().getContent().getOs()).equalsIgnoreCase("windows");
    this.repository = "gesellix/echo-server";
    this.tag = isWindows ? "os-windows" : "os-linux";

    // TODO consider NOT calling prepare inside the constructor
    prepare();
  }

  public void prepare() {
    dockerClient.pull(null, null, getImageName(), getImageTag());
  }

  public boolean isWindows() {
    return isWindows;
  }

  public String getImageWithTag() {
    return getImageName() + ":" + getImageTag();
  }

  public String getImageName() {
    return repository;
  }

  public String getImageTag() {
    return tag;
  }
}

package de.gesellix.gradle.docker.testutil;

import de.gesellix.docker.client.DockerClient;

import java.util.Objects;

public class TestImage {

  private final DockerClient dockerClient;
  private final String repository;
  private final String tag;
  private final boolean isWindows;

  public TestImage(DockerClient dockerClient) {
    this.dockerClient = dockerClient;

    this.isWindows = Objects.requireNonNull(dockerClient.version().getContent().getOs()).equalsIgnoreCase("windows");
    this.repository = "gesellix/echo-server";
    this.tag = "2022-04-08T22-27-00";

    // TODO consider NOT calling prepare inside the constructor
    prepare();
  }

  public void prepare() {
    dockerClient.pull(null, null, getImageName(), getImageTag());
  }

  public boolean isWindows() {
    return isWindows;
  }

  public String getImageWithTag() {
    return getImageName() + ":" + getImageTag();
  }

  public String getImageName() {
    return repository;
  }

  public String getImageTag() {
    return tag;
  }
}

Use the multi-platform gesellix/echo-server image


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

/**
 * Internet Protocol (IP) families
 */
public enum InternetProtocolFamily {
    IPv4,
    IPv6;
}

Add a missing newline at the end of the file