package com.breakersoft.plow;

public class Signal {

    /**
     * Exit signal for an aborted dispatch.
     */
    public static final int NORMAL = 0;

    /**
     * Exit signal for an aborted dispatch.
     */
    public static final int ABORTED_TASK = 667;

    /**
     * Exit signal for an orphaned task.
     */
    public static final int ORPANED_TASK = 668;

    /**
     * Task was manually killed
     */
    public static final int MANUAL_KILL = 669;

    /**
     * Task was manually retried
     */
    public static final int MANUAL_RETRY = 670;

    /**
     * The node went down.
     */
    public static final int NODE_DOWN = 671;

}

package com.breakersoft.plow;

public class Signal {

    /**
     * Exit signal for an aborted dispatch.
     */
    public static final int NORMAL = 0;

    /**
     * Exit signal when a node is shutdown.
     */
    public static final int NODE_SHUTDOWN = 86;

    /**
     * Exit signal for an aborted dispatch.
     */
    public static final int ABORTED_TASK = 667;

    /**
     * Exit signal for an orphaned task.
     */
    public static final int ORPANED_TASK = 668;

    /**
     * Task was manually killed
     */
    public static final int MANUAL_KILL = 669;

    /**
     * Task was manually retried
     */
    public static final int MANUAL_RETRY = 670;

    /**
     * The node went down.
     */
    public static final int NODE_DOWN = 671;

}

Add signal for shutdown procs


package io.prometheus.cloudwatch;

import io.prometheus.client.exporter.MetricsServlet;
import java.io.FileReader;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;

public class WebServer {
   public static void main(String[] args) throws Exception {
     if (args.length < 2) {
       System.err.println("Usage: WebServer <port> <json configuration file>");
       System.exit(1);
     }
     CloudWatchCollector cc = new CloudWatchCollector(new FileReader(args[1])).register();

     int port = Integer.parseInt(args[0]);
     Server server = new Server(port);
     ServletContextHandler context = new ServletContextHandler();
     context.setContextPath("/");
     server.setHandler(context);
     context.addServlet(new ServletHolder(new MetricsServlet()), "/metrics");
     context.addServlet(new ServletHolder(new HomePageServlet()), "/");
     server.start();
     server.join();
   }
}

package io.prometheus.cloudwatch;

import io.prometheus.client.exporter.MetricsServlet;
import java.io.FileReader;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;

public class WebServer {
   public static void main(String[] args) throws Exception {
     if (args.length < 2) {
       System.err.println("Usage: WebServer <port> <yml configuration file>");
       System.exit(1);
     }
     CloudWatchCollector cc = new CloudWatchCollector(new FileReader(args[1])).register();

     int port = Integer.parseInt(args[0]);
     Server server = new Server(port);
     ServletContextHandler context = new ServletContextHandler();
     context.setContextPath("/");
     server.setHandler(context);
     context.addServlet(new ServletHolder(new MetricsServlet()), "/metrics");
     context.addServlet(new ServletHolder(new HomePageServlet()), "/");
     server.start();
     server.join();
   }
}

Update error message to yml


package info.agrueneberg.fhir.filters;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component;

@Component
public class CorsFilter implements Filter {

    @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
        HttpServletResponse response = (HttpServletResponse) res;
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PUT, DELETE");
        response.setHeader("Access-Control-Max-Age", "3600");
        response.setHeader("Access-Control-Allow-Headers", "x-requested-with");
        chain.doFilter(req, res);
    }

    @Override
    public void init(FilterConfig filterConfig) {
    }

    @Override
    public void destroy() {
    }

}

package info.agrueneberg.fhir.filters;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component;

@Component
public class CorsFilter implements Filter {

    @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
        HttpServletResponse response = (HttpServletResponse) res;
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PUT, DELETE");
        response.setHeader("Access-Control-Allow-Headers", "x-requested-with, content-type");
        response.setHeader("Access-Control-Max-Age", "3600");
        chain.doFilter(req, res);
    }

    @Override
    public void init(FilterConfig filterConfig) {
    }

    @Override
    public void destroy() {
    }

}

Allow Content-Type header in CORS.


package toothpick;

import toothpick.registries.memberinjector.MemberInjectorRegistryLocator;

/**
 * Default implementation of an injector.
 */
public final class InjectorImpl implements Injector {
  /**
   * {@inheritDoc}
   *
   *

   * ⚠ Warning ⚠ : This implementation needs a proper setup of {@link toothpick.registries.MemberInjectorRegistry} instances
   * at the annotation processor level. We will bubble up the hierarchy, starting at class {@code T}. As soon
   * as a {@link MemberInjector} is found, we use it to inject the members of {@code obj}. If registries are not find then
   * you will observe strange behaviors at runtime : only members defined in super class will be injected.
   *

   */
  @Override
  public <T> void inject(T obj, Scope scope) {
    Class<? super T> currentClass = (Class<T>) obj.getClass();
    do {
      MemberInjector<? super T> memberInjector = MemberInjectorRegistryLocator.getMemberInjector(currentClass);
      if (memberInjector != null) {
        memberInjector.inject(obj, scope);
        return;
      } else {
        currentClass = currentClass.getSuperclass();
      }
    } while (currentClass != null);
  }
}

package toothpick;

import toothpick.registries.memberinjector.MemberInjectorRegistryLocator;

/**
 * Default implementation of an injector.
 */
public final class InjectorImpl implements Injector {
  /**
   * {@inheritDoc}
   *
   *

   * ⚠ Warning ⚠ : This implementation needs a proper setup of {@link toothpick.registries.MemberInjectorRegistry} instances
   * at the annotation processor level. We will bubble up the hierarchy, starting at class {@code T}. As soon
   * as a {@link MemberInjector} is found, we use it to inject the members of {@code obj}. If registries are not find then
   * you will observe strange behaviors at runtime : only members defined in super class will be injected.
   *

   */
  @Override
  public <T> void inject(T obj, Scope scope) {
    Class<? super T> currentClass = (Class<T>) obj.getClass();
    do {
      MemberInjector<? super T> memberInjector = MemberInjectorRegistryLocator.getMemberInjector(currentClass);
      if (memberInjector != null) {
        memberInjector.inject(obj, scope);
        return;
      } else {
        currentClass = currentClass.getSuperclass();
      }
    } while (currentClass != null);
    throw new RuntimeException(String.format("Object %s of class %s could not be injected. Make sure all registries are setup properly.", obj,
        obj != null ? obj.getClass() : "(N/A)"));
  }
}

Make inject throw an exception if no injection took place.


package ceylon.language;

import com.redhat.ceylon.common.Versions;
import com.redhat.ceylon.compiler.java.metadata.Ceylon;
import com.redhat.ceylon.compiler.java.metadata.Object;

@Ceylon(major = 3) @Object
public final class language_ {

    public java.lang.String getVersion() {
        return Versions.CEYLON_VERSION_NUMBER;
    }

    public long getMajorVersion() {
        return Versions.CEYLON_VERSION_MAJOR;
    }

    public long getMinorVersion() {
        return Versions.CEYLON_VERSION_MINOR;
    }

    public long getReleaseVersion() {
        return Versions.CEYLON_VERSION_RELEASE;
    }

    public java.lang.String getVersionName() {
        return Versions.CEYLON_VERSION_NAME;
    }

    public long getMajorVersionBinary() {
        return Versions.JVM_BINARY_MAJOR_VERSION;
    }

    public long getMinorVersionBinary() {
        return Versions.JVM_BINARY_MINOR_VERSION;
    }

    @Override
    public java.lang.String toString() {
    	return "language";
    }

    private language_() {}
    private static final language_ value = new language_();

    public static language_ getLanguage() {
        return value;
    }
}

package ceylon.language;

import com.redhat.ceylon.common.Versions;
import com.redhat.ceylon.compiler.java.metadata.Ceylon;
import com.redhat.ceylon.compiler.java.metadata.Object;

@Ceylon(major = 3) @Object
public final class language_ {

    public java.lang.String getVersion() {
        return Versions.CEYLON_VERSION_NUMBER;
    }

    public long getMajorVersion() {
        return Versions.CEYLON_VERSION_MAJOR;
    }

    public long getMinorVersion() {
        return Versions.CEYLON_VERSION_MINOR;
    }

    public long getReleaseVersion() {
        return Versions.CEYLON_VERSION_RELEASE;
    }

    public java.lang.String getVersionName() {
        return Versions.CEYLON_VERSION_NAME;
    }

    public long getMajorVersionBinary() {
        return Versions.JVM_BINARY_MAJOR_VERSION;
    }

    public long getMinorVersionBinary() {
        return Versions.JVM_BINARY_MINOR_VERSION;
    }

    @Override
    public java.lang.String toString() {
    	return "language";
    }

    private language_() {}
    private static final language_ value = new language_();

    public static language_ getLanguage$() {
        return value;
    }
}

Fix the language object (wasn't available before)


package seedu.geekeep.ui;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import seedu.geekeep.model.task.ReadOnlyTask;

public class TaskCard extends UiPart<Region> {

    private static final String FXML = "PersonListCard.fxml";

    @FXML
    private HBox cardPane;
    @FXML
    private Label name;
    @FXML
    private Label id;
    @FXML
    private Label phone;
    @FXML
    private Label address;
    @FXML
    private Label email;
    @FXML
    private FlowPane tags;

    public TaskCard(ReadOnlyTask person, int displayedIndex) {
        super(FXML);
        name.setText(person.getTitle().fullTitle);
        id.setText(displayedIndex + ". ");
        phone.setText(person.getEndDateTime().value);
        address.setText(person.getLocation().value);
        email.setText(person.getStartDateTime().value);
        initTags(person);
    }

    private void initTags(ReadOnlyTask person) {
        person.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
    }
}

package seedu.geekeep.ui;

import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import seedu.geekeep.model.task.ReadOnlyTask;

public class TaskCard extends UiPart<Region> {

    private static final String FXML = "PersonListCard.fxml";

    @FXML
    private HBox cardPane;
    @FXML
    private Label name;
    @FXML
    private Label id;
    @FXML
    private Label phone;
    @FXML
    private Label address;
    @FXML
    private Label email;
    @FXML
    private FlowPane tags;

    public TaskCard(ReadOnlyTask person, int displayedIndex) {
        super(FXML);
        name.setText(person.getTitle().fullTitle);
        id.setText("#" + displayedIndex + " ");

        if (person.getEndDateTime() != null && person.getStartDateTime() != null) {
            phone.setText(person.getStartDateTime() + " until " + person.getEndDateTime());
        } else if (person.getEndDateTime() != null && person.getStartDateTime() == null) {
            phone.setText(person.getEndDateTime().value);
        } else {
            phone.setText(null);
        }

        if (person.getLocation() == null) {
            address.setText("");
        } else {
            address.setText(person.getLocation().value);
        }

        initTags(person);
    }

    private void initTags(ReadOnlyTask person) {
        person.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));
    }
}

Update display of task card


/*
 * Copyright (C) 2014 Pedro Vicente Gomez Sanchez.
 *
 * 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.github.pedrovgs.sample;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;

public class MainActivity extends ActionBarActivity {

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

/*
 * Copyright (C) 2015 Pedro Vicente Gomez Sanchez.
 *
 * 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.github.pedrovgs.sample;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;

public class MainActivity extends ActionBarActivity {

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

Change copyright to use 2015 version


package de.retest.recheck.ui.descriptors;

import java.io.Serializable;

import javax.xml.bind.annotation.XmlRootElement;

import de.retest.recheck.util.StringSimilarity;

@XmlRootElement
public class TextAttribute extends StringAttribute {

	private static final long serialVersionUID = 1L;

	// Used by JaxB
	protected TextAttribute() {}

	public TextAttribute( final String key, final String value ) {
		this( key, value, null );
	}

	public TextAttribute( final String key, final String value, final String variableName ) {
		super( key, value != null ? value.trim() : null, variableName );
	}

	@Override
	public double match( final Attribute other ) {
		if ( !(other instanceof TextAttribute) ) {
			return NO_MATCH;
		}
		assert other.getKey().equals( getKey() );
		return StringSimilarity.textSimilarity( getValue(), ((StringAttribute) other).getValue() );
	}

	@Override
	public Attribute applyChanges( final Serializable actual ) {
		return new TextAttribute( getKey(), (String) actual, getVariableName() );
	}

	@Override
	public ParameterizedAttribute applyVariableChange( final String variableName ) {
		return new TextAttribute( getKey(), getValue(), variableName );
	}
}

package de.retest.recheck.ui.descriptors;

import java.io.Serializable;

import javax.xml.bind.annotation.XmlRootElement;

import de.retest.recheck.util.StringSimilarity;

@XmlRootElement
public class TextAttribute extends StringAttribute {

	private static final long serialVersionUID = 1L;

	// Used by JaxB
	protected TextAttribute() {}

	public TextAttribute( final String key, final String value ) {
		this( key, value, null );
	}

	public TextAttribute( final String key, final String value, final String variableName ) {
		super( key, value, variableName );
	}

	@Override
	public double match( final Attribute other ) {
		if ( !(other instanceof TextAttribute) ) {
			return NO_MATCH;
		}
		assert other.getKey().equals( getKey() );
		return StringSimilarity.textSimilarity( getValue(), ((StringAttribute) other).getValue() );
	}

	@Override
	public Attribute applyChanges( final Serializable actual ) {
		return new TextAttribute( getKey(), (String) actual, getVariableName() );
	}

	@Override
	public ParameterizedAttribute applyVariableChange( final String variableName ) {
		return new TextAttribute( getKey(), getValue(), variableName );
	}
}

Fix value should be given formatted


package ru.stqa.pft.sandbox;

import org.testng.Assert;
import org.testng.annotations.Test;

public class EquationTests {

  @Test
  public void test0() {
    Equation e = new Equation(1,1,1);
//    Assert.assertEquals(e.rootNumber(), 0);
    Assert.assertEquals(e.rootNumber(), 1);
  }

  @Test
  public void test1() {
    Equation e = new Equation(1,2,1);
    Assert.assertEquals(e.rootNumber(), 1);
  }

  @Test
  public void test3() {
    Equation e = new Equation(1,5,6);
    Assert.assertEquals(e.rootNumber(), 2);
  }

  @Test
  public void testLinear() {
    Equation e = new Equation(0,1,1);
    Assert.assertEquals(e.rootNumber(), 1);
  }

  @Test
  public void testConstant() {
    Equation e = new Equation(0,0,1);
    Assert.assertEquals(e.rootNumber(), 0);
  }

  @Test
  public void testZero() {
    Equation e = new Equation(0,0,0);
    Assert.assertEquals(e.rootNumber(), -1);
  }

}

package ru.stqa.pft.sandbox;

import org.testng.Assert;
import org.testng.annotations.Test;

public class EquationTests {

  @Test
  public void test0() {
    Equation e = new Equation(1,1,1);
    Assert.assertEquals(e.rootNumber(), 0);
  }

  @Test
  public void test1() {
    Equation e = new Equation(1,2,1);
    Assert.assertEquals(e.rootNumber(), 1);
  }

  @Test
  public void test3() {
    Equation e = new Equation(1,5,6);
    Assert.assertEquals(e.rootNumber(), 2);
  }

  @Test
  public void testLinear() {
    Equation e = new Equation(0,1,1);
    Assert.assertEquals(e.rootNumber(), 1);
  }

  @Test
  public void testConstant() {
    Equation e = new Equation(0,0,1);
    Assert.assertEquals(e.rootNumber(), 0);
  }

  @Test
  public void testZero() {
    Equation e = new Equation(0,0,0);
    Assert.assertEquals(e.rootNumber(), -1);
  }

}

Revert "Испорчен тест для проверки Jenkins"


package am;

import am.app.Core;
import am.batchMode.TrackDispatcher;
import am.userInterface.UI;

/**
 * Main class -
 *
 * This class creates an instance of UI class
 *
 * @author ADVIS Research Laboratory
 * @version 11/27/2004
 */
public class Main
{

	/*******************************************************************************************/
	/**
	 * This is the main function
	 * It creates a new instance of UI class
	 *
	 * @param  args array of strings
	 */
	public static void main(String args[])
	{
		if(args.length == 0 ){
			//UI ui;
			UI ui = new UI();
			Core.getInstance().setUI(ui);
		}
		else{
			String track = args[0];
			String subTrack = "";
			if(args.length > 1){
				subTrack = args[1];
			}
			TrackDispatcher.dispatchTrack(track, subTrack);
		}
	}
}

/**    ________________________________________
 * ___/ Copyright Notice / Warranty Disclaimer \________________
 *
 * @copyright { Copyright (c) 2010
 * Advances in Information Systems Laboratory at the
 * University of Illinois at Chicago
 * All Rights Reserved. }
 *
 * @disclaimer {
 * This work is distributed WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. }
 *
 *     _____________________
 * ___/ Authors / Changelog \___________________________________
 *
 *
 */

package am;

import javax.swing.SwingUtilities;

import am.app.Core;
import am.batchMode.TrackDispatcher;
import am.userInterface.UI;

/**
 * Main class -
 *
 * This class creates an instance of UI class
 *
 * @author ADVIS Research Laboratory
 * @version 11/27/2004
 */
public class Main
{
	/**
	 * This is the application entry point.
	 * It creates instantiates.
	 *
	 * @param args Command line arguments, used for operating AgreementMaker in automatic mode, without a UI.
	 */
	public static void main(String args[])
	{
		if(args.length == 0 ){
			// Proper way of intializing the UI.
			// Reference: http://java.sun.com/developer/technicalArticles/javase/swingworker/ (Starting off on the Right Thread)
			SwingUtilities.invokeLater(
					new Runnable() {
						public void run() {
							Core.setUI( new UI() );
						}
					}
			);
		}
		else{
			String track = args[0];
			String subTrack = "";
			if(args.length > 1){
				subTrack = args[1];
			}
			TrackDispatcher.dispatchTrack(track, subTrack);
		}
	}
}

Initialize the UI in the Event Dispatching Thread.


package fi.helsinki.cs.tmc.cli.command;

import fi.helsinki.cs.tmc.cli.Application;
import java.util.HashMap;
import java.util.Map;

/**
 * Class creates a map for commands.
 */
public class CommandMap {

    private Map<String, Command> commands;

    /**
     * Constructor.
     */
    public CommandMap(Application app) {
        this.commands = new HashMap<>();
        createCommand(new TestCommand(app));
        createCommand(new HelpCommand(app));
    }

    private void createCommand(Command command) {
        this.commands.put(command.getName(), command);
    }

    /**
     * Get command by default name.
     * @param name
     * @return Command
     */
    public Command getCommand(String name) {
        return commands.get(name);
    }

    public Map<String, Command> getCommands() {
        return this.commands;
    }
}

Fix style error at command map imports.


/**
 * Copyright 2010 The ForPlay 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 forplay.core;

/**
 * Generic platform interface. New platforms are defined as implementations of this interface.
 */
public interface Platform {

  Audio audio();

  Graphics graphics();

  AssetManager assetManager();

  Json json();

  Keyboard keyboard();

  Log log();

  Net net();

  Pointer pointer();

  /**
   * Return the mouse if it is supported, or null otherwise.
   *
   * @return the mouse if it is supported, or null otherwise.
   */
  Mouse mouse();

  Storage storage();

  Analytics analytics();

  float random();

  void run(Game game);

  double time();

  RegularExpression regularExpression();

  void openURL(String url);
}

/**
 * Copyright 2010 The ForPlay 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 forplay.core;

/**
 * Generic platform interface. New platforms are defined as implementations of this interface.
 */
public interface Platform {

  Audio audio();

  Graphics graphics();

  AssetManager assetManager();

  Json json();

  Keyboard keyboard();

  Log log();

  Net net();

  Pointer pointer();

  Mouse mouse();

  Storage storage();

  Analytics analytics();

  float random();

  void run(Game game);

  double time();

  RegularExpression regularExpression();

  void openURL(String url);
}

Remove useless comment about returning a null mouse. Access mouse through ForPlay.mouse().


public class CountingSort {
	public static int[] countingSort(int[] unsorted) {
		int maxValue = max(unsorted);

		// Count occurrences of each value in unsorted
		int[] counts = new int[maxValue + 1];

		for(int value : unsorted)
			counts[value]++;

		for(int i = 1; i < counts.length; i++)
			counts[i] += counts[i - 1];

		// Reorder values in unsorted
		int[] sorted = new int[unsorted.length];
		for(int value : unsorted) {
			counts[value] -= 1;
			int index = counts[value];
			sorted[index] = value;
		}

		return sorted;
	}

	private static int max(int[] array) {
		int max = Integer.MIN_VALUE;

		for(int value : array) {
			if(value > max) max = value;
		}

		return max;
	}

	public static void main(String[] args) {
		int[] unsorted = {5, 5, 5, 4, 3, 2, 1, 0};
		int[] sorted = countingSort(unsorted);
		for(int value : sorted)
			System.out.println(value);
	}
}

public class CountingSort {
	public static int[] countingSort(int[] unsorted) {
		int minValue = min(unsorted);
		int maxValue = max(unsorted);

		// Adjust max so that min equals zero
		int offset = -minValue;
		int adjustedMax = maxValue + offset;

		// Count occurrences of each value in unsorted
		int[] counts = new int[adjustedMax + 1];

		for(int value : unsorted)
			counts[value + offset]++;

		for(int i = 1; i < counts.length; i++)
			counts[i] += counts[i - 1];

		// Reorder values in unsorted
		int[] sorted = new int[unsorted.length];
		for(int value : unsorted) {
			int index = --counts[value + offset];
			sorted[index] = value;
		}

		return sorted;
	}

	private static int min(int[] array) {
		int min = Integer.MAX_VALUE;

		for(int value : array)
			if(value < min) min = value;

		return min;
	}

	private static int max(int[] array) {
		int max = Integer.MIN_VALUE;

		for(int value : array)
			if(value > max) max = value;

		return max;
	}

	public static void main(String[] args) {
		int[] unsorted = {5, 5, 5, 4, 3, 2, 1, 0, -1, -2, -3, -3, -3};
		int[] sorted = countingSort(unsorted);
		for(int value : sorted)
			System.out.println(value);
	}
}

Allow counting sort to handle negative numbers


/*
 * Copyright (C) 2004 - 2014 Brian McCallister
 *
 * 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.skife.jdbi.v2.exceptions;

public class UnableToCreateSqlObjectException extends DBIException {

    public UnableToCreateSqlObjectException(String message) {
        super(message);
    }
}

Add license header to please Findbugs


package net.doepner.brikpiks;

/**
 * Application entry point
 */
public final class Main {

    public static void main(String[] args) {
        System.out.println("Brik Piks");

        // TODO : Get started by reviewing
        // http://stackoverflow.com/questions/15777821/how-can-i-pixelate-a-jpg-with-java
    }

}

package net.doepner.brikpiks;

/**
 * Application entry point
 */
public final class Main {

    public static void main(String[] args) {
        System.out.println("Brik Piks");

        // TODO : Get started by reviewing
        // http://stackoverflow.com/questions/15777821/how-can-i-pixelate-a-jpg-with-java
        // http://stackoverflow.com/questions/25761438/understanding-bufferedimage-getrgb-output-values
        // http://stackoverflow.com/questions/28162488/get-average-color-on-bufferedimage-and-bufferedimage-portion-as-fast-as-possible
    }

}

Add a pointer to some code examples


package lejos.hardware.sensor;
import lejos.hardware.port.UARTPort;
import lejos.robotics.RangeFinder;

/**
 * Basic sensor driver for the Lego EV3 Ultrasonic sensor.<br>
 * TODO: Need to implement other modes. Consider implementing other methods
 * to allow this device to be used in place of the NXT device (getDistance) etc.
 * @author andy
 *
 */
public class EV3UltrasonicSensor extends UARTSensor implements RangeFinder
{

    /**
     * Create the sensor class. The sensor will be set to return measurements in CM.
     * @param port
     */
    public EV3UltrasonicSensor(UARTPort port)
    {
        super(port);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public float getRange()
    {
        return (float)port.getShort()/10.0f;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public float[] getRanges()
    {
        // TODO Work out how to use other modes, maybe change this
        float [] result = new float[1];
        result[0] = getRange();
        return result;
    }

}

package lejos.hardware.sensor;
import lejos.hardware.port.Port;
import lejos.hardware.port.UARTPort;
import lejos.robotics.RangeFinder;

/**
 * Basic sensor driver for the Lego EV3 Ultrasonic sensor.<br>
 * TODO: Need to implement other modes. Consider implementing other methods
 * to allow this device to be used in place of the NXT device (getDistance) etc.
 * @author andy
 *
 */
public class EV3UltrasonicSensor extends UARTSensor implements RangeFinder
{

    /**
     * Create the sensor class. The sensor will be set to return measurements in CM.
     * @param port
     */
    public EV3UltrasonicSensor(UARTPort port)
    {
        super(port);
    }

    /**
     * Create the sensor class. The sensor will be set to return measurements in CM.
     * @param port
     */
    public EV3UltrasonicSensor(Port port)
    {
        super(port);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public float getRange()
    {
        return (float)port.getShort()/10.0f;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public float[] getRanges()
    {
        // TODO Work out how to use other modes, maybe change this
        float [] result = new float[1];
        result[0] = getRange();
        return result;
    }

}

Convert to use new port mechanism


package org.example.app;

import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;

import java.util.Map;
import java.util.UUID;

public class PersonCache {
    private IMap<String, UUID> map;
    private HazelcastInstance instance;

    public PersonCache () {
        ClientConfig cfg = new ClientConfig();
        cfg.addAddress("hazelcast:5701");
        this.instance = HazelcastClient.newHazelcastClient(cfg);
        this.map = instance.getMap("person");
        this.map.put("Anonymous", new UUID(0, 0));
    }

    public boolean cachePerson (String name, UUID id) {
        System.out.println("Put " + name + ":" + id.toString() + "to cache");
        return this.map.putIfAbsent(name, id) == null;
    }

    public void forgetPerson (String name) {
        System.out.println("Removing " + name + " from cache");
        this.map.removeAsync(name);
    }
}

package org.example.app;

import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;

import java.util.Map;
import java.util.UUID;

public class PersonCache {
    private IMap<String, UUID> map;
    private HazelcastInstance instance;

    public PersonCache () {
        ClientConfig cfg = new ClientConfig();
        cfg.addAddress("hazelcast:5701");
        cfg.getGroupConfig().setName( "app1" ).setPassword( "app1-pass" );
        this.instance = HazelcastClient.newHazelcastClient(cfg);
        this.map = instance.getMap("person");
        this.map.put("Anonymous", new UUID(0, 0));
    }

    public boolean cachePerson (String name, UUID id) {
        System.out.println("Put " + name + ":" + id.toString() + "to cache");
        return this.map.putIfAbsent(name, id) == null;
    }

    public void forgetPerson (String name) {
        System.out.println("Removing " + name + " from cache");
        this.map.removeAsync(name);
    }
}

Set app group and password


package org.jboss.wolf.validator.filter;

import org.jboss.wolf.validator.impl.DependencyNotFoundException;
import org.jboss.wolf.validator.impl.bom.BomDependencyNotFoundException;

public class BomDependencyNotFoundExceptionFilter extends DependencyNotFoundExceptionFilter {

    public BomDependencyNotFoundExceptionFilter(String missingArtifactRegex, String validatedArtifactRegex) {
        super(missingArtifactRegex, validatedArtifactRegex);
    }

    public BomDependencyNotFoundExceptionFilter(String missingArtifactRegex) {
        super(missingArtifactRegex, null);
    }

    @Override
    protected Class<? extends DependencyNotFoundException> getExceptionType() {
        return BomDependencyNotFoundException.class;
    }

    @Override
    public String toString() {
        return "BomDependencyNotFoundExceptionFilter{" +
                "missingArtifactRegex=" + getMissingArtifactRegex() +
                ", validatedArtifactRegex=" + getMissingArtifactRegex() +
                '}';
    }

}

package org.jboss.wolf.validator.filter;

import org.jboss.wolf.validator.impl.DependencyNotFoundException;
import org.jboss.wolf.validator.impl.bom.BomDependencyNotFoundException;

public class BomDependencyNotFoundExceptionFilter extends DependencyNotFoundExceptionFilter {

    public BomDependencyNotFoundExceptionFilter(String missingArtifactRegex, String validatedArtifactRegex) {
        super(missingArtifactRegex, validatedArtifactRegex);
    }

    public BomDependencyNotFoundExceptionFilter(String missingArtifactRegex) {
        super(missingArtifactRegex, null);
    }

    @Override
    protected Class<? extends DependencyNotFoundException> getExceptionType() {
        return BomDependencyNotFoundException.class;
    }

    @Override
    public String toString() {
        return "BomDependencyNotFoundExceptionFilter{" +
                "missingArtifactRegex=" + getMissingArtifactRegex() +
                ", validatedArtifactRegex=" + getValidatedArtifactRegex() +
                '}';
    }

}

Return correct artifact regex in toString()


package com.thaiopensource.relaxng;

import org.xml.sax.Locator;
import com.thaiopensource.datatype.Datatype;

class ValuePattern extends SimplePattern {
  String str;
  Datatype dt;

  ValuePattern(Datatype dt, String str, Locator locator) {
    super(combineHashCode(VALUE_HASH_CODE, str.hashCode()), locator);
    this.str = str;
  }

  boolean matches(Atom a) {
    return a.matchesDatatypeValue(dt, str);
  }

  boolean samePattern(Pattern other) {
    if (getClass() != other.getClass())
      return false;
    return (dt.equals(((ValuePattern)other).dt)
	    && str.equals(((ValuePattern)other).str));
  }

  void accept(PatternVisitor visitor) {
    visitor.visitValue(dt, str);
  }
}

package com.thaiopensource.relaxng;

import org.xml.sax.Locator;
import com.thaiopensource.datatype.Datatype;

class ValuePattern extends SimplePattern {
  String str;
  Datatype dt;

  ValuePattern(Datatype dt, String str, Locator locator) {
    super(combineHashCode(VALUE_HASH_CODE, str.hashCode()), locator);
    this.dt = dt;
    this.str = str;
  }

  boolean matches(Atom a) {
    return a.matchesDatatypeValue(dt, str);
  }

  boolean samePattern(Pattern other) {
    if (getClass() != other.getClass())
      return false;
    if (!(other instanceof ValuePattern))
      return false;
    return (dt.equals(((ValuePattern)other).dt)
	    && str.equals(((ValuePattern)other).str));
  }

  void accept(PatternVisitor visitor) {
    visitor.visitValue(dt, str);
  }
}

Fix a couple of bugs.


package uk.org.mygrid.cagrid.servicewrapper.service.interproscan.invoker;

import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.interproscan.DummyInterProScanInvoker;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.interproscan.InterProScanInvoker;

public class InvokerFactory {
	private static InterProScanInvoker invoker;

	public static InterProScanInvoker getInvoker() {
		if (invoker == null) {
			synchronized (InvokerFactory.class) {
				if (invoker == null) {
					invoker = new DummyInterProScanInvoker();
					//invoker = new InterProScanInvoker();
				}
			}
		}
		return invoker;
	}
}

package uk.org.mygrid.cagrid.servicewrapper.service.interproscan.invoker;

import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.InvokerException;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.interproscan.InterProScanInvoker;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.interproscan.InterProScanInvokerImpl;

public class InvokerFactory {
	private static InterProScanInvoker invoker;

	public static InterProScanInvoker getInvoker() {
		if (invoker == null) {
			synchronized (InvokerFactory.class) {
				if (invoker == null) {
					//invoker = new DummyInterProScanInvoker();
					try {
						invoker = new InterProScanInvokerImpl();
					} catch (InvokerException e) {
						throw new RuntimeException("Can't instantiate InterProScan invoker", e);
					}
				}
			}
		}
		return invoker;
	}
}

Use real invoker by default


/* Generated By:JJTree: Do not edit this line. ASTText.java */

package org.apache.velocity.runtime.parser.node;

import java.io.Writer;
import java.io.IOException;

import org.apache.velocity.Context;
import org.apache.velocity.runtime.parser.*;

public class ASTText extends SimpleNode
{
    private String text;

    public ASTText(int id)
    {
        super(id);
    }

    public ASTText(Parser p, int id)
    {
        super(p, id);
    }

    /** Accept the visitor. **/
    public Object jjtAccept(ParserVisitor visitor, Object data)
    {
        return visitor.visit(this, data);
    }

    public Object init(Context context, Object data) throws Exception
    {
        // text = NodeUtils.specialText(getFirstToken()) +
        //    getFirstToken().image;

        /*
         *  there is only one special case we care about now : if the specialToken leads with a $
         *  Everything else seems to be working right now
         */

        text =  getFirstToken().image;

        if (NodeUtils.specialText(getFirstToken()).startsWith("$") )
            text = "$" + text;

        return data;
    }

    public boolean render(Context context, Writer writer)
        throws IOException
    {
        writer.write(text);
        return true;
    }
}

/* Generated By:JJTree: Do not edit this line. ASTText.java */

package org.apache.velocity.runtime.parser.node;

import java.io.Writer;
import java.io.IOException;

import org.apache.velocity.Context;
import org.apache.velocity.runtime.parser.*;

public class ASTText extends SimpleNode
{
    private String text;

    public ASTText(int id)
    {
        super(id);
    }

    public ASTText(Parser p, int id)
    {
        super(p, id);
    }

    /** Accept the visitor. **/
    public Object jjtAccept(ParserVisitor visitor, Object data)
    {
        return visitor.visit(this, data);
    }

    public Object init(Context context, Object data) throws Exception
    {
        // text = NodeUtils.specialText(getFirstToken()) +
        //    getFirstToken().image;

        /*
         *  there is only one special case we care about now : if the specialToken leads with a $
         *  Everything else seems to be working right now
         */

        text =  getFirstToken().image;

        if (NodeUtils.specialText(getFirstToken()).startsWith("$"))
            text = "$" + text;
        else if ( NodeUtils.specialText(getFirstToken()).startsWith("#") )
            text = "#" + text;

        return data;
    }

    public boolean render(Context context, Writer writer)
        throws IOException
    {
        writer.write(text);
        return true;
    }
}

Support for symmetrization of DIRECTIVE and REFERENCE. See the 1.20 Parser.jjt


import httpserver.RequestSender;
import httpserver.WebServer;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class Controller {
    public TextField command;
    @FXML
    public TextArea results;

    public void runCommand(ActionEvent actionEvent) {
        WebServer ws = new WebServer();
        ws.setResults(results);
        String commandString = command.getText();
        RequestSender.sendRequest("http://localhost:8000/job", "13", commandString, "http://localhost:8008/jobFinished");
    }

}

import httpserver.RequestSender;
import httpserver.WebServer;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class Controller {
    private WebServer ws = new WebServer();
    public TextField command;
    @FXML
    public TextArea results;

    public void runCommand(ActionEvent actionEvent) {
        ws.setResults(results);
        String commandString = command.getText();
        RequestSender.sendRequest("http://localhost:8000/job", "13", commandString, "http://localhost:8008/jobFinished");
    }

}

Correct multiple instantiation of server problem.


package fi.helsinki.cs.tmc.cli.command;

import fi.helsinki.cs.tmc.cli.Application;

public class HelpCommand implements Command {
    private CommandMap commands;

    public HelpCommand(Application app) {
        this.commands = app.getCommandMap();
    }

    @Override
    public String getDescription() {
        return "Lists every command";
    }

    @Override
    public String getName() {
        return "help";
    }

    @Override
    public void run(String[] args) {
        System.out.println("TMC commands:");
        for (Command command : this.commands.getCommands().values()) {
            System.out.println("  " + command.getName() + "\t" + command.getDescription());
        }
    }
}

package fi.helsinki.cs.tmc.cli.command;

import fi.helsinki.cs.tmc.cli.Application;

public class HelpCommand implements Command {
    private Application app;
    private CommandMap commands;

    public HelpCommand(Application app) {
        this.app = app;
        this.commands = app.getCommandMap();
    }

    @Override
    public String getDescription() {
        return "Lists every command";
    }

    @Override
    public String getName() {
        return "help";
    }

    @Override
    public void run(String[] args) {
        System.out.println("Usage: tmc-cli [args] COMMAND [command-args]");
        System.out.println("");
        System.out.println("TMC commands:");
        for (Command command : this.commands.getCommands().values()) {
            System.out.println("  " + command.getName() + "\t" + command.getDescription());
        }
        System.out.println("");
        app.printHelp();
    }
}

Print the cmd arguments to help message.


package seedu.emeraldo.logic.commands;

import seedu.emeraldo.model.Emeraldo;

/**
 * Clears the address book.
 */
public class ClearCommand extends Command {

    public static final String COMMAND_WORD = "clear";
    public static final String MESSAGE_SUCCESS = "Address book has been cleared!";

    public ClearCommand() {}

    @Override
    public CommandResult execute() {
        assert model != null;
        model.resetData(Emeraldo.getEmptyEmeraldo());
        return new CommandResult(MESSAGE_SUCCESS);
    }
}

package seedu.emeraldo.logic.commands;

import seedu.emeraldo.model.Emeraldo;

/**
 * Clears the address book.
 */
public class ClearCommand extends Command {

    public static final String COMMAND_WORD = "clear";
    public static final String MESSAGE_SUCCESS = "Emeraldo has been cleared!";

    public ClearCommand() {}

    @Override
    public CommandResult execute() {
        assert model != null;
        model.resetData(Emeraldo.getEmptyEmeraldo());
        return new CommandResult(MESSAGE_SUCCESS);
    }
}

Change Address book to Emeraldo


package com.topsy.jmxproxy.resource;

import com.topsy.jmxproxy.service.JMXConnectionManager;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.apache.log4j.Logger;

import org.springframework.stereotype.Service;

import com.sun.jersey.api.core.InjectParam;

@Service
@Path("/")
public class JMXProxyResource {
    private static Logger LOG = Logger.getLogger(JMXProxyResource.class);

    @InjectParam
    private static JMXConnectionManager manager;

    @GET
    @Path("/{host}:{port:\\d+}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getJMXDataJSON(@PathParam("host") String host, @PathParam("port") int port) {
        LOG.debug("request jmx domains as json for " + host + ":" + port);

        try {
            return Response.ok(manager.getHost(host + ":" + port)).build();
        } catch (Exception e) {
            LOG.debug("failed parameters: " + host + ":" + port, e);
            return Response.status(Response.Status.NOT_FOUND).build();
        }
    }
}

package com.topsy.jmxproxy;

import com.topsy.jmxproxy.core.Host;
import com.topsy.jmxproxy.jmx.ConnectionManager;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.WebApplicationException;

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

@Path("/{host}:{port:\\d+}")
@Produces(MediaType.APPLICATION_JSON)
public class JMXProxyResource {
    private static final Logger LOG = LoggerFactory.getLogger(JMXProxyResource.class);

    private final ConnectionManager manager;

    public JMXProxyResource(ConnectionManager manager) {
        this.manager = manager;
    }

    @GET
    public Host getJMXHostData(@PathParam("host") String host, @PathParam("port") int port) {
        LOG.debug("fetching jmx data for " + host + ":" + port);

        try {
            return manager.getHost(host + ":" + port);
        } catch (Exception e) {
            LOG.debug("failed parameters: " + host + ":" + port, e);
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }
    }
}

Convert Resource to support dropwizard service.


package cafe.test;

import java.io.FileInputStream;
import java.io.IOException;

import cafe.image.meta.icc.ICCProfile;

public class TestICCProfile {

	public static void main(String[] args) throws IOException {
		FileInputStream fin = new FileInputStream(args[0]);
		ICCProfile icc_profile = new ICCProfile(fin);
		icc_profile.showHeader();
		icc_profile.showTagTable();
		fin.close();
	}
}

package cafe.test;

import java.io.FileInputStream;
import java.io.IOException;

import cafe.image.meta.icc.ICCProfile;

public class TestICCProfile {

	public static void main(String[] args) throws IOException {
		FileInputStream fin = new FileInputStream(args[0]);
		ICCProfile.showProfile(fin);
		fin.close();
	}
}

Change due to ICCProfile change


package biz.paluch.logcapture.common;

import java.util.Comparator;
import java.util.ServiceLoader;
import java.util.TreeSet;

/**
 * @author Mark Paluch
 */
public class Service {
    public static MessageCollectionFactory getFactory() {
        ServiceLoader<MessageCollectionFactory> loader = ServiceLoader.load(MessageCollectionFactory.class);

        TreeSet<MessageCollectionFactory> factories = new TreeSet<MessageCollectionFactory>(
                new Comparator<MessageCollectionFactory>() {
                    @Override
                    public int compare(MessageCollectionFactory o1, MessageCollectionFactory o2) {
                        if (o1.priority() > o2.priority()) {
                            return 1;
                        }
                        if (o1.priority() < o2.priority()) {
                            return -1;
                        }
                        return 0;
                    }
                });

        for (MessageCollectionFactory messageCollectionFactory : loader) {
            factories.add(messageCollectionFactory);
        }

        if (factories.isEmpty()) {
            throw new IllegalStateException("Cannot retrieve a " + MessageCollectionFactory.class.getName()
                    + ". Please add logcapture modules or create a service extension.");
        }
        return factories.first();
    }
}

package biz.paluch.logcapture.common;

import java.util.Comparator;
import java.util.ServiceLoader;
import java.util.TreeSet;

/**
 * @author Mark Paluch
 */
public class Service {
    public static MessageCollectionFactory getFactory() {
        ServiceLoader<MessageCollectionFactory> loader = ServiceLoader.load(MessageCollectionFactory.class);

        TreeSet<MessageCollectionFactory> factories = new TreeSet<MessageCollectionFactory>(
                new Comparator<MessageCollectionFactory>() {
                    @Override
                    public int compare(MessageCollectionFactory o1, MessageCollectionFactory o2) {
                        if (o1.priority() > o2.priority()) {
                            return -1;
                        }
                        if (o1.priority() < o2.priority()) {
                            return 1;
                        }
                        return 0;
                    }
                });

        for (MessageCollectionFactory messageCollectionFactory : loader) {
            factories.add(messageCollectionFactory);
        }

        if (factories.isEmpty()) {
            throw new IllegalStateException("Cannot retrieve a " + MessageCollectionFactory.class.getName()
                    + ". Please add logcapture modules or create a service extension.");
        }
        return factories.first();
    }
}

Use priority ordering low to high


package io.cozmic.usher.pipeline;

import de.odysseus.el.util.SimpleContext;
import io.cozmic.usher.core.MessageMatcher;
import io.cozmic.usher.message.PipelinePack;

import javax.el.ExpressionFactory;
import javax.el.ValueExpression;

/**
 * Created by chuck on 7/3/15.
 */
public class JuelMatcher implements MessageMatcher {

    private static ExpressionFactory factory = ExpressionFactory.newInstance();
    private SimpleContext context = new SimpleContext();
    private ValueExpression expression;

    public JuelMatcher(String expressionVal) {
        expression = factory.createValueExpression(context, expressionVal, boolean.class);
    }

    @Override
    public boolean matches(PipelinePack pipelinePack) {
        SimpleContext runtimeContext = new SimpleContext();
        final Object msg = pipelinePack.getMessage();
        factory.createValueExpression(runtimeContext, "${msgClassSimpleName}", String.class).setValue(runtimeContext, msg.getClass().getSimpleName());
        factory.createValueExpression(runtimeContext, "${msg}", msg.getClass()).setValue(runtimeContext, msg);
        return (boolean) expression.getValue(runtimeContext);
    }
}

package io.cozmic.usher.pipeline;

import de.odysseus.el.util.SimpleContext;
import io.cozmic.usher.core.MessageMatcher;
import io.cozmic.usher.message.PipelinePack;

import javax.el.ExpressionFactory;
import javax.el.ValueExpression;

/**
 * Created by chuck on 7/3/15.
 */
public class JuelMatcher implements MessageMatcher {

    private static ExpressionFactory factory = ExpressionFactory.newInstance();
    private SimpleContext context = new SimpleContext();
    private ValueExpression expression;

    public JuelMatcher(String expressionVal) {
        expression = factory.createValueExpression(context, expressionVal, boolean.class);
    }

    @Override
    public boolean matches(PipelinePack pipelinePack) {
        SimpleContext runtimeContext = new SimpleContext();
        final Object msg = pipelinePack.getMessage();
        if (msg != null) {
            factory.createValueExpression(runtimeContext, "${msgClassSimpleName}", String.class).setValue(runtimeContext, msg.getClass().getSimpleName());
            factory.createValueExpression(runtimeContext, "${msg}", msg.getClass()).setValue(runtimeContext, msg);
        }
        return (boolean) expression.getValue(runtimeContext);
    }
}

Fix messageMatcher in situations where message is null


package de.bmoth.typechecker;

import de.bmoth.parser.Parser;
import de.bmoth.parser.ast.TypeErrorException;
import org.junit.Test;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class TypeErrorExceptionTest {

    @Test(expected = TypeErrorException.class)
    public void testTypeErrorException() {
        String formula = "a = TRUE & b = 1 & a = b";
        Parser.getFormulaAsSemanticAst(formula);
    }

    @Test(expected = TypeErrorException.class)
    public void testTypeErrorException2() {
        String formula = "a = TRUE & a = 1 + 1";
        Parser.getFormulaAsSemanticAst(formula);
    }

    @Test
    public void testSetEnumeration() {
        String formula = "x = {1,2,(3,4)}";
        String exceptionMessage = getExceptionMessage(formula);
        assertTrue(exceptionMessage != null &&exceptionMessage.contains("Expected INTEGER but found INTEGER*INTEGER"));
    }

    @Test
    public void testSetEnumeration2() {
        String formula = "x = {1,2,{3,4}}";
        String exceptionMessage = getExceptionMessage(formula);
        assertTrue(exceptionMessage != null &&exceptionMessage.contains("found POW"));
    }

    private static String getExceptionMessage(String formula) {
        try {
            Parser.getFormulaAsSemanticAst(formula);
            fail("Expected a type error exception.");
            return "";
        } catch (TypeErrorException e) {
            return e.getMessage();
        }
    }
}

package de.bmoth.typechecker;

import de.bmoth.parser.Parser;
import de.bmoth.parser.ast.TypeErrorException;
import org.junit.Test;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class TypeErrorExceptionTest {

    @Test(expected = TypeErrorException.class)
    public void testTypeErrorException() {
        String formula = "a = TRUE & b = 1 & a = b";
        Parser.getFormulaAsSemanticAst(formula);
    }

    @Test(expected = TypeErrorException.class)
    public void testTypeErrorException2() {
        String formula = "a = TRUE & a = 1 + 1";
        Parser.getFormulaAsSemanticAst(formula);
    }

    @Test
    public void testSetEnumeration() {
        String formula = "x = {1,2,(3,4)}";
        String exceptionMessage = getExceptionMessage(formula);
        assertTrue(exceptionMessage.contains("Expected INTEGER but found INTEGER*INTEGER"));
    }

    @Test
    public void testSetEnumeration2() {
        String formula = "x = {1,2,{3,4}}";
        String exceptionMessage = getExceptionMessage(formula);
        assertTrue(exceptionMessage.contains("found POW"));
    }

    private static String getExceptionMessage(String formula) {
        try {
            Parser.getFormulaAsSemanticAst(formula);
            fail("Expected a type error exception.");
            return "";
        } catch (TypeErrorException e) {
            return e.getMessage();
        }
    }
}

Revert "fix "NullPionterException could be thrown"-bug, see sonar qube L28, L35"


package org.codehaus.xfire.exchange;

import javax.xml.stream.XMLStreamReader;

/**
 * A "in" message. These arrive at endpoints.

 * @author Dan Diephouse
 */
public class InMessage
    extends AbstractMessage
{
    private XMLStreamReader xmlStreamReader;

    public InMessage()
    {
    }

    public InMessage(XMLStreamReader xmlStreamReader)
    {
        this.xmlStreamReader = xmlStreamReader;
        setUri(ANONYMOUS_URI);
    }

    public InMessage(XMLStreamReader xmlStreamReader, String uri)
    {
        this.xmlStreamReader = xmlStreamReader;
        setUri(uri);
    }

    public XMLStreamReader getXMLStreamReader()
    {
        return xmlStreamReader;
    }
}

package org.codehaus.xfire.exchange;

import javax.xml.stream.XMLStreamReader;

/**
 * A "in" message. These arrive at endpoints.

 * @author Dan Diephouse
 */
public class InMessage
    extends AbstractMessage
{
    private XMLStreamReader xmlStreamReader;

    public InMessage()
    {
    }

    public InMessage(XMLStreamReader xmlStreamReader)
    {
        this.xmlStreamReader = xmlStreamReader;
        setUri(ANONYMOUS_URI);
    }

    public InMessage(XMLStreamReader xmlStreamReader, String uri)
    {
        this.xmlStreamReader = xmlStreamReader;
        setUri(uri);
    }

    public void setXMLStreamReader(XMLStreamReader xmlStreamReader)
    {
        this.xmlStreamReader = xmlStreamReader;
    }

    public XMLStreamReader getXMLStreamReader()
    {
        return xmlStreamReader;
    }
}

Allow the stream reader to be set


package seedu.todo.ui;

import seedu.todo.controllers.*;

public class InputHandler {

    Controller handlingController = null;

    public boolean processInput(String input) {
        if (this.handlingController != null) {
            handlingController.process(input);
        } else {
            Controller[] controllers = instantiateAllControllers();

            // Define the controller which returns the maximum confidence.
            Controller maxController = null;

            // Get controller which has the maximum confidence.
            float maxConfidence = Integer.MIN_VALUE;

            for (int i = 0; i < controllers.length; i++) {
                float confidence = controllers[i].inputConfidence(input);

                // Don't consider controllers with non-positive confidence.
                if (confidence <= 0)
                    continue;

                if (confidence > maxConfidence) {
                    maxConfidence = confidence;
                    maxController = controllers[i];
                }
            }

            // No controller exists with confidence > 0.
            if (maxController == null)
                return false;

            // Process using best-matched controller.
            maxController.process(input);

        }

        return true;
    }

    private Controller[] instantiateAllControllers() {
        return new Controller[] { new AddController(),
                                  new ListController(),
                                  new DestroyController(),
                                  new UpdateController() };
    }

}

package seedu.todo.ui;

import seedu.todo.controllers.*;

public class InputHandler {

    Controller handlingController = null;

    public boolean processInput(String input) {
        if (this.handlingController != null) {
            handlingController.process(input);
        } else {
            Controller[] controllers = instantiateAllControllers();

            // Define the controller which returns the maximum confidence.
            Controller maxController = null;

            // Get controller which has the maximum confidence.
            float maxConfidence = Integer.MIN_VALUE;

            for (int i = 0; i < controllers.length; i++) {
                float confidence = controllers[i].inputConfidence(input);

                // Don't consider controllers with non-positive confidence.
                if (confidence <= 0) {
                    continue;
                }

                if (confidence > maxConfidence) {
                    maxConfidence = confidence;
                    maxController = controllers[i];
                }
            }

            // No controller exists with confidence > 0.
            if (maxController == null) {
                return false;
            }

            // Process using best-matched controller.
            maxController.process(input);

        }

        return true;
    }

    private Controller[] instantiateAllControllers() {
        return new Controller[] { new AddController(),
                                  new ListController(),
                                  new DestroyController(),
                                  new UpdateController() };
    }

}

Fix spacing and conditional braces


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

/**
 * Enumeration of the possible configuration parameters.
 *
 * @author Samuel Santos
 * @version $Revision$
 */
public enum CacheConfigParameter {
    /** Defines whether a component is static or not. */
    STATIC("static"),
    /** Cache directive to control where the response may be cached. */
    PRIVATE("private"),
    /** Cache directive to set an expiration date relative to the current date. */
    EXPIRATION_TIME("expirationTime");

    private String name;

    private CacheConfigParameter(String name) {
        this.name = name;
    }

    /**
     * Gets the parameter name.
     *
     * @return the parameter name
     */
    public String getName() {
        return this.name;
    }
}

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

/**
 * Enumeration of the possible configuration parameters.
 *
 * @author Samuel Santos
 * @author John Yeary
 * @version 2.0.1
 */
public enum CacheConfigParameter {

    /**
     * Defines whether a component is static or not.
     */
    STATIC("static"),
    /**
     * Cache directive to control where the response may be cached.
     */
    PRIVATE("private"),
    /**
     * Cache directive to set an expiration date relative to the current date.
     */
    EXPIRATION_TIME("expirationTime");

    private final String name;

    private CacheConfigParameter(String name) {
        this.name = name;
    }

    /**
     * Gets the parameter name.
     *
     * @return the parameter name
     */
    public String getName() {
        return this.name;
    }
}

Set the name to final.


package nl.codecastle.configuration;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Reads properties file from a given location.
 */
public class PropertiesReader {

    private final Properties properties;
    private final Properties defaultProperties;

    /**
     * Reads in the properties from the given path.
     * Also reads in the defaults properties from the "default.properties" file.
     *
     * @param filePath the path of the project properties file
     */
    public PropertiesReader(String filePath) {

        properties = new Properties();
        defaultProperties = new Properties();

        try {
            ClassLoader classLoader = getClass().getClassLoader();
            InputStream defaultPropertiesStream = classLoader.getResourceAsStream("default.properties");
            InputStream projectPropertiesStream = classLoader.getResourceAsStream(filePath);
            assert (defaultPropertiesStream != null);
            defaultProperties.load(defaultPropertiesStream);
            if (projectPropertiesStream != null) {
                properties.load(projectPropertiesStream);
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * Returns the value for the given key from the project properties file.
     * If the file is missing it retrieves a value from the default properties.
     *
     * @param key name of the property needed
     * @return the value for the given key
     */
    public String getValue(String key) {
        if (properties.containsKey(key)) {
            return properties.getProperty(key);
        } else {
            return defaultProperties.getProperty(key);
        }
    }
}

package nl.codecastle.configuration;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Reads properties file from a given location.
 */
public class PropertiesReader {

    private final Properties properties;
    private final Properties defaultProperties;

    /**
     * Reads in the properties from the given path.
     * Also reads in the defaults properties from the "default.properties" file.
     *
     * @param filePath the path of the project properties file
     */
    public PropertiesReader(String filePath) {

        properties = new Properties();
        defaultProperties = new Properties();

        try {
            InputStream defaultPropertiesStream = getClass().getClassLoader().getResourceAsStream("default.properties");
            InputStream projectPropertiesStream = getClass().getClassLoader().getResourceAsStream(filePath);
            assert (defaultPropertiesStream != null);
            defaultProperties.load(defaultPropertiesStream);
            if (projectPropertiesStream != null) {
                properties.load(projectPropertiesStream);
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * Returns the value for the given key from the project properties file.
     * If the file is missing it retrieves a value from the default properties.
     *
     * @param key name of the property needed
     * @return the value for the given key
     */
    public String getValue(String key) {
        if (properties.containsKey(key)) {
            return properties.getProperty(key);
        } else {
            return defaultProperties.getProperty(key);
        }
    }
}

Read properties from a property file


package org.zendesk.client.v2.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * @author stephenc
 * @since 04/04/2013 14:53
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class CustomFieldValue {
    private Long id;
    private String value;

    public Long getId() {
        return id;
    }

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

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}

package org.zendesk.client.v2.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * @author stephenc
 * @since 04/04/2013 14:53
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class CustomFieldValue {
    private Long id;
    private String value;

    public CustomFieldValue() {
    }

    public CustomFieldValue(Long id, String value) {
        this.id = id;
        this.value = value;
    }

    public Long getId() {
        return id;
    }

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

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}

Add a constructor to ease setting custom fields


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

import org.opensim.modeling.GeometryPath;
import org.opensim.modeling.State;
import org.opensim.modeling.Vec3;

/**
 *
 * @author Ayman-NMBL
 *
 * Default ColorMap for earlier versions of OpenSim red-to-blue 0-1
 *  RGB components scales linearly
 */
public class ModernPathColorMap implements PathColorMap {

    @Override
    public Vec3 getColor(GeometryPath path, State state) {
        Vec3 activationBasedColor = path.getColor(state);
        double redness = activationBasedColor.get(0);
        Vec3 mappedColor = new Vec3(0.6435 + 0.07588*redness,
            0.7009 - 0.6396*redness,
            0.8554 - 0.6891*redness);
        return mappedColor;
    }

}

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

import java.util.prefs.Preferences;
import org.opensim.modeling.GeometryPath;
import org.opensim.modeling.State;
import org.opensim.modeling.Vec3;
import org.opensim.utils.TheApp;

/**
 *
 * @author Ayman-NMBL
 *
 * Default ColorMap for earlier versions of OpenSim red-to-blue 0-1
 *  RGB components scales linearly
 */
public class ModernPathColorMap implements PathColorMap {
    double weight = 0.0;

    void updateWeight (){
        String weightString="0.";
        String saved=Preferences.userNodeForPackage(TheApp.class).get("ColorMap Weight", weightString);
        Preferences.userNodeForPackage(TheApp.class).put("ColorMap Weight", saved);
        weight = Double.parseDouble(saved);
    }

    @Override
    public Vec3 getColor(GeometryPath path, State state) {
        updateWeight ();
        Vec3 activationBasedColor = path.getColor(state);
        double redness = activationBasedColor.get(0);
        Vec3 mappedColor = new Vec3(0.6435 + 0.07588*redness,
            0.7009 - 0.6396*redness,
            0.8554 - 0.6891*redness);
        Vec3 rawColor = new Vec3(redness, 0, 1-redness);
        Vec3 weightedColor = new Vec3();
        for (int i=0; i<3; i++)
            weightedColor.set(i, weight*rawColor.get(i)+(1 - weight)*mappedColor.get(i));
        return weightedColor;
    }

}

Introduce blending weight to tune muscle colors


package codechicken.lib.block.property;

import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import net.minecraft.block.properties.PropertyHelper;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;

/**
 * Created by covers1624 on 2/6/2016.
 */
public class PropertyString extends PropertyHelper<String> {

    private final HashSet<String> valuesSet;

    public PropertyString(String name, Collection<String> values) {
        super(name, String.class);
        valuesSet = new HashSet<String>(values);
    }

    public PropertyString(String name, String... values) {
        super(name, String.class);
        valuesSet = new HashSet<String>();
        Collections.addAll(valuesSet, values);
    }

    public List<String> values() {
        return Lists.newLinkedList(valuesSet);
    }

    @Override
    public Collection<String> getAllowedValues() {
        return ImmutableSet.copyOf(valuesSet);
    }

    @Override
    public Optional<String> parseValue(String value) {
        if (valuesSet.contains(value)) {
            return Optional.of(value);
        }
        return Optional.absent();
    }

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

package codechicken.lib.block.property;

import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.properties.PropertyHelper;

import java.util.*;

/**
 * Created by covers1624 on 2/6/2016.
 */
public class PropertyString extends PropertyHelper<String> {

    private final List<String> valuesSet;

    public PropertyString(String name, Collection<String> values) {
        super(name, String.class);
        valuesSet = new LinkedList<String>(values);
    }

    public PropertyString(String name, String... values) {
        super(name, String.class);
        valuesSet = new LinkedList<String>();
        Collections.addAll(valuesSet, values);
    }

    public List<String> values() {
        return ImmutableList.copyOf(valuesSet);
    }

    @Override
    public Collection<String> getAllowedValues() {
        return ImmutableList.copyOf(valuesSet);
    }

    @Override
    public Optional<String> parseValue(String value) {
        if (valuesSet.contains(value)) {
            return Optional.of(value);
        }
        return Optional.absent();
    }

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

Move property string to use a linked list.


/*
 * Copyright 2015 Ryan Gilera.
 *
 * 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.github.daytron.revworks.data;

/**
 * Collection of exception messages.
 *
 * @author Ryan Gilera
 */
public enum ExceptionMsg {

    AUTHENTICATION_EXCEPTION_NO_USER("No such user found. Invalid credentials."),
    AUTHENTICATION_EXCEPTION_SYS_ERROR("System error occured, "
            + "please consult your administrator for help."),
    NO_CURRENT_USER_EXCEPTION("No user is login"),
    WRONG_CURRENT_USER_TYPE_EXCEPTION("Wrong user type access.");
    private final String msg;

    private ExceptionMsg(String msg) {
        this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

}

/*
 * Copyright 2015 Ryan Gilera.
 *
 * 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.github.daytron.revworks.data;

/**
 * Collection of exception messages.
 *
 * @author Ryan Gilera
 */
public enum ExceptionMsg {

    AUTHENTICATION_EXCEPTION_NO_USER("No such user found. Invalid credentials."),
    AUTHENTICATION_EXCEPTION_SYS_ERROR("System error occured "),
    NO_CURRENT_USER_EXCEPTION("No user is login"),
    WRONG_CURRENT_USER_TYPE_EXCEPTION("Wrong user type access."),
    EMPTY_SQL_RESULT("Empty SQL query result.");
    private final String msg;

    private ExceptionMsg(String msg) {
        this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

}

Add empty result sql query message and move instruction to ErrorMsg


package org.dstadler.jgit;

/*
   Copyright 2013, 2014 Dominik Stadler

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;

/**
 * Simple snippet which shows how to create a new repository
 *
 * @author dominik.stadler at gmx.at
 */
public class CreateNewRepository {

    public static void main(String[] args) throws IOException {
        // prepare a new folder
        File localPath = File.createTempFile("TestGitRepository", "");
        localPath.delete();

        // create the directory
        Repository repository = FileRepositoryBuilder.create(new File(localPath, ".git"));
        repository.create();

        System.out.println("Having repository: " + repository.getDirectory());

        repository.close();

        FileUtils.deleteDirectory(localPath);
    }
}

package org.dstadler.jgit;

/*
   Copyright 2013, 2014 Dominik Stadler

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;

/**
 * Simple snippet which shows how to create a new repository
 *
 * @author dominik.stadler at gmx.at
 */
public class CreateNewRepository {

    public static void main(String[] args) throws IOException, IllegalStateException, GitAPIException {
        // prepare a new folder
        File localPath = File.createTempFile("TestGitRepository", "");
        localPath.delete();

        // create the directory
        Git git = Git.init().setDirectory(localPath).call();

        System.out.println("Having repository: " + git.getRepository().getDirectory());

        git.close();

        FileUtils.deleteDirectory(localPath);
    }
}

Rewrite example to use preferred way of creating a new repository


/* Copyright © 2016 Matthew Champion
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
 * Neither the name of mattunderscore.com nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MATTHEW CHAMPION BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */

package com.mattunderscore.specky.model;

import java.util.List;

/**
 * @author Matt Champion on 11/06/2016
 */
public interface TypeDesc {
    String getName();

    List<PropertyDesc> getProperties();
}

/* Copyright © 2016 Matthew Champion
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
 * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
 * Neither the name of mattunderscore.com nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MATTHEW CHAMPION BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */

package com.mattunderscore.specky.model;

import java.util.List;

/**
 * @author Matt Champion on 11/06/2016
 */
public interface TypeDesc {
    String getName();

    List<PropertyDesc> getProperties();

    ConstructionDesc getConstruction();
}

Move construction method accessor to interface.


/*
 * Copyright (c) 2017, Adam <Adam@sigterm.info>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package net.runelite.api.mixins;

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

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD})
public @interface Inject
{

}

/*
 * Copyright (c) 2017, Adam <Adam@sigterm.info>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package net.runelite.api.mixins;

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

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR})
public @interface Inject
{

}

Allow injection of <init> and <clinit>


package com.csforge.sstable;

import com.google.common.base.Strings;

import java.io.IOException;
import java.util.Arrays;

public class Driver {
    public static void main(String ... args) {
        if (args.length == 0) {
            printCommands();
            System.exit(-1);
        }
        switch(args[0].toLowerCase()) {
            case "tojson":
                SSTable2Json.main(Arrays.copyOfRange(args, 1, args.length));
                break;

            case "select":
                Query.main(Arrays.copyOfRange(args, 0, args.length));
                break;

            case "cqlsh":
                Cqlsh.main(Arrays.copyOfRange(args, 1, args.length));
                break;

            case "describe":
                String path = args[1];
                try {
                    System.out.println("\u001B[1;34m" + path);
                    System.out.println(TableTransformer.ANSI_CYAN + Strings.repeat("=", path.length()));
                    System.out.print(TableTransformer.ANSI_RESET);
                    CassandraUtils.printStats(path, System.out);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                break;

            default:
                System.err.println("Unknown command: " + args[0]);
                printCommands();
                System.exit(-2);
                break;
        }
    }

    private static void printCommands() {
        System.err.println("Available commands: cqlsh, toJson, select, describe");
    }
}

package com.csforge.sstable;

import com.google.common.base.Strings;

import java.io.File;
import java.util.Arrays;

public class Driver {
    public static void main(String ... args) {
        if (args.length == 0) {
            printCommands();
            System.exit(-1);
        }
        switch(args[0].toLowerCase()) {
            case "tojson":
                SSTable2Json.main(Arrays.copyOfRange(args, 1, args.length));
                break;

            case "select":
                Query.main(Arrays.copyOfRange(args, 0, args.length));
                break;

            case "cqlsh":
                Cqlsh.main(Arrays.copyOfRange(args, 1, args.length));
                break;

            case "describe":
                String path = new File(args[1]).getAbsolutePath();
                try {
                    System.out.println("\u001B[1;34m" + path);
                    System.out.println(TableTransformer.ANSI_CYAN + Strings.repeat("=", path.length()));
                    System.out.print(TableTransformer.ANSI_RESET);
                    CassandraUtils.printStats(path, System.out);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                break;

            default:
                System.err.println("Unknown command: " + args[0]);
                printCommands();
                System.exit(-2);
                break;
        }
    }

    private static void printCommands() {
        System.err.println("Available commands: cqlsh, toJson, select, describe");
    }
}

Use absolute path for 'describe'.


package net.aeten.core.spi;

/**
 *
 * @author Thomas Pérennou
 */
public @interface Configuration {
	String name();
	Class<?> provider();
	String parser() default "";
}

package net.aeten.core.spi;

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

/**
 *
 * @author Thomas Pérennou
 */
@Documented
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.PACKAGE, ElementType.TYPE})
public @interface Configuration {
	String name();
	Class<?> provider();
	String parser() default "";
}

Add Documented, Retention and Target annotations


/*
 * This file is part of the Yildiz-Engine project, licenced under the MIT License  (MIT)
 *
 * Copyright (c) 2017 Grégory Van den Borre
 *
 * More infos available: https://www.yildiz-games.be
 *
 * 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 be.yildiz.shared.mission.task;

/**
 * @author Grégory Van den Borre
 */
public class TaskTypeConstant {

    public static final String DESTINATION = "destination";

    public static final String DESTROY = "destroy";
}

/*
 * This file is part of the Yildiz-Engine project, licenced under the MIT License  (MIT)
 *
 * Copyright (c) 2017 Grégory Van den Borre
 *
 * More infos available: https://www.yildiz-games.be
 *
 * 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 be.yildiz.shared.mission.task;

/**
 * @author Grégory Van den Borre
 */
public class TaskTypeConstant {

    public static final String DESTINATION = "destination";

    public static final String DESTROY = "destroy";

    private TaskTypeConstant() {
        super();
    }
}

Fix sonar: add private constructor.


package me.prettyprint.cassandra.service;

import static me.prettyprint.cassandra.utils.StringUtils.bytes;
import static me.prettyprint.cassandra.utils.StringUtils.string;

import org.apache.cassandra.service.Column;
import org.apache.cassandra.service.ColumnPath;

/**
 * Example client that uses the cassandra hector client.
 *
 * @author Ran Tavory (rantav@gmail.com)
 *
 */
public class ExampleClient {

  public static void main(String[] args) throws IllegalStateException, PoolExhaustedException, Exception {
    CassandraClientPool pool = CassandraClientPoolFactory.INSTANCE.get();
    CassandraClient client = pool.borrowClient("tush", 9160);
    try {
      Keyspace keyspace = client.getKeyspace("Keyspace1");
      ColumnPath columnPath = new ColumnPath("Standard1", null, bytes("column-name"));

      // insert
      keyspace.insert("key", columnPath, bytes("value"));

      // read
      Column col = keyspace.getColumn("key", columnPath);

      System.out.println("Read from cassandra: " + string(col.getValue()));

    } finally {
      // return client to pool. do it in a finally block to make sure it's executed
      pool.releaseClient(client);
    }
  }
}

package me.prettyprint.cassandra.service;

import static me.prettyprint.cassandra.utils.StringUtils.bytes;
import static me.prettyprint.cassandra.utils.StringUtils.string;

import org.apache.cassandra.service.Column;
import org.apache.cassandra.service.ColumnPath;

/**
 * Example client that uses the cassandra hector client.
 *
 * @author Ran Tavory (rantav@gmail.com)
 *
 */
public class ExampleClient {

  public static void main(String[] args) throws IllegalStateException, PoolExhaustedException, Exception {
    CassandraClientPool pool = CassandraClientPoolFactory.INSTANCE.get();
    CassandraClient client = pool.borrowClient("tush", 9160);
    // A load balanced version would look like this:
    // CassandraClient client = pool.borrowClient(new String[] {"cas1:9160", "cas2:9160", "cas3:9160"});

    try {
      Keyspace keyspace = client.getKeyspace("Keyspace1");
      ColumnPath columnPath = new ColumnPath("Standard1", null, bytes("column-name"));

      // insert
      keyspace.insert("key", columnPath, bytes("value"));

      // read
      Column col = keyspace.getColumn("key", columnPath);

      System.out.println("Read from cassandra: " + string(col.getValue()));

    } finally {
      // return client to pool. do it in a finally block to make sure it's executed
      pool.releaseClient(client);
    }
  }
}

Add a load balanced client example


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

package com.facebook.litho.testing.testrunner;

import com.facebook.litho.config.ComponentsConfiguration;
import org.junit.runners.model.FrameworkMethod;

public class SplitBuildAndLayoutTestRunConfiguration implements LithoTestRunConfiguration {

  private final boolean defaultApplyStateUpdateEarly =
      ComponentsConfiguration.applyStateUpdateEarly;
  private final boolean defaultIsBuildAndLayoutSplitEnabled =
      ComponentsConfiguration.isBuildAndLayoutSplitEnabled;

  @Override
  public void beforeTest(FrameworkMethod method) {
    ComponentsConfiguration.isBuildAndLayoutSplitEnabled = true;
    ComponentsConfiguration.applyStateUpdateEarly = true;
  }

  @Override
  public void afterTest(FrameworkMethod method) {
    ComponentsConfiguration.isBuildAndLayoutSplitEnabled = defaultIsBuildAndLayoutSplitEnabled;
    ComponentsConfiguration.applyStateUpdateEarly = defaultApplyStateUpdateEarly;
  }
}

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

package com.facebook.litho.testing.testrunner;

import com.facebook.litho.config.ComponentsConfiguration;
import org.junit.runners.model.FrameworkMethod;

public class SplitBuildAndLayoutTestRunConfiguration implements LithoTestRunConfiguration {

  private final boolean defaultApplyStateUpdateEarly =
      ComponentsConfiguration.applyStateUpdateEarly;
  private final boolean defaultIsBuildAndLayoutSplitEnabled =
      ComponentsConfiguration.isBuildAndLayoutSplitEnabled;
  private final boolean defaultUseResolvedTree = ComponentsConfiguration.useResolvedTree;

  @Override
  public void beforeTest(FrameworkMethod method) {
    ComponentsConfiguration.isBuildAndLayoutSplitEnabled = true;
    ComponentsConfiguration.applyStateUpdateEarly = true;
    ComponentsConfiguration.useResolvedTree = true;
  }

  @Override
  public void afterTest(FrameworkMethod method) {
    ComponentsConfiguration.isBuildAndLayoutSplitEnabled = defaultIsBuildAndLayoutSplitEnabled;
    ComponentsConfiguration.applyStateUpdateEarly = defaultApplyStateUpdateEarly;
    ComponentsConfiguration.useResolvedTree = defaultUseResolvedTree;
  }
}

Add useResolvedTree flag to SplitBuildAndLayoutTestConfiguration