package ${packageName};

import static org.junit.Assert.*;

public class ${testClassName} {

    private final ${productionClassName} production = new ${productionClassName}("value");

    @org.junit.Test
    public void testOne() {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testOne - " + i);
            System.err.println("Some test error  from ${testClassName}.testOne - " + i);
        }
        assertEquals(production.getProperty(), "value");
    }

    @org.junit.Test
    public void testTwo() {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testTwo - " + i);
            System.err.println("Some test error  from ${testClassName}.testTwo - " + i);
        }
        String expected = <%= binding.hasVariable("halfTestsFail") && binding.halfTestsFail ? "\"foo\"" : "\"value\"" %>;
        assertEquals(production.getProperty(), expected);
    }
}

package ${packageName};

import static org.junit.Assert.*;

public class ${testClassName} {

    private final ${productionClassName} production = new ${productionClassName}("value");

    @org.junit.Test
    public void testOne() throws Exception {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testOne - " + i);
            System.err.println("Some test error  from ${testClassName}.testOne - " + i);
            Thread.sleep(5);
        }
        assertEquals(production.getProperty(), "value");
    }

    @org.junit.Test
    public void testTwo() throws Exception {
        for (int i = 0; i < 500; i++) {
            System.out.println("Some test output from ${testClassName}.testTwo - " + i);
            System.err.println("Some test error  from ${testClassName}.testTwo - " + i);
            Thread.sleep(5);
        }
        String expected = <%= binding.hasVariable("halfTestsFail") && binding.halfTestsFail ? "\"foo\"" : "\"value\"" %>;
        assertEquals(production.getProperty(), expected);
    }
}

Introduce pause in the output so as not to overwhelm the IPC mechanism between test worker and build host.


package de.is24.util.monitoring.metrics;

import com.codahale.metrics.MetricRegistry;
import de.is24.util.monitoring.AbstractMonitorPlugin;
import java.util.concurrent.TimeUnit;

public class MetricsPlugin extends AbstractMonitorPlugin {
  private MetricRegistry metricRegistry;

  public MetricsPlugin(MetricRegistry metricRegistry) {
    this.metricRegistry = metricRegistry;
  }

  @Override
  public String getUniqueName() {
    return null;
  }

  @Override
  public void initializeCounter(String name) {
  }

  @Override
  public void incrementCounter(String name, int increment) {
    metricRegistry.counter(name).inc(increment);
  }

  @Override
  public void incrementHighRateCounter(String name, int increment) {
    incrementCounter(name, increment);
  }

  @Override
  public void addTimerMeasurement(String name, long timing) {
    metricRegistry.timer(name).update(timing, TimeUnit.MILLISECONDS);
  }

  @Override
  public void addSingleEventTimerMeasurement(String name, long timing) {
    metricRegistry.timer(name).update(timing, TimeUnit.MILLISECONDS);
  }

  @Override
  public void addHighRateTimerMeasurement(String name, long timing) {
    metricRegistry.timer(name).update(timing, TimeUnit.MILLISECONDS);
  }

  @Override
  public void initializeTimerMeasurement(String name) {
  }

  @Override
  public void afterRemovalNotification() {
  }
}

package de.is24.util.monitoring.metrics;

import com.codahale.metrics.MetricRegistry;
import de.is24.util.monitoring.AbstractMonitorPlugin;
import java.util.concurrent.TimeUnit;

public class MetricsPlugin extends AbstractMonitorPlugin {
  private MetricRegistry metricRegistry;

  public MetricsPlugin(MetricRegistry metricRegistry) {
    this.metricRegistry = metricRegistry;
  }

  @Override
  public String getUniqueName() {
    return null;
  }

  @Override
  public void initializeCounter(String name) {
  }

  @Override
  public void incrementCounter(String name, int increment) {
    metricRegistry.counter(withCountersPrefix(name)).inc(increment);
  }

  @Override
  public void incrementHighRateCounter(String name, int increment) {
    incrementCounter(name, increment);
  }

  @Override
  public void addTimerMeasurement(String name, long timing) {
    metricRegistry.timer(withTimersPrefix(name)).update(timing, TimeUnit.MILLISECONDS);
  }

  @Override
  public void addSingleEventTimerMeasurement(String name, long timing) {
    addTimerMeasurement(name, timing);
  }

  @Override
  public void addHighRateTimerMeasurement(String name, long timing) {
    addTimerMeasurement(name, timing);
  }

  @Override
  public void initializeTimerMeasurement(String name) {
  }

  @Override
  public void afterRemovalNotification() {
  }

  private String withTimersPrefix(String name) {
    return "timers." + name;
  }

  private String withCountersPrefix(String name) {
    return "counters." + name;
  }
}

Add prefixes for timers and counters to emulate StatsD behavior.


package com.rudeshko.csscomb;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.psi.PsiFile;

public class CssCombAction extends AnAction {
    public void actionPerformed(AnActionEvent e) {
        PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
        if (psiFile != null) {
            psiFile.acceptChildren(new CSSCombVisitor());
        }
    }

    @Override
    public void update(AnActionEvent e) {
        e.getPresentation().setEnabled(isCss(e));
    }

    private boolean isCss(AnActionEvent e) {
        PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
        return psiFile != null && "CSS".equals(psiFile.getLanguage().getDisplayName());
    }
}

package com.rudeshko.csscomb;

import com.intellij.lang.css.CSSLanguage;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.psi.PsiFile;

public class CssCombAction extends AnAction {
    public void actionPerformed(AnActionEvent e) {
        PsiFile psiFile = getPsiFileFromActionEvent(e);
        if (psiFile != null) {
            psiFile.acceptChildren(new CSSCombVisitor());
        }
    }

    @Override
    public void update(AnActionEvent e) {
        e.getPresentation().setEnabled(isCss(e));
    }

    private boolean isCss(AnActionEvent e) {
        PsiFile psiFile = getPsiFileFromActionEvent(e);
        return psiFile != null && psiFile.getLanguage().isKindOf(CSSLanguage.INSTANCE);

    }

    private static PsiFile getPsiFileFromActionEvent(AnActionEvent e) {
        return e.getData(LangDataKeys.PSI_FILE);
    }
}

Correct way to detect file language

Correct way to detect file language


package com.github.vlsi.mat.tests.calcite;

import org.junit.Test;

import java.sql.SQLException;

public class GetByKeyTests extends SampleHeapDumpTests {
  @Test
  public void testHashMapByKey() throws SQLException {
    returnsInOrder("select getByKey(m.this, 'GMT') v from java.util.HashMap m where getSize(m.this) = 208",
        "v",
        "Etc/GMT");
  }

  @Test
  public void testReferenceResult() throws SQLException {
    returnsInOrder("select length(getByKey(m.this, 'GMT')['value']) l from java.util.HashMap m where getSize(m.this) " +
            "= 208",
        "l",
        "7");
  }

  //@Test
  public void testConcurrentHashMap() throws SQLException {
    returnsInOrder("select getByKey(m.this, 'MST')['ID'] c from java.util.concurrent.ConcurrentHashMap m where " +
            "getByKey(m.this, 'MST') is not null",
        "c",
        "MST");
  }
}

package com.github.vlsi.mat.tests.calcite;

import org.junit.Ignore;
import org.junit.Test;

import java.sql.SQLException;

public class GetByKeyTests extends SampleHeapDumpTests {
  @Test
  public void testHashMapByKey() throws SQLException {
    returnsInOrder("select getByKey(m.this, 'GMT') v from java.util.HashMap m where getSize(m.this) = 208",
        "v",
        "Etc/GMT");
  }

  @Test
  public void testReferenceResult() throws SQLException {
    returnsInOrder("select length(getByKey(m.this, 'GMT')['value']) l from java.util.HashMap m where getSize(m.this) " +
            "= 208",
        "l",
        "7");
  }

  @Test
  @Ignore
  public void testConcurrentHashMap() throws SQLException {
    returnsInOrder("select getByKey(m.this, 'MST')['ID'] c from java.util.concurrent.ConcurrentHashMap m where " +
            "getByKey(m.this, 'MST') is not null",
        "c",
        "MST");
  }
}

Use @Ignore instead of commenting @Test

Use @Ignore instead of commenting @Test


/*
 * CODENVY CONFIDENTIAL
 * __________________
 *
 * [2013] - [2014] Codenvy, S.A.
 * All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Codenvy S.A. and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Codenvy S.A.
 * and its suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Codenvy S.A..
 */
package com.codenvy.ide.ext.datasource.shared;

import java.util.Map;

import com.codenvy.dto.shared.DTO;

@DTO
public interface DatabaseDTO extends DatabaseMetadataEntityDTO {

    DatabaseDTO withName(String name);

    DatabaseDTO withSchemas(Map<String, SchemaDTO> schemas);

    Map<String, SchemaDTO> getSchemas();

    void setSchemas(Map<String, SchemaDTO> schemas);

}

/*
 * CODENVY CONFIDENTIAL
 * __________________
 *
 * [2013] - [2014] Codenvy, S.A.
 * All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Codenvy S.A. and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Codenvy S.A.
 * and its suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Codenvy S.A..
 */
package com.codenvy.ide.ext.datasource.shared;

import java.util.Map;

import com.codenvy.dto.shared.DTO;

@DTO
public interface DatabaseDTO extends DatabaseMetadataEntityDTO {

    DatabaseDTO withName(String name);

    DatabaseDTO withSchemas(Map<String, SchemaDTO> schemas);

    DatabaseDTO withJdbcDriverName(String driverName);

    DatabaseDTO withJdbcDriverVersion(String driverVersion);

    DatabaseDTO withDatabaseProductName(String productName);

    DatabaseDTO withDatabaseProductVersion(String productVersion);

    DatabaseDTO withUserName(String userName);

    Map<String, SchemaDTO> getSchemas();

    void setSchemas(Map<String, SchemaDTO> schemas);

}

Add more information in the dataabse DTO


/*******************************************************************************
 * Copyright (c) Incoming Pty. Ltd. 2015
 ******************************************************************************/
package com.incoming.example.incomingpvntemplate;

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

/**
 * Basic settings Activity that includes the  default Push Video settings and some content targeting settings for the user.
 */
public class PVNTemplateSettings extends Activity {

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

    // Display the Push Video settings fragment as the main content.
    getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
  }

  public static class SettingsFragment extends PreferenceFragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      // Include the content targeting settings
      addPreferencesFromResource(R.xml.preferences);
      // Include the PVN SDK settings
      addPreferencesFromResource(R.xml.pvn_preferences);
    }
  }

}

/*******************************************************************************
 * Copyright (c) Incoming Pty. Ltd. 2015
 ******************************************************************************/
package com.incoming.example.incomingpvntemplate;

import android.app.Activity;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;

/**
 * Basic settings Activity that includes the  default Push Video settings and some content targeting settings for the user.
 */
public class PVNTemplateSettings extends Activity {

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

    // Display the settings fragment as the main content.
    getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();

    // Apply the default values from the preferences file. This is important if application preferences are used to control audience
    // segmentation targets.
    PreferenceManager.setDefaultValues(PVNTemplateSettings.this, R.xml.pvn_preferences, false);
    PreferenceManager.setDefaultValues(PVNTemplateSettings.this, R.xml.preferences, false);

  }

  public static class SettingsFragment extends PreferenceFragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      // Include the content targeting settings
      addPreferencesFromResource(R.xml.preferences);
      // Include the PVN SDK settings
      addPreferencesFromResource(R.xml.pvn_preferences);
    }
  }

}

Apply default preference values in xml to preference store


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

import com.google.common.collect.Maps;

import java.util.Map;

class LifeCycleMethodsMap
{
    private final Map<Class<?>, LifeCycleMethods> map = Maps.newHashMap();

    synchronized LifeCycleMethods get(Class<?> clazz)
    {
        LifeCycleMethods methods = map.get(clazz);
        if (methods == null) {
            methods = new LifeCycleMethods(clazz);
            map.put(clazz, methods);
        }
        return methods;
    }
}

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

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

class LifeCycleMethodsMap
{
    private final Map<Class<?>, LifeCycleMethods> map = new ConcurrentHashMap<>();

    public LifeCycleMethods get(Class<?> clazz)
    {
        return map.computeIfAbsent(clazz, LifeCycleMethods::new);
    }
}

Reduce contention during lifecycle tracking


package com.indeed.proctor.common.dynamic;

import com.indeed.proctor.common.model.ConsumableTestDefinition;
import com.sun.javaws.exceptions.InvalidArgumentException;

import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

public class TestNamePatternFilter implements DynamicFilter {
    private final Pattern pattern;

    /**
     * Construct the filter from regular expression string.
     * @param regex regular expression for test name pattern
     * @throws IllegalArgumentException If the regular expression's syntax is invalid.
     */
    public TestNamePatternFilter(final String regex) {
        try {
            this.pattern = Pattern.compile(regex);
        } catch (final PatternSyntaxException e) {
            throw new IllegalArgumentException("the regular expression for test name pattern has syntax error.", e);
        }
    }

    @Override
    public boolean matches(final String testName, final ConsumableTestDefinition testDefinition) {
        return pattern.matcher(testName).matches();
    }
}

package com.indeed.proctor.common.dynamic;

import com.indeed.proctor.common.model.ConsumableTestDefinition;

import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

public class TestNamePatternFilter implements DynamicFilter {
    private final Pattern pattern;

    /**
     * Construct the filter from regular expression string.
     *
     * @param regex regular expression for test name pattern
     * @throws IllegalArgumentException If the regular expression's syntax is invalid.
     */
    public TestNamePatternFilter(final String regex) {
        try {
            this.pattern = Pattern.compile(regex);
        } catch (final PatternSyntaxException e) {
            throw new IllegalArgumentException("the regular expression for test name pattern has syntax error.", e);
        }
    }

    @Override
    public boolean matches(final String testName, final ConsumableTestDefinition testDefinition) {
        return pattern.matcher(testName).matches();
    }
}

Fix compile error due to invalid import

PROC-361: Fix compile error due to invalid import


package com.grayben.riskExtractor.htmlScorer.elementScorers;

import org.jsoup.nodes.Element;
import org.jsoup.parser.Tag;

/**
 * Score the segmentation of an {@link org.jsoup.nodes.Element} based upon the {@link org.jsoup.parser.Tag} it contains.
 */
public class SegmentationElementScorer implements Scorer<Element> {

	Scorer<Tag> tagScorer;

	@Override
	public int score(Element input) {
		// TODO Auto-generated method stub
		return 0;
	}

}

package com.grayben.riskExtractor.htmlScorer.elementScorers;

import org.jsoup.nodes.Element;
import org.jsoup.parser.Tag;

/**
 * Score the segmentation of an {@link org.jsoup.nodes.Element} based upon the {@link org.jsoup.parser.Tag} it contains.
 */
public class SegmentationElementScorer implements Scorer<Element> {

	Scorer<Tag> tagScorer;

	@Override
	public int score(Element input) {
		Integer integer = null;
		return integer;
	}

}

Clean up, make scoring function utterly useless for testing fun


package net.happybrackets.extras.assignment_autograding;

import java.io.IOException;

/**
 * Created by ollie on 8/08/2016.
 */
public class TestBeadsChecker {

    public static void main(String[] args) throws IOException {

        ExampleBeadsCheckable checkable = new ExampleBeadsCheckable();
        BeadsChecker checker = new BeadsChecker(checkable, 10000, 1000, "My Results");

    }

}

package net.happybrackets.extras.assignment_autograding;

import java.io.IOException;

/**
 * Created by ollie on 8/08/2016.
 */
public class TestBeadsChecker {

    public static void main(String[] args) throws IOException {

        ExampleBeadsCheckable checkable = new ExampleBeadsCheckable();
        BeadsChecker checker = new BeadsChecker(checkable, 10000, 1000, "build/Test Results");

    }

}

Put Test Results from BeadsChecker Test into build dir.


package com.carrot.carrotshop.listener;

import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order;
import org.spongepowered.api.event.network.ClientConnectionEvent;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.action.TextActions;
import org.spongepowered.api.text.format.TextColors;

import com.carrot.carrotshop.ShopsData;

public class PlayerConnexionListener {

	@Listener(order=Order.LATE)
	public void onPlayerJoin(ClientConnectionEvent.Join event)
	{
		if (ShopsData.hasSoldSomethingOffline(event.getTargetEntity().getUniqueId()) && event.getTargetEntity().hasPermission("carrotshop.report.self")) {
			event.getTargetEntity().sendMessage(Text.of(TextColors.YELLOW, "Someone used your shop signs while you were away. Use ",
					Text.builder("/cs report")
					.color(TextColors.DARK_AQUA)
					.onClick(TextActions.runCommand("/cs report")).build(),
					TextColors.YELLOW, " for more details" ));
		}
	}
}

package com.carrot.carrotshop.listener;

import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order;
import org.spongepowered.api.event.network.ClientConnectionEvent;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.action.TextActions;
import org.spongepowered.api.text.format.TextColors;

import com.carrot.carrotshop.ShopsData;

public class PlayerConnexionListener {

	@Listener(order=Order.LATE)
	public void onPlayerJoin(ClientConnectionEvent.Join event)
	{
		if (ShopsData.hasSoldSomethingOffline(event.getTargetEntity().getUniqueId()) && event.getTargetEntity().hasPermission("carrotshop.report.self")) {
			event.getTargetEntity().sendMessage(Text.of(TextColors.YELLOW, "Someone used your shop signs while you were away. Use ",
					Text.builder("/carrotreport")
					.color(TextColors.DARK_AQUA)
					.onClick(TextActions.runCommand("/carrotreport")).build(),
					TextColors.YELLOW, " for more details" ));
		}
	}
}

Change command name in hint

Change command name in hint


package org.robovm.bindings.cocoatouch.gamekit;

import org.robovm.rt.bro.ValuedEnum;

public enum GKGameCenterViewControllerState implements ValuedEnum {
	GKGameCenterViewControllerStateDefault(0), GKGameCenterViewControllerStateLeaderboards(1), GKGameCenterViewControllerStateAchievements(
		2), GKGameCenterViewControllerStateChallenges(3);

	private final long n;

	private GKGameCenterViewControllerState (long n) {
		this.n = n;
	}

	@Override
	public long value () {
		return n;
	}

}

package org.robovm.bindings.cocoatouch.gamekit;

import org.robovm.rt.bro.ValuedEnum;

public enum GKGameCenterViewControllerState implements ValuedEnum {
	GKGameCenterViewControllerStateDefault(-1), GKGameCenterViewControllerStateLeaderboards(0), GKGameCenterViewControllerStateAchievements(
		1), GKGameCenterViewControllerStateChallenges(2);

	private final long n;

	private GKGameCenterViewControllerState (long n) {
		this.n = n;
	}

	@Override
	public long value () {
		return n;
	}

}

Fix for Game Center to open the correct views


/*
 * copyright 2016 Hewlett Packard Enterprise
 */
package com.hpe.caf.worker.document;

public final class DocumentWorkerFailure
{
    public String workerName;
    public String failureId;
    public String failureMessage;
    public String failureStack;
}

/*
 * copyright 2016 Hewlett Packard Enterprise
 */
package com.hpe.caf.worker.document;

public final class DocumentWorkerFailure
{
    public String failureId;
    public String failureMessage;
    public String failureStack;
}

Revert "CAF-1888: Updated to include workerName variable for reporting functionality"

This reverts commit 43ede1993e9bbe1bcbc161594c62b2f175ad782e.


/*
 *
 * third: That's How I Roll Dice
 *     A dice roller for roleplaying nerds.
 *         http://swords.id.au/third/
 *
 * Copyright (c) 2010, Brendan Jurd <bj@swords.id.au>
 * All rights reserved.
 *
 * third is open-source, licensed under the Simplified BSD License, a copy of
 * which can be found in the file LICENSE at the top level of the source code.
 */
package au.id.swords.third2;

class ThirdUtil
{
    /*
     * Append 'content' to the 'builder', separated with 'delimiter'.
     *
     * If this is the first item to be appended to the builder (i.e. it is
     * currently empty), do not insert the delimiter.
     */
    public static StringBuilder append(StringBuilder builder, String delimiter, Object content)
    {
        if(builder.length() > 0)
            return builder.append(delimiter).append(content);
        else
            return builder.append(content);
    }
}

/*
 *
 * third: That's How I Roll Dice
 *     A dice roller for roleplaying nerds.
 *         http://swords.id.au/third/
 *
 * Copyright (c) 2010, Brendan Jurd <bj@swords.id.au>
 * All rights reserved.
 *
 * third is open-source, licensed under the Simplified BSD License, a copy of
 * which can be found in the file LICENSE at the top level of the source code.
 */
package au.id.swords.third2;

class ThirdUtil
{
    /*
     * Append 'content' to the 'builder', separated with 'delimiter'.
     *
     * If this is the first item to be appended to the builder (i.e. it is
     * currently empty), do not insert the delimiter.
     */
    public static StringBuilder append(StringBuilder builder, String delimiter, Object content)
    {
        if(builder.length() > 0)
            return builder.append(delimiter).append(content);
        else
            return builder.append(content);
    }

    public static int[] primitiveIntArray(java.util.Collection<Integer> c)
    {
        int[] result = new int[c.size()];
        int i = 0;
        for(Integer v: c)
        {
            result[i] = v;
            i++;
        }
        return result;
    }
}

Add utility method for making primitive int arrays.

In another astounding feat of unhelpfulness, Java has no built-in way of
getting a primitive array of integers out of a Collection of Integers.
I figure this isn't the only time I'm going to need this, so I made a
method in ThirdUtil.


package teamOD.armourReborn.common.core.handler;

import java.io.File;

import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;

public final class ConfigHandler {

	public static Configuration config ;

	public static boolean generateOre = true ;
	public static boolean disableVanillaArmours = true ;

	public static void init (File configFile) {
		config = new Configuration (configFile) ;

		config.load() ;
		load() ;

		config.save() ;
	}

	public static void load () {
		String desc ;

		desc = "Set this to false to disable the world generation of this mod's added ores." + "\n" ;
		desc += "Make sure your pack has an alternative way to obtain the following ores if disabled:" + "\n" ;
		desc += "Copper Ore, Aluminum Ore" ;
		generateOre = loadPropBool ("enable.worldGen", desc, generateOre) ;

		desc = "If set to true, all vanilla armours will not provide any protection to the user" ;
		disableVanillaArmours = loadPropBool ("disable.vanillaArmour", desc, disableVanillaArmours) ;

	}

	private static boolean loadPropBool(String propName, String desc, boolean default_) {
		Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_);
		prop.setComment(desc);

		return prop.getBoolean(default_);
	}
}

package teamOD.armourReborn.common.core.handler;

import java.io.File;

import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;

public final class ConfigHandler {

	public static Configuration config ;

	public static boolean generateOre = true ;
	public static boolean disableVanillaArmours = false ;

	public static void init (File configFile) {
		config = new Configuration (configFile) ;

		config.load() ;
		load() ;

		config.save() ;
	}

	public static void load () {
		String desc ;

		desc = "Set this to false to disable the world generation of this mod's added ores." + "\n" ;
		desc += "Make sure your pack has an alternative way to obtain the following ores if disabled:" + "\n" ;
		desc += "Copper Ore, Aluminum Ore" ;
		generateOre = loadPropBool ("enable.worldGen", desc, generateOre) ;

		desc = "If set to true, all vanilla armours will not provide any protection to the user" ;
		disableVanillaArmours = loadPropBool ("disable.vanillaArmour", desc, disableVanillaArmours) ;

	}

	private static boolean loadPropBool(String propName, String desc, boolean default_) {
		Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_);
		prop.setComment(desc);

		return prop.getBoolean(default_);
	}
}

Disable vanilla armours is turned off by default


package edu.northwestern.bioinformatics.studycalendar.testing;

import junit.framework.TestCase;

import java.lang.reflect.Method;
import java.util.Set;
import java.util.HashSet;

import org.easymock.classextension.EasyMock;

/**
 * @author Rhett Sutphin
 */
public abstract class StudyCalendarTestCase extends TestCase {
    protected Set<Object> mocks = new HashSet<Object>();

    ////// MOCK REGISTRATION AND HANDLING

    protected <T> T registerMockFor(Class<T> forClass) {
        return registered(EasyMock.createMock(forClass));
    }

    protected <T> T registerMockFor(Class<T> forClass, Method[] methodsToMock) {
        return registered(EasyMock.createMock(forClass, methodsToMock));
    }

    protected void replayMocks() {
        for (Object mock : mocks) EasyMock.replay(mock);
    }

    protected void verifyMocks() {
        for (Object mock : mocks) EasyMock.verify(mock);
    }

    protected void resetMocks() {
        for (Object mock : mocks) EasyMock.reset(mock);
    }

    private <T> T registered(T mock) {
        mocks.add(mock);
        return mock;
    }
}

package edu.northwestern.bioinformatics.studycalendar.testing;

import edu.nwu.bioinformatics.commons.testing.CoreTestCase;

import junit.framework.TestCase;

import java.lang.reflect.Method;
import java.util.Set;
import java.util.HashSet;

import org.easymock.classextension.EasyMock;

/**
 * @author Rhett Sutphin
 */
public abstract class StudyCalendarTestCase extends CoreTestCase {
    protected Set<Object> mocks = new HashSet<Object>();

    ////// MOCK REGISTRATION AND HANDLING

    protected <T> T registerMockFor(Class<T> forClass) {
        return registered(EasyMock.createMock(forClass));
    }

    protected <T> T registerMockFor(Class<T> forClass, Method[] methodsToMock) {
        return registered(EasyMock.createMock(forClass, methodsToMock));
    }

    protected void replayMocks() {
        for (Object mock : mocks) EasyMock.replay(mock);
    }

    protected void verifyMocks() {
        for (Object mock : mocks) EasyMock.verify(mock);
    }

    protected void resetMocks() {
        for (Object mock : mocks) EasyMock.reset(mock);
    }

    private <T> T registered(T mock) {
        mocks.add(mock);
        return mock;
    }
}

Extend CoreTestCase for access to assertPositve/Negative, others


/*
 * JBoss, Home of Professional Open Source
 * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
 * as indicated by the @author tags. All rights reserved.
 * See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU Lesser General Public License, v. 2.1.
 * This program is distributed in the hope that it will be useful, but WITHOUT A
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License,
 * v.2.1 along with this distribution; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA  02110-1301, USA.
 */
package org.switchyard.quickstarts.demos.helpdesk;

import org.switchyard.component.bpm.BPM;
import org.switchyard.component.bpm.jbpm.CommandBasedWSHumanTaskHandler;

/**
 * @author David Ward <dward@jboss.org> (C) 2011 Red Hat Inc.
 */
@BPM(
    processInterface = HelpDeskService.class,
    taskHandlers = { CommandBasedWSHumanTaskHandler.class }
)
public final class HelpDeskServiceProcess {}

/*
 * JBoss, Home of Professional Open Source
 * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
 * as indicated by the @author tags. All rights reserved.
 * See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU Lesser General Public License, v. 2.1.
 * This program is distributed in the hope that it will be useful, but WITHOUT A
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License,
 * v.2.1 along with this distribution; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA  02110-1301, USA.
 */
package org.switchyard.quickstarts.demos.helpdesk;

import org.switchyard.component.bpm.Process;
import org.switchyard.component.bpm.task.jbpm.CommandBasedWSHumanTaskHandler;

/**
 * @author David Ward <dward@jboss.org> (C) 2011 Red Hat Inc.
 */
@Process(
    value=HelpDeskService.class,
    taskHandlers={CommandBasedWSHumanTaskHandler.class})
public interface HelpDeskServiceProcess {}

SWITCHYARD-329: Add BPM annotations to mark methods as process action triggers


package com.lopei.collageview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

import com.lopei.collageview.CollageView.ImageForm;

/**
 * Created by alan on 08.12.16.
 */

public class RectangleImageView extends ImageView {
    private ImageForm imageForm = ImageForm.IMAGE_FORM_SQUARE;

    public RectangleImageView(Context context, ImageForm imageForm) {
        super(context);
        this.imageForm = imageForm;
    }

    public RectangleImageView(Context context, AttributeSet attrs, ImageForm imageForm) {
        super(context, attrs);
        this.imageForm = imageForm;
    }

    public RectangleImageView(Context context, AttributeSet attrs, ImageForm imageForm, int defStyle) {
        super(context, attrs, defStyle);
        this.imageForm = imageForm;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        if (getParent() != null) {
            getLayoutParams().height = widthMeasureSpec / imageForm.getDivider();
            setMeasuredDimension(widthMeasureSpec, widthMeasureSpec / imageForm.getDivider());
        }
    }
}

package com.lopei.collageview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

import com.lopei.collageview.CollageView.ImageForm;

/**
 * Created by alan on 08.12.16.
 */

public class RectangleImageView extends androidx.appcompat.widget.AppCompatImageView {
    private ImageForm imageForm = ImageForm.IMAGE_FORM_SQUARE;

    public RectangleImageView(Context context, ImageForm imageForm) {
        super(context);
        this.imageForm = imageForm;
    }

    public RectangleImageView(Context context, AttributeSet attrs, ImageForm imageForm) {
        super(context, attrs);
        this.imageForm = imageForm;
    }

    public RectangleImageView(Context context, AttributeSet attrs, ImageForm imageForm, int defStyle) {
        super(context, attrs, defStyle);
        this.imageForm = imageForm;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        if (getParent() != null) {
            getLayoutParams().height = widthMeasureSpec / imageForm.getDivider();
            setMeasuredDimension(widthMeasureSpec, widthMeasureSpec / imageForm.getDivider());
        }
    }
}

Make rectangle image view extend AppCompatImageView


package org.cniska.noc3;

/**
 * Configuration parameters for the application.
 */
class Config {
    // Adjust these values if necessary.
    int numberOfPlayers = 3;
    int numberOfRounds = 2;
    int totalNumberOfChips = 500;
}

package org.cniska.noc3;

/**
 * Configuration parameters for the application.
 */
class Config {
    // Adjust these values if necessary.
    int numberOfPlayers = 5;
    int numberOfRounds = 20;
    int totalNumberOfChips = 500;
}

Adjust the config params according to the exercise description


package com.saraighatsoftware.flexicalculator;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;

class ResultFormat {

    private static final int RESULT_SCALE = 6;
    private static final DecimalFormat format = new DecimalFormat();

    static String Format(BigDecimal value) {
        format.setMaximumFractionDigits(RESULT_SCALE);
        format.setMinimumFractionDigits(0);
        format.setGroupingUsed(false);
        format.setRoundingMode(RoundingMode.HALF_EVEN);
        return format.format(value).replace('-', Calculator.SUBTRACT_CHAR);
    }
}

package com.saraighatsoftware.flexicalculator;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;

class ResultFormat {

    private static final int RESULT_SCALE = 9;
    private static final DecimalFormat format = new DecimalFormat();

    static String Format(BigDecimal value) {
        format.setMaximumFractionDigits(RESULT_SCALE);
        format.setMinimumFractionDigits(0);
        format.setGroupingUsed(false);
        format.setRoundingMode(RoundingMode.HALF_EVEN);
        return format.format(value).replace('-', Calculator.SUBTRACT_CHAR);
    }
}

Change result scale from 6 to 9

Change result scale from 6 to 9


package edu.pdx.cs410J.grader.poa.ui;

import com.google.inject.Singleton;
import edu.pdx.cs410J.grader.poa.POASubmissionsView;

import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import java.awt.*;
import java.util.List;
import java.util.Vector;

@Singleton
public class POASubmissionsPanel extends JPanel implements POASubmissionsView {

  private final JList<String> submissions;

  public POASubmissionsPanel() {
    submissions = new JList<>();
    submissions.setVisibleRowCount(10);

    this.setLayout(new BorderLayout());

    this.add(new JScrollPane(submissions), BorderLayout.CENTER);

    this.add(new JLabel("Hello??"), BorderLayout.SOUTH);
  }

  @Override
  public void setPOASubmissionsDescriptions(List<String> strings) {
    submissions.setListData(new Vector<>(strings));
  }

  @Override
  public void addSubmissionSelectedListener(POASubmissionSelectedListener listener) {
    submissions.addListSelectionListener(e -> {
      if (isFinalEventInUserSelection(e)) {
        listener.submissionSelected(e.getFirstIndex());
      }
    });
  }

  private boolean isFinalEventInUserSelection(ListSelectionEvent e) {
    return !e.getValueIsAdjusting();
  }
}

package edu.pdx.cs410J.grader.poa.ui;

import com.google.inject.Singleton;
import edu.pdx.cs410J.grader.poa.POASubmissionsView;

import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import java.awt.*;
import java.util.List;
import java.util.Vector;

@Singleton
public class POASubmissionsPanel extends JPanel implements POASubmissionsView {

  private final JList<String> submissions;

  public POASubmissionsPanel() {
    submissions = new JList<>();
    submissions.setVisibleRowCount(10);

    this.setLayout(new BorderLayout());

    this.add(new JScrollPane(submissions), BorderLayout.CENTER);

    this.add(new JLabel("Hello??"), BorderLayout.SOUTH);
  }

  @Override
  public void setPOASubmissionsDescriptions(List<String> strings) {
    submissions.setListData(new Vector<>(strings));
  }

  @Override
  public void addSubmissionSelectedListener(POASubmissionSelectedListener listener) {
    submissions.addListSelectionListener(e -> {
      if (isFinalEventInUserSelection(e)) {
        listener.submissionSelected(submissions.getSelectedIndex());
      }
    });
  }

  private boolean isFinalEventInUserSelection(ListSelectionEvent e) {
    return !e.getValueIsAdjusting();
  }
}

Fix an issue with submission selection by just using the index of the selected submission.


package org.realityforge.replicant.client;

import arez.component.NoSuchEntityException;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * The service interface for looking up entities by type+id.
 * This is used from within the entities during linking phase.
 */
public interface EntityLocator
{
  @Nonnull
  default <T> T getByID( @Nonnull final Class<T> type, @Nonnull final Object id )
  {
    final T entity = findByID( type, id );
    if ( null == entity )
    {
      throw new NoSuchEntityException( id );
    }
    return entity;
  }

  /**
   * Lookup an entity of specified type with specified id, returning null if not present.
   *
   * @param type the type of the entity.
   * @param id   the id of the entity.
   * @param <T>  the entity type.
   * @return the entity or null if no such entity.
   */
  @Nullable
  <T> T findByID( @Nonnull Class<T> type, @Nonnull Object id );
}

package org.realityforge.replicant.client;

import arez.component.NoSuchEntityException;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * The service interface for looking up entities by type+id.
 * This is used from within the entities during linking phase.
 */
public interface EntityLocator
{
  @Nonnull
  default <T> T getByID( @Nonnull final Class<T> type, @Nonnull final Object id )
  {
    final T entity = findById( type, id );
    if ( null == entity )
    {
      throw new NoSuchEntityException( id );
    }
    return entity;
  }

  /**
   * Lookup an entity of specified type with specified id, returning null if not present.
   *
   * @param type the type of the entity.
   * @param id   the id of the entity.
   * @param <T>  the entity type.
   * @return the entity or null if no such entity.
   */
  @Nullable
  <T> T findById( @Nonnull Class<T> type, @Nonnull Object id );
}

Rename method findByID to findById

Rename method findByID to findById


package io.subutai.common.peer;

import org.codehaus.jackson.annotate.JsonIgnore;

/**
 * Registration DTO
 */
public class RegistrationData
{
    private PeerInfo peerInfo;
    @JsonIgnore
    private String keyPhrase;
    private RegistrationStatus status;
    private Encrypted data;

    public RegistrationData()
    {
    }

    public RegistrationData( final PeerInfo peerInfo, final String keyPhrase, final RegistrationStatus status )
    {
        this.peerInfo = peerInfo;
        this.keyPhrase = keyPhrase;
        this.status = status;
    }

    public RegistrationData( final PeerInfo peerInfo, final RegistrationStatus status )
    {
        this.peerInfo = peerInfo;
        this.status = status;
    }

    public PeerInfo getPeerInfo()
    {
        return peerInfo;
    }

    public void setPeerInfo( final PeerInfo peerInfo )
    {
        this.peerInfo = peerInfo;
    }

    public String getKeyPhrase()
    {
        return keyPhrase;
    }

    public RegistrationStatus getStatus()
    {
        return status;
    }

    public void setStatus( final RegistrationStatus status )
    {
        this.status = status;
    }

    public Encrypted getData()
    {
        return data;
    }

    public void setData( final Encrypted data )
    {
        this.data = data;
    }

    public void setKeyPhrase( final String keyPhrase )
    {
        this.keyPhrase = keyPhrase;
    }
}

package io.subutai.common.peer;

import org.codehaus.jackson.annotate.JsonIgnore;

/**
 * Registration DTO
 */
public class RegistrationData
{
    private PeerInfo peerInfo;
    @JsonIgnore
    private String keyPhrase;
    private RegistrationStatus status;
    private Encrypted data;
    private String token;

    public RegistrationData()
    {
    }

    public RegistrationData( final PeerInfo peerInfo, final String keyPhrase, final RegistrationStatus status )
    {
        this.peerInfo = peerInfo;
        this.keyPhrase = keyPhrase;
        this.status = status;
    }

    public RegistrationData( final PeerInfo peerInfo, final RegistrationStatus status )
    {
        this.peerInfo = peerInfo;
        this.status = status;
    }

    public PeerInfo getPeerInfo()
    {
        return peerInfo;
    }

    public void setPeerInfo( final PeerInfo peerInfo )
    {
        this.peerInfo = peerInfo;
    }

    public String getKeyPhrase()
    {
        return keyPhrase;
    }

    public RegistrationStatus getStatus()
    {
        return status;
    }

    public void setStatus( final RegistrationStatus status )
    {
        this.status = status;
    }

    public Encrypted getData()
    {
        return data;
    }

    public void setData( final Encrypted data )
    {
        this.data = data;
    }

    public void setKeyPhrase( final String keyPhrase )
    {
        this.keyPhrase = keyPhrase;
    }

    /**
     * Token generated by the owner of initiator peer. To be used
     * in kurjun if the request is approved by the remote peer.
     */
    public String getToken()
    {
        return token;
    }

    /**
     * Token generated by the owner of initiator peer. To be used
     * in kurjun if the request is approved by the remote peer.
     */
    public void setToken( String token )
    {
        this.token = token;
    }

}

KURJUN-136: Add token to be transfered between registered peers


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

import java.io.Serializable;

/**
 * A simple reference to another Facebook object without the complete set of object data.
 * @author Craig Walls
 */
@SuppressWarnings("serial")
public class Reference extends FacebookObject implements Serializable {

	private final String id;

	private final String name;

	public Reference(String id) {
		this(id, null);
	}

	public Reference(String id, String name) {
		this.id = id;
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public String getName() {
		return name;
	}

}

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

import java.io.Serializable;

/**
 * A simple reference to another Facebook object without the complete set of object data.
 * @author Craig Walls
 */
@SuppressWarnings("serial")
public class Reference extends FacebookObject implements Serializable {

	private final String id;

	private final String name;

    @SuppressWarnings("unused")
    private Reference() {
        this(null, null);
    }

    public Reference(String id) {
		this(id, null);
	}

	public Reference(String id, String name) {
		this.id = id;
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public String getName() {
		return name;
	}

}

Fix MappingInstantiationException for no default constructor


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.dspace.doi;

import java.sql.SQLException;
import org.dspace.content.DCValue;
import org.dspace.content.Item;
import org.dspace.content.MetadataSchema;

/**
 * Convenience methods involved in registering DOIs.
 * @author dan
 */
public class DryadDOIRegistrationHelper {

    public static final String REGISTER_PENDING_PUBLICATION_STEP = "registerPendingPublicationStep";

    public static boolean isDataPackageInPublicationBlackout(Item dataPackage) throws SQLException {
        // Publication blackout is indicated by provenance metadata
        boolean isInBlackout = false;
        DCValue provenance[] =  dataPackage.getMetadata(MetadataSchema.DC_SCHEMA, "description", "provenance", "en");
        for(DCValue dcValue : provenance) {
            // only return true if the last recorded provenance indicates publication blackout
            if(dcValue.value != null)
                if(dcValue.value.contains("Entered publication blackout")) {
                    isInBlackout = true;
                } else {
                    isInBlackout = false;
            }

        }
        // now find something that would negate blackout
        return isInBlackout;
    }

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.dspace.doi;

import java.sql.SQLException;
import org.dspace.content.DCValue;
import org.dspace.content.Item;
import org.dspace.content.MetadataSchema;

/**
 * Convenience methods involved in registering DOIs.
 * @author dan
 */
public class DryadDOIRegistrationHelper {

    public static final String REGISTER_PENDING_PUBLICATION_STEP = "registerPendingPublicationStep";

    public static boolean isDataPackageInPublicationBlackout(Item dataPackage) throws SQLException {
        // Publication blackout is indicated by provenance metadata
        boolean isInBlackout = false;
        DCValue provenance[] =  dataPackage.getMetadata(MetadataSchema.DC_SCHEMA, "description", "provenance", Item.ANY);
        for(DCValue dcValue : provenance) {
            // only return true if the last recorded provenance indicates publication blackout
            if(dcValue.value != null)
                if(dcValue.value.contains("Entered publication blackout")) {
                    isInBlackout = true;
                } else {
                    isInBlackout = false;
            }

        }
        // now find something that would negate blackout
        return isInBlackout;
    }

}

Remove 'en' restriction when checking provenance for blackout


package ca.antonious.viewcelladapter.decorators;

import ca.antonious.viewcelladapter.sections.AbstractSection;

/**
 * Created by George on 2016-12-17.
 */

public abstract class SectionDecorator extends AbstractSection {
    private AbstractSection decoratedSection;

    public SectionDecorator(AbstractSection decoratedSection) {
        this.decoratedSection = decoratedSection;
    }

    public AbstractSection getDecoratedSection() {
        return decoratedSection;
    }
}

package ca.antonious.viewcelladapter.decorators;

import ca.antonious.viewcelladapter.internal.SectionObserver;
import ca.antonious.viewcelladapter.sections.AbstractSection;

/**
 * Created by George on 2016-12-17.
 */

public abstract class SectionDecorator extends AbstractSection implements SectionObserver {
    private AbstractSection decoratedSection;

    public SectionDecorator(AbstractSection decoratedSection) {
        this.decoratedSection = decoratedSection;
        this.decoratedSection.addObserver(this);
    }

    public AbstractSection getDecoratedSection() {
        return decoratedSection;
    }

    @Override
    public void onDataChanged() {
        notifyDataChanged();
    }
}

Update section decorator to handle notifications


package com.linkedin.uif.source.extractor.extract.restapi;

import java.io.IOException;

import com.linkedin.uif.configuration.WorkUnitState;
import com.linkedin.uif.source.extractor.Extractor;
import com.linkedin.uif.source.extractor.exception.ExtractPrepareException;
import com.linkedin.uif.source.extractor.extract.BaseSource;

/**
 * An implementation of salesforce source to get work units
 */
public class SalesforceSource<S, D> extends BaseSource<S, D> {

	public Extractor<S, D> getExtractor(WorkUnitState state) throws IOException {
		Extractor<S, D> extractor = null;
		try {
			extractor = new SalesforceExtractor<S, D>(state).build();
		} catch (ExtractPrepareException e) {
			e.printStackTrace();
			throw new IOException("Failed to prepare extractor; error-" + e.getMessage());
		}
		return extractor;
	}
}

package com.linkedin.uif.source.extractor.extract.restapi;

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.linkedin.uif.configuration.WorkUnitState;
import com.linkedin.uif.source.extractor.Extractor;
import com.linkedin.uif.source.extractor.exception.ExtractPrepareException;
import com.linkedin.uif.source.extractor.extract.BaseSource;

/**
 * An implementation of salesforce source to get work units
 */
public class SalesforceSource<S, D> extends BaseSource<S, D> {
	private static final Log LOG = LogFactory.getLog(BaseSource.class);

	public Extractor<S, D> getExtractor(WorkUnitState state) throws IOException {
		Extractor<S, D> extractor = null;
		try {
			extractor = new SalesforceExtractor<S, D>(state).build();
		} catch (ExtractPrepareException e) {
			LOG.error("Failed to prepare extractor: error -" + e.getMessage());
			throw new IOException(e);
		}
		return extractor;
	}
}

Use Logging instead of printStackTrace()

RB=279101
R=stakiar,kgoodhop,lqiao,ynli
A=ynli


package org.jvirtanen.parity.match;

/**
 * MarketListener is the interface for outbound events from the
 * matching engine.
 */
public interface MarketListener {

    /**
     * Match an incoming order to a resting order in the order book. The match
     * occurs at the price of the order in the order book.
     *
     * @param restingOrderId the order identifier of the resting order
     * @param incomingOrderId the order identifier of the incoming order
     * @param incomingSide the side of the incoming order
     * @param price the execution price
     * @param executedQuantity the executed quantity
     * @param remainingQuantity the remaining quantity of the resting order
     */
    void match(long restingOrderId, long incomingOrderId, Side incomingSide, long price, long executedQuantity, long remainingQuantity);

    /**
     * Add an order to the order book.
     *
     * @param orderId the order identifier
     * @param side the side
     * @param price the limit price
     * @param size the size
     */
    void add(long orderId, Side side, long price, long size);

    /**
     * Cancel a quantity of an order.
     *
     * @param orderId the order identifier
     * @param canceledQuantity the canceled quantity
     * @param remainingQuantity the remaining quantity
     */
    void cancel(long orderId, long canceledQuantity, long remainingQuantity);

}

package org.jvirtanen.parity.match;

/**
 * The interface for outbound events from the matching engine.
 */
public interface MarketListener {

    /**
     * Match an incoming order to a resting order in the order book. The match
     * occurs at the price of the order in the order book.
     *
     * @param restingOrderId the order identifier of the resting order
     * @param incomingOrderId the order identifier of the incoming order
     * @param incomingSide the side of the incoming order
     * @param price the execution price
     * @param executedQuantity the executed quantity
     * @param remainingQuantity the remaining quantity of the resting order
     */
    void match(long restingOrderId, long incomingOrderId, Side incomingSide, long price, long executedQuantity, long remainingQuantity);

    /**
     * Add an order to the order book.
     *
     * @param orderId the order identifier
     * @param side the side
     * @param price the limit price
     * @param size the size
     */
    void add(long orderId, Side side, long price, long size);

    /**
     * Cancel a quantity of an order.
     *
     * @param orderId the order identifier
     * @param canceledQuantity the canceled quantity
     * @param remainingQuantity the remaining quantity
     */
    void cancel(long orderId, long canceledQuantity, long remainingQuantity);

}

Tweak documentation for market listener in matching engine


package org.wikipedia.dataclient.mwapi;

import android.support.annotation.Nullable;

import com.google.gson.annotations.SerializedName;

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

@SuppressWarnings("unused")
public class EditorTaskCounts {
    @Nullable private Counts counts;
    @Nullable private List<String> targetsPassed;

    public class Counts {
        @Nullable @SerializedName("app_description_edits") private Map<String, Integer> appDescriptionEdits;
    }
}

package org.wikipedia.dataclient.mwapi;

import android.support.annotation.Nullable;

import com.google.gson.annotations.SerializedName;

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

@SuppressWarnings("unused")
public class EditorTaskCounts {
    @Nullable private Counts counts;
    @Nullable private Targets targetsPassed;

    @Nullable
    public Map<String, Integer> getDescriptionEditsPerLanguage() {
        return counts != null && counts.appDescriptionEdits != null ? counts.appDescriptionEdits : null;
    }

    @Nullable
    public List<Integer> getDescriptionEditTargetsPassed() {
        return targetsPassed != null && targetsPassed.appDescriptionEdits != null ? targetsPassed.appDescriptionEdits : null;
    }

    public class Counts {
        @Nullable @SerializedName("app_description_edits") private Map<String, Integer> appDescriptionEdits;
    }

    public class Targets {
        @Nullable @SerializedName("app_description_edits") private List<Integer> appDescriptionEdits;
    }
}

Complete the model structure of editor task API response.

Change-Id: Ic74903da379ed4d4910790cda1ea55c80bf84ef7


package backend;

import java.security.interfaces.RSAPrivateKey;

/**
 * Wrapper class for the initial data that is to be sent to the
 * smartcard/terminal upon initialization.
 *
 * TODO/WARNING: values can be null in current implementation
 */
public class InitData {

	public byte[] certificate;
	public byte[] privateKey;
	public byte[] secretKey;
	public byte[] caVerifKey;

	public InitData(byte[] certificate, RSAPrivateKey privateKey) {
		this(certificate, privateKey, null, null);
	}

	public InitData(byte[] certificate, RSAPrivateKey privateKey, byte[] caVerifKey) {
		this(certificate, privateKey, null, caVerifKey);
	}

	public InitData(byte[] certificate, RSAPrivateKey privateKey, byte[] secretKey,
			byte[] caVerifKey) {
		this.certificate = certificate;
		this.privateKey = privateKey;
		this.secretKey = secretKey;
		this.caVerifKey = caVerifKey;
	}
}

package backend;

import java.security.interfaces.RSAPrivateKey;

/**
 * Wrapper class for the initial data that is to be sent to the
 * smartcard/terminal upon initialization.
 *
 * TODO/WARNING: values can be null in current implementation
 */
public class InitData {

	public byte[] certificate;
	public RSAPrivateKey privateKey;
	public byte[] secretKey;
	public byte[] caVerifKey;

	public InitData(byte[] certificate, RSAPrivateKey privateKey) {
		this.certificate = certificate;
		this.privateKey = privateKey;
	}

	public InitData(byte[] certificate, RSAPrivateKey privateKey, byte[] caVerifKey) {
		this.certificate = certificate;
		this.privateKey = privateKey;
		this.caVerifKey = caVerifKey;
	}
}

Change data type of terminal data

Change data type of terminal data


/*
 * Copyright 2014 Gabriel Harris-Rouquette
 *
 * 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.afterkraft.kraftrpg.entity.party;

import com.afterkraft.kraftrpg.api.RPGPlugin;
import com.afterkraft.kraftrpg.api.entity.Champion;
import com.afterkraft.kraftrpg.api.entity.party.Party;
import com.afterkraft.kraftrpg.api.entity.party.PartyManager;

public class RPGPartyManager implements PartyManager {

    private final RPGPlugin plugin;

    public RPGPartyManager(RPGPlugin plugin) {
        this.plugin = plugin;
    }

    @Override
    public Party createParty(Champion partyLeader, Champion... members) {
        return null;
    }

    @Override
    public void initialize() {

    }

    @Override
    public void shutdown() {

    }
}

/*
 * Copyright 2014 Gabriel Harris-Rouquette
 *
 * 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.afterkraft.kraftrpg.entity.party;

import com.afterkraft.kraftrpg.api.RPGPlugin;
import com.afterkraft.kraftrpg.api.entity.PartyMember;
import com.afterkraft.kraftrpg.api.entity.party.Party;
import com.afterkraft.kraftrpg.api.entity.party.PartyManager;

public class RPGPartyManager implements PartyManager {

    private final RPGPlugin plugin;

    public RPGPartyManager(RPGPlugin plugin) {
        this.plugin = plugin;
    }

    @Override
    public void initialize() {

    }

    @Override
    public void shutdown() {

    }

    @Override
    public Party createParty(PartyMember partyLeader, PartyMember... members) {
        return null;
    }
}

Refactor PartyManager as per API.

Refactor PartyManager as per API.


package se.christianjensen.maintenance;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import io.dropwizard.client.JerseyClientConfiguration;
import se.christianjensen.maintenance.representation.config.UserConfiguration;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

public class MaintenanceConfiguration extends Configuration {

    @NotNull
    @JsonProperty
    private String sigarLocation;

    @Valid
    @NotNull
    @JsonProperty
    private UserConfiguration user;

    public String getSigarLocation() {
        return sigarLocation;
    }

    public UserConfiguration getUser() {
        return user;
    }
}

package se.christianjensen.maintenance;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import se.christianjensen.maintenance.representation.config.UserConfiguration;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

public class MaintenanceConfiguration extends Configuration {

    @NotNull
    @JsonProperty
    private String sigarLocation;

    @Valid
    @NotNull
    @JsonProperty
    private UserConfiguration user;

    public String getSigarLocation() {
        return sigarLocation;
    }

    public UserConfiguration getUser() {
        return user;
    }
}

Remove JerseyClientConfig from Config class


package uk.ac.ebi.quickgo.geneproduct.common;

import java.util.function.Supplier;

/**
 * An enumeration of the possible states of proteome membership a gene product can have.
 * @author Tony Wardell
 * Date: 06/03/2018
 * Time: 10:33
 * Created with IntelliJ IDEA.
 */
public enum ProteomeMembership {
    REFERENCE, COMPLETE, NONE, NOT_APPLICABLE;

    /**
     * Define the predicates required and order of importance to work out which Proteome membership category is
     * applicable.
     * @param isProtein is the gene product a protein
     * @param isReferenceProteome is the gene product a reference proteome
     * @param isComplete is the gene product a member of a complete proteome.
     * @return the name of the ProteomeMembership matching the applied constraints
     */
    public static String membership(boolean isProtein, boolean isReferenceProteome, boolean isComplete) {

        if (!isProtein) {
            return NOT_APPLICABLE.name();
        } else if (isReferenceProteome) {
            return REFERENCE.name();
        } else if (isComplete) {
            return COMPLETE.name();
        }
        return NONE.name();
    }
}

package uk.ac.ebi.quickgo.geneproduct.common;

/**
 * An enumeration of the possible states of proteome membership a gene product can have.
 * @author Tony Wardell
 * Date: 06/03/2018
 * Time: 10:33
 * Created with IntelliJ IDEA.
 */
public enum ProteomeMembership {
    REFERENCE("Reference"),
    COMPLETE("Complete"),
    NONE("None"),
    NOT_APPLICABLE("Not-applicable");

    private String value;

    ProteomeMembership(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    /**
     * Define the predicates required and order of importance to work out which Proteome membership category is
     * applicable.
     * @param isProtein is the gene product a protein
     * @param isReferenceProteome is the gene product a reference proteome
     * @param isComplete is the gene product a member of a complete proteome.
     * @return the String representation of the ProteomeMembership matching the applied constraints
     */
    public static String membership(boolean isProtein, boolean isReferenceProteome, boolean isComplete) {

        if (!isProtein) {
            return NOT_APPLICABLE.getValue();
        } else if (isReferenceProteome) {
            return REFERENCE.getValue();
        } else if (isComplete) {
            return COMPLETE.getValue();
        }
        return NONE.getValue();
    }
}

Change the name of the method used to get the string representation of the ProteomeMemberhip emum - we are no longer going to rely on the library generated version. Provide the value to use


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

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This annotation is used to.
 *
 * @author Sébastien Bordes
 */
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface RunInto {

    /**
     * Define the RunType value.
     *
     * The default value is RunType.JIT
     */
    RunType value() default RunType.JIT;
}

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

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This annotation is used to.
 *
 * @author Sébastien Bordes
 */
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface RunInto {

    /**
     * Define the RunType value.
     *
     * The default value is RunType.JIT
     */
    RunType value() default RunType.JIT;
}

Document and inherit please :D

Document and inherit please :D


package com.appyvet.rangebarsample;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

public class RecyclerViewActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Removes title bar and sets content view
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_recyclerview);
        RecyclerView recyclerView = findViewById(R.id.recyclerView);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(new Adapter());
    }

    public static class Adapter extends RecyclerView.Adapter<VH> {

        @NonNull
        @Override
        public VH onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
            return new VH(LayoutInflater.from(viewGroup.getContext())
                    .inflate(R.layout.recyclerview_item, viewGroup, false));
        }

        @Override
        public void onBindViewHolder(@NonNull VH vh, int i) {

        }

        @Override
        public int getItemCount() {
            return 100;
        }
    }

    public static class VH extends RecyclerView.ViewHolder {

        public VH(@NonNull View itemView) {
            super(itemView);
        }
    }
}

package com.appyvet.rangebarsample;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

public class RecyclerViewActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Removes title bar and sets content view
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_recyclerview);
        RecyclerView recyclerView = findViewById(R.id.recyclerView);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        Adapter adapter = new Adapter();
        adapter.setHasStableIds(true);
        recyclerView.setAdapter(adapter);
    }

    public static class Adapter extends RecyclerView.Adapter<VH> {

        @NonNull
        @Override
        public VH onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
            return new VH(LayoutInflater.from(viewGroup.getContext())
                    .inflate(R.layout.recyclerview_item, viewGroup, false));
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public int getItemViewType(int position) {
            return position;
        }

        @Override
        public void onBindViewHolder(@NonNull VH vh, int i) {

        }

        @Override
        public int getItemCount() {
            return 50;
        }
    }

    public static class VH extends RecyclerView.ViewHolder {

        public VH(@NonNull View itemView) {
            super(itemView);
        }
    }
}

Use stable ids for the RecyclerView adapter


package net.bourgau.philippe.concurrency.kata;

import org.apache.commons.io.IOUtils;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;

public class TextLineProtocol implements AutoCloseable {
    private final Socket socket;
    private BufferedReader reader;
    private BufferedWriter writer;

    public TextLineProtocol(Socket socket) throws Exception {
        this.socket = socket;
        reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
    }

    public void writeMessage(String message) throws Exception {
        writer.write(message + "\n");
        writer.flush();
    }

    public String readMessage() throws Exception {
        return reader.readLine();
    }

    @Override
    public void close() {
        IOUtils.closeQuietly(socket);
    }
}

package net.bourgau.philippe.concurrency.kata;

import org.apache.commons.io.IOUtils;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;

public class TextLineProtocol implements AutoCloseable {
    private final Socket socket;
    private BufferedReader reader;
    private BufferedWriter writer;

    public TextLineProtocol(Socket socket) throws Exception {
        this.socket = socket;
        socket.setSoTimeout(250);
        reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
    }

    public void writeMessage(String message) throws Exception {
        writer.write(message + "\n");
        writer.flush();
    }

    public String readMessage() throws Exception {
        String message = null;
        while (!Thread.interrupted()) {
            try {
                message = reader.readLine();
                break;
            } catch (SocketTimeoutException ignoreTimeoutAndRetry) {
                continue;
            }
        }
        if (message == null) {
            throw new SocketException("Socket was closed before a message could be read");
        }
        return message;
    }

    @Override
    public void close() {
        IOUtils.closeQuietly(socket);
    }
}

Make reading from sockets more robust

Make reading from sockets more robust

- throw SocketException if nothing could be read from the socket
- use timeout version of socket read


package org.ratchetrobotics.algorithms.ai.planning;

/**
 * Documentation here.
 *
 * @author Liam Marshall
 * @version 1.0
 */
public class ActionThing {
    public ActionThing(StaticPosition position) {

    }
}

package org.ratchetrobotics.algorithms.ai.planning;

import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;

/**
 * Documentation here.
 *
 * @author Liam Marshall
 * @version 1.0
 */
public class ActionThing {
    public ActionThing(Vector3D position) {

    }
}

Use Vector3D instead of unimplemented custom class


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

package com.code_intelligence.jazzer.runtime;

import sun.misc.Signal;

public final class SignalHandler {
  static {
    Signal.handle(new Signal("INT"), sig -> handleInterrupt());
  }

  public static void initialize() {
    // Implicitly runs the static initializer.
  }

  private static native void handleInterrupt();
}

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

package com.code_intelligence.jazzer.runtime;

import sun.misc.Signal;

public final class SignalHandler {
  static {
    System.loadLibrary("jazzer_initialize");
    Signal.handle(new Signal("INT"), sig -> handleInterrupt());
  }

  public static void initialize() {
    // Implicitly runs the static initializer.
  }

  private static native void handleInterrupt();
}

Fix signal handling with --nohooks

runtime: Fix signal handling with --nohooks


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

package com.google.ase.interpreter.sh;

import com.google.ase.AndroidFacade;
import com.google.ase.AndroidProxy;
import com.google.ase.interpreter.AbstractInterpreterProcess;
import com.google.ase.jsonrpc.JsonRpcServer;

public class ShInterpreterProcess extends AbstractInterpreterProcess {

  private final AndroidProxy mAndroidProxy;
  private final int mAndroidProxyPort;

  public ShInterpreterProcess(AndroidFacade facade, String launchScript) {
    super(facade, launchScript);
    mAndroidProxy = new AndroidProxy(facade);
    mAndroidProxyPort = new JsonRpcServer(mAndroidProxy).start();
    buildEnvironment();
  }

  private void buildEnvironment() {
    mEnvironment.put("AP_PORT", Integer.toString(mAndroidProxyPort));
  }
}

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

package com.google.ase.interpreter.sh;

import com.google.ase.AndroidFacade;
import com.google.ase.AndroidProxy;
import com.google.ase.interpreter.AbstractInterpreterProcess;
import com.google.ase.jsonrpc.JsonRpcServer;

public class ShInterpreterProcess extends AbstractInterpreterProcess {

  private final AndroidProxy mAndroidProxy;
  private final int mAndroidProxyPort;

  public ShInterpreterProcess(AndroidFacade facade, String launchScript) {
    super(facade, launchScript);
    mAndroidProxy = new AndroidProxy(facade);
    mAndroidProxyPort = new JsonRpcServer(mAndroidProxy).start();
    buildEnvironment();
  }

  private void buildEnvironment() {
    mEnvironment.put("AP_PORT", Integer.toString(mAndroidProxyPort));
  }

  @Override
  protected void writeInterpreterCommand() {
    if (mLaunchScript != null) {
      print(SHELL_BIN + " " + mLaunchScript + "\n");
    }
  }

}

Add missing call to start shell scripts.


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

package com.example.lit.userprofile;

/**
 * Created by Riley Dixon on 01/12/2017.
 */

class BitmapTooLargeException extends Exception {
    BitmapTooLargeException(){
        super();
    }

    BitmapTooLargeException(String msg){
        super(msg);
    }

}

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

package com.example.lit.userprofile;

/**
 * Created by Riley Dixon on 01/12/2017.
 */

public class BitmapTooLargeException extends Exception {
    BitmapTooLargeException(){
        super();
    }

    BitmapTooLargeException(String msg){
        super(msg);
    }

}

Change visiablity of exception to public


/*
 * This is part of Geomajas, a GIS framework, http://www.geomajas.org/.
 *
 * Copyright 2008-2014 Geosparc nv, http://www.geosparc.com/, Belgium.
 *
 * The program is available in open source according to the GNU Affero
 * General Public License. All contributions in this program are covered
 * by the Geomajas Contributors License Agreement. For full licensing
 * details, see LICENSE.txt in the project root.
 */

package org.geomajas.gwt.example.client.security;

import org.geomajas.gwt.client.command.TokenRequestHandler;
import org.geomajas.gwt.client.command.event.TokenChangedHandler;
import org.geomajas.plugin.staticsecurity.client.util.SsecAccess;

/**
 * {@link org.geomajas.gwt.client.command.TokenRequestHandler} which allows logging in to a specific userId and password.
 *
 * @author Joachim Van der Auwera
 */
public class ShowcaseTokenRequestHandler implements TokenRequestHandler {

	// CHECKSTYLE VISIBILITY MODIFIER: OFF

	/** UserId to use for logging in. */
	public static String userId;
	/** Password to use for logging in. */
	public static String password;

	// CHECKSTYLE VISIBILITY MODIFIER: ON

	@Override
	public void login(TokenChangedHandler tokenChangedHandler) {
		SsecAccess.login(userId, password, tokenChangedHandler);
	}
}

/*
 * This is part of Geomajas, a GIS framework, http://www.geomajas.org/.
 *
 * Copyright 2008-2014 Geosparc nv, http://www.geosparc.com/, Belgium.
 *
 * The program is available in open source according to the GNU Affero
 * General Public License. All contributions in this program are covered
 * by the Geomajas Contributors License Agreement. For full licensing
 * details, see LICENSE.txt in the project root.
 */

package org.geomajas.gwt.example.client.security;

import org.geomajas.gwt.client.command.TokenRequestHandler;
import org.geomajas.gwt.client.command.event.TokenChangedHandler;
import org.geomajas.plugin.staticsecurity.client.util.SsecAccess;

/**
 * {@link org.geomajas.gwt.client.command.TokenRequestHandler} which allows logging in to a specific userId and
 * password.
 *
 * @author Joachim Van der Auwera
 */
public class ShowcaseTokenRequestHandler implements TokenRequestHandler {

	// CHECKSTYLE VISIBILITY MODIFIER: OFF

	/** UserId to use for logging in. */
	public static String userId;
	/** Password to use for logging in. */
	public static String password;

	// CHECKSTYLE VISIBILITY MODIFIER: ON

	@Override
	public void login(TokenChangedHandler tokenChangedHandler) {
		SsecAccess.login(userId, password, tokenChangedHandler);
	}
}

Fix showcase to old (svn) state.

Fix showcase to old (svn) state.


package com.netflix.client.netty.udp;

import io.netty.channel.socket.DatagramPacket;
import io.reactivex.netty.protocol.udp.server.UdpServer;

import java.net.DatagramSocket;
import java.net.SocketException;

import org.junit.rules.ExternalResource;

public class HelloUdpServerExternalResource extends ExternalResource {
    private UdpServer<DatagramPacket, DatagramPacket> server;

    private int timeout = 0;

    public HelloUdpServerExternalResource() {
    }

    private int choosePort() throws SocketException {
        DatagramSocket serverSocket = new DatagramSocket();
        int port = serverSocket.getLocalPort();
        serverSocket.close();
        return port;
    }

    public void setTimeout(int timeout) {
        this.timeout = timeout;
    }

    protected void before() throws Throwable {
        int port = choosePort();
        server = new HelloUdpServer(port, timeout).createServer();
    }

    public void start() {
        server.start();
    }

    /**
     * Override to tear down your specific external resource.
     */
    protected void after() {
        if (server != null) {
            try {
                server.shutdown();
            } catch (InterruptedException e) {
                System.out.println("Failed to shut down server");
                e.printStackTrace();
            }
        }
    }

    public int getServerPort() {
        return server.getServerPort();
    }
}

package com.netflix.client.netty.udp;

import io.netty.channel.socket.DatagramPacket;
import io.reactivex.netty.protocol.udp.server.UdpServer;

import java.net.DatagramSocket;
import java.net.SocketException;

import org.junit.rules.ExternalResource;

public class HelloUdpServerExternalResource extends ExternalResource {
    private UdpServer<DatagramPacket, DatagramPacket> server;

    private int timeout = 0;

    public HelloUdpServerExternalResource() {
    }

    private int choosePort() throws SocketException {
        DatagramSocket serverSocket = new DatagramSocket();
        int port = serverSocket.getLocalPort();
        serverSocket.close();
        return port;
    }

    public void setTimeout(int timeout) {
        this.timeout = timeout;
    }

    public void start() {
        int port;
        try {
            port = choosePort();
        } catch (SocketException e) {
            throw new RuntimeException("Error choosing point", e);
        }
        server = new HelloUdpServer(port, timeout).createServer();
        server.start();
    }

    /**
     * Override to tear down your specific external resource.
     */
    protected void after() {
        if (server != null) {
            try {
                server.shutdown();
            } catch (InterruptedException e) {
                System.out.println("Failed to shut down server");
                e.printStackTrace();
            }
        }
    }

    public int getServerPort() {
        return server.getServerPort();
    }
}

Move server config from before() to start()


/**
 * Copyright 2016 Smoke Turner, LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 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.smoketurner.notification.application.health;

import java.util.List;
import java.util.Objects;
import javax.annotation.Nonnull;
import com.basho.riak.client.api.RiakClient;
import com.basho.riak.client.core.RiakNode;
import com.codahale.metrics.health.HealthCheck;

public class RiakHealthCheck extends HealthCheck {

    private final RiakClient client;

    /**
     * Constructor
     *
     * @param client
     *            Riak client
     */
    public RiakHealthCheck(@Nonnull final RiakClient client) {
        this.client = Objects.requireNonNull(client);
    }

    @Override
    protected Result check() throws Exception {
        final List<RiakNode> nodes = client.getRiakCluster().getNodes();
        if (!nodes.isEmpty()) {
            return Result.healthy();
        }
        return Result.unhealthy("No available Riak nodes");
    }
}

/**
 * Copyright 2016 Smoke Turner, LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 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.smoketurner.notification.application.health;

import java.util.Objects;
import javax.annotation.Nonnull;
import com.basho.riak.client.api.RiakClient;
import com.basho.riak.client.core.operations.PingOperation;
import com.codahale.metrics.health.HealthCheck;

public class RiakHealthCheck extends HealthCheck {

    private final RiakClient client;

    /**
     * Constructor
     *
     * @param client
     *            Riak client
     */
    public RiakHealthCheck(@Nonnull final RiakClient client) {
        this.client = Objects.requireNonNull(client);
    }

    @Override
    protected Result check() throws Exception {
        final PingOperation ping = new PingOperation();
        client.getRiakCluster().execute(ping);
        ping.await();

        if (ping.isSuccess()) {
            return Result.healthy("Riak is healthly");
        }
        return Result.unhealthy("Riak is down");
    }
}

Add a proper Riak health check

Add a proper Riak health check


package devopsdistilled.operp.client.items;

import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import devopsdistilled.operp.client.abstracts.SubTaskPane;

public class ListItemPane extends SubTaskPane implements ListItemModelObserver {

	private final ListItemPaneController controller;
	private final ListItemModel model;

	private JPanel pane;
	private JTable table;
	private ItemTableModel tableModel;

	public ListItemPane(ListItemPaneController controller, ListItemModel model) {
		this.controller = controller;

		this.model = model;
		model.registerObserver(this);
	}

	/**
	 * @wbp.parser.entryPoint
	 */
	public void init() {
		pane = new JPanel();
		tableModel = new ItemTableModel();
		table = new JTable(tableModel);
		pane.add(new JScrollPane(table));

		controller.loadData();
	}

	@Override
	public void updateAll() {
		// TODO Auto-generated method stub

	}

	@Override
	public JComponent getPane() {
		return pane;
	}

	@Override
	public void updateItemList() {
		tableModel.setItems(model.getItems());
	}

}

package devopsdistilled.operp.client.items;

import java.awt.BorderLayout;

import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import devopsdistilled.operp.client.abstracts.SubTaskPane;

public class ListItemPane extends SubTaskPane implements ListItemModelObserver {

	private final ListItemPaneController controller;
	private final ListItemModel model;

	private JPanel pane;
	private JTable table;
	private ItemTableModel tableModel;

	public ListItemPane(ListItemPaneController controller, ListItemModel model) {
		this.controller = controller;

		this.model = model;
		model.registerObserver(this);
	}

	/**
	 * @wbp.parser.entryPoint
	 */
	public void init() {

		tableModel = new ItemTableModel();
		table = new JTable(tableModel);
		final JScrollPane scrollPane = new JScrollPane(table,
				JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
				JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

		pane = new JPanel(new BorderLayout());
		pane.setBorder(BorderFactory.createEmptyBorder());

		pane.add(scrollPane);

		controller.loadData();
	}

	@Override
	public void updateAll() {
		// TODO Auto-generated method stub

	}

	@Override
	public JComponent getPane() {
		return pane;
	}

	@Override
	public void updateItemList() {
		tableModel.setItems(model.getItems());
	}

}

Add scrollPane to pane with variable declared


package com.codahale.metrics;

import static java.lang.Math.min;

/**
 * A {@link Reservoir} implementation backed by a sliding window that stores the last {@code N}
 * measurements.
 */
public class SlidingWindowReservoir implements Reservoir {
    private final long[] measurements;
    private long count;

    /**
     * Creates a new {@link SlidingWindowReservoir} which stores the last {@code size} measurements.
     *
     * @param size the number of measurements to store
     */
    public SlidingWindowReservoir(int size) {
        this.measurements = new long[size];
        this.count = 0;
    }

    @Override
    public synchronized int size() {
        return (int) min(count, measurements.length);
    }

    @Override
    public synchronized void update(long value) {
        measurements[((int) count++ % measurements.length)] = value;
    }

    @Override
    public Snapshot getSnapshot() {
        final long[] values = new long[size()];
        for (int i = 0; i < values.length; i++) {
            synchronized (this) {
                values[i] = measurements[i];
            }
        }
        return new Snapshot(values);
    }
}

package com.codahale.metrics;

import static java.lang.Math.min;

/**
 * A {@link Reservoir} implementation backed by a sliding window that stores the last {@code N}
 * measurements.
 */
public class SlidingWindowReservoir implements Reservoir {
	private final long[] measurements;
    private boolean fullWindow;
    private long count;

    /**
     * Creates a new {@link SlidingWindowReservoir} which stores the last {@code size} measurements.
     *
     * @param size the number of measurements to store
     */
    public SlidingWindowReservoir(int size) {
        this.measurements = new long[size];
        this.count = 0;
    }

    @Override
    public synchronized int size() {
    	if(fullWindow){
    		return measurements.length;
    	}else{
    		return (int) min(count, measurements.length);
    	}
    }

    @Override
    public synchronized void update(long value) {
        measurements[(int) count++] = value;
    	if(count >= measurements.length){
    		count = 0;
    		fullWindow = true;
    	}
    }

    @Override
    public Snapshot getSnapshot() {
        final long[] values = new long[size()];
        for (int i = 0; i < values.length; i++) {
            synchronized (this) {
                values[i] = measurements[i];
            }
        }
        return new Snapshot(values);
    }
}

Fix for ArrayOutOfBoundsException if reservoir has too many samples and causes integer overflow.