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

import org.apache.curator.drivers.TracerDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;

/**
 * Default tracer driver
 */
public class DefaultTracerDriver implements TracerDriver
{
    private final Logger log = LoggerFactory.getLogger(getClass());

    @Override
    public void addTrace(String name, long time, TimeUnit unit)
    {
        log.trace("Trace: " + TimeUnit.MILLISECONDS.convert(time, unit) + " ms");
    }

    @Override
    public void addCount(String name, int increment)
    {
        log.trace("Counter " + name + ": " + increment);
    }
}

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

import org.apache.curator.drivers.TracerDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;

/**
 * Default tracer driver
 */
public class DefaultTracerDriver implements TracerDriver
{
    private final Logger log = LoggerFactory.getLogger(getClass());

    @Override
    public void addTrace(String name, long time, TimeUnit unit)
    {
        if ( log.isTraceEnabled() )
        {
            log.trace("Trace: " + TimeUnit.MILLISECONDS.convert(time, unit) + " ms");
        }
    }

    @Override
    public void addCount(String name, int increment)
    {
        if ( log.isTraceEnabled() )
        {
            log.trace("Counter " + name + ": " + increment);
        }
    }
}

Use isTraceEnabled to prevent unnecessary string concat


package org.bouncycastle.bcpg;

import java.io.IOException;

import org.bouncycastle.util.Arrays;
import org.bouncycastle.util.Strings;

/**
 * Generic literal data packet.
 */
public class LiteralDataPacket
    extends InputStreamPacket
{
    int     format;
    byte[]  fileName;
    long    modDate;

    LiteralDataPacket(
        BCPGInputStream    in)
        throws IOException
    {
        super(in);

        format = in.read();
        int    l = in.read();

        fileName = new byte[l];
        for (int i = 0; i != fileName.length; i++)
        {
            fileName[i] = (byte)in.read();
        }

        modDate = ((long)in.read() << 24) | (in.read() << 16) | (in.read() << 8) | in.read();
    }

    /**
     * Return the format tag of the data packet.
     */
    public int getFormat()
    {
        return format;
    }

    /**
     * Return the modification time for the file (milliseconds at second level precision).
     */
    public long getModificationTime()
    {
        return modDate * 1000L;
    }

    /**
     * Return the file name associated with the data packet.
     */
    public String getFileName()
    {
        return Strings.fromUTF8ByteArray(fileName);
    }

    /**
     * Return the file name as an uninterpreted byte array.
     */
    public byte[] getRawFileName()
    {
        byte[] tmp = new byte[fileName.length];

        for (int i = 0; i != tmp.length; i++)
        {
            tmp[i] = fileName[i];
        }

        return tmp;
    }
}

package org.bouncycastle.bcpg;

import java.io.IOException;

import org.bouncycastle.util.Arrays;
import org.bouncycastle.util.Strings;

/**
 * Generic literal data packet.
 */
public class LiteralDataPacket
    extends InputStreamPacket
{
    int     format;
    byte[]  fileName;
    long    modDate;

    LiteralDataPacket(
        BCPGInputStream    in)
        throws IOException
    {
        super(in);

        format = in.read();
        int    l = in.read();

        fileName = new byte[l];
        for (int i = 0; i != fileName.length; i++)
        {
            fileName[i] = (byte)in.read();
        }

        modDate = ((long)in.read() << 24) | (in.read() << 16) | (in.read() << 8) | in.read();
    }

    /**
     * Return the format tag of the data packet.
     */
    public int getFormat()
    {
        return format;
    }

    /**
     * Return the modification time for the file (milliseconds at second level precision).
     */
    public long getModificationTime()
    {
        return modDate * 1000L;
    }

    /**
     * Return the file name associated with the data packet.
     */
    public String getFileName()
    {
        return Strings.fromUTF8ByteArray(fileName);
    }

    /**
     * Return the file name as an uninterpreted byte array.
     */
    public byte[] getRawFileName()
    {
        return Arrays.clone(fileName);
    }
}

Replace inline array copy with Arrays.clone


package fr.free.nrw.commons.nearby;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.ViewHolder;
import fr.free.nrw.commons.utils.ResourceUtils;

public class NearbyViewHolder implements ViewHolder<Place> {
    @BindView(R.id.tvName) TextView tvName;
    @BindView(R.id.tvDesc) TextView tvDesc;
    @BindView(R.id.distance) TextView distance;
    @BindView(R.id.icon) ImageView icon;

    public NearbyViewHolder(View view) {
        ButterKnife.bind(this, view);
    }

    @Override
    public void bindModel(Context context, Place place) {
        // Populate the data into the template view using the data object
        tvName.setText(place.name);
        String description = place.description;
        if ( description == null || description.isEmpty() || description.equals("?")) {
            description = "No Description Found";
        }
        tvDesc.setText(description);
        distance.setText(place.distance);
        icon.setImageResource(ResourceUtils.getDescriptionIcon(place.description));
    }
}

package fr.free.nrw.commons.nearby;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.ViewHolder;
import fr.free.nrw.commons.utils.ResourceUtils;

public class NearbyViewHolder implements ViewHolder<Place> {
    @BindView(R.id.tvName) TextView tvName;
    @BindView(R.id.tvDesc) TextView tvDesc;
    @BindView(R.id.distance) TextView distance;
    @BindView(R.id.icon) ImageView icon;

    public NearbyViewHolder(View view) {
        ButterKnife.bind(this, view);
    }

    @Override
    public void bindModel(Context context, Place place) {
        // Populate the data into the template view using the data object
        tvName.setText(place.name);
        String description = place.description;
        if ( description == null || description.isEmpty() || description.equals("?")) {
            description = context.getString(R.string.no_description_found);
        }
        tvDesc.setText(description);
        distance.setText(place.distance);
        icon.setImageResource(ResourceUtils.getDescriptionIcon(place.description));
    }
}

Use string resource instead of hardcoded string


/*
 * Copyright 2012 Artur Dryomov
 *
 * 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 ru.ming13.gambit.ui.bus;

import com.squareup.otto.Bus;

public class BusProvider
{
	private static Bus instance;

	private BusProvider() {
	}

	public static Bus getInstance() {
		if (instance == null) {
			instance = new Bus();
		}

		return instance;
	}
}

/*
 * Copyright 2012 Artur Dryomov
 *
 * 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 ru.ming13.gambit.ui.bus;

import com.squareup.otto.Bus;

public class BusProvider
{
	private BusProvider() {
	}

	private static final class BusHolder
	{
		public static final Bus BUS = new Bus();
	}

	public static Bus getInstance() {
		return BusHolder.BUS;
	}
}

Change Otto bus provider to be lazy.


package com.bpedman.lambdas;

import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;

/**
 * @author Brandon Pedersen <bpedersen@getjive.com>
 */
public class Example_03
{
  /**
   * Less lines of code but you still need to read the predicate lambda to understand what is
   * happening...
   */
  private static boolean isPrime(final int number)
  {
    return number > 1 &&
        IntStream
            .range(2, number - 1)
            .noneMatch(value -> number % value == 0);
  }

  /**
   * Our goal...turn this set of calculations into something that is as readable as the method name
   * itself and more succinct than it is
   *
   * @param numbers
   *          potentially unordered, non-unique set of numbers
   */
  public static int findDoubleOfFirstPrimeNumberGreaterThan5(List<Integer> numbers)
  {
    int result = 0;
    for (final Integer number : numbers)
    {
      // first check if prime
      if (isPrime(number))
      {
        if (number > 5)
        {
          result = number * 2;
        }
      }
    }

    return result;
  }

  public static void main(String[] args)
  {
    System.out.println(findDoubleOfFirstPrimeNumberGreaterThan5(
        Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
  }
}

package com.bpedman.lambdas;

import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;

/**
 * @author Brandon Pedersen <bpedersen@getjive.com>
 */
public class Example_03
{
  /**
   * Less lines of code but you still need to read the predicate lambda to understand what is
   * happening...
   */
  private static boolean isPrime(final int number)
  {
    return number > 1 &&
        IntStream
            .range(2, number - 1)
            .noneMatch((value) -> number % value == 0);
  }

  /**
   * Our goal...turn this set of calculations into something that is as readable as the method name
   * itself and more succinct than it is
   *
   * @param numbers
   *          potentially unordered, non-unique set of numbers
   */
  public static int findDoubleOfFirstPrimeNumberGreaterThan5(List<Integer> numbers)
  {
    int result = 0;
    for (final Integer number : numbers)
    {
      // first check if prime
      if (isPrime(number))
      {
        if (number > 5)
        {
          result = number * 2;
        }
      }
    }

    return result;
  }

  public static void main(String[] args)
  {
    System.out.println(findDoubleOfFirstPrimeNumberGreaterThan5(
        Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
  }
}

Add parenthesis around lambda arg


package seedu.taskitty.model.task;

import seedu.taskitty.commons.exceptions.IllegalValueException;

/**
 * Represents a Task's name in the task manager.
 * Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
 */
public class Name {

    public static final String MESSAGE_NAME_CONSTRAINTS = "Task names should be spaces or alphanumeric characters";
    public static final String NAME_VALIDATION_REGEX_FORMAT = "[\\p{Alnum} ]+";

    public final String fullName;

    /**
     * Validates given name.
     *
     * @throws IllegalValueException if given name string is invalid.
     */
    public Name(String name) throws IllegalValueException {
        assert name != null;
        String trimName = name.trim();
        if (!isValidName(trimName)) {
            throw new IllegalValueException(MESSAGE_NAME_CONSTRAINTS);
        }
        this.fullName = trimName;
    }

    /**
     * Returns true if a given string is a valid person name.
     */
    public static boolean isValidName(String test) {
        return test.matches(NAME_VALIDATION_REGEX_FORMAT);
    }

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

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Name // instanceof handles nulls
                && this.fullName.equals(((Name) other).fullName)); // state check
    }

    @Override
    public int hashCode() {
        return fullName.hashCode();
    }

}

package seedu.taskitty.model.task;

import seedu.taskitty.commons.exceptions.IllegalValueException;

/**
 * Represents a Task's name in the task manager.
 * Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
 */
public class Name {

    public static final String MESSAGE_NAME_CONSTRAINTS =
            "Task names should be alphabets, numbers, spaces and common punctuations, Meow!";
    public static final String NAME_VALIDATION_REGEX_FORMAT = "[\\p{Alnum}!@$%&(),.? ]+";

    public final String fullName;

    /**
     * Validates given name.
     *
     * @throws IllegalValueException if given name string is invalid.
     */
    public Name(String name) throws IllegalValueException {
        assert name != null;
        String trimName = name.trim();
        if (!isValidName(trimName)) {
            throw new IllegalValueException(MESSAGE_NAME_CONSTRAINTS);
        }
        this.fullName = trimName;
    }

    /**
     * Returns true if a given string is a valid person name.
     */
    public static boolean isValidName(String test) {
        return test.matches(NAME_VALIDATION_REGEX_FORMAT);
    }

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

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Name // instanceof handles nulls
                && this.fullName.equals(((Name) other).fullName)); // state check
    }

    @Override
    public int hashCode() {
        return fullName.hashCode();
    }

}

Improve task name by allowing wider input range


package com.samovich.cop2800.chapter15.assignmnet;

import javax.swing.*;
import java.awt.*;

/**
 * Contain the code for the interface and event handling
 * Filename SimpleTextEditorGUI
 * Created by Valery Samovich
 * Written on 7/27/16
 */
public class SimpleTextEditorGUI  extends JFrame {
    private JMenuBar mnuBar = new JMenuBar();
    private JMenu mnuFile = new JMenu("Edit");
    private JMenu mnuHelp = new JMenu("Help");

    public SimpleTextEditorGUI() {
        setLayout(new BorderLayout());
        setSize(360, 210);
        setJMenuBar(mnuBar);
        mnuBar.add(mnuFile);
        mnuBar.add(mnuHelp);
    }
}

package com.samovich.cop2800.chapter15.assignmnet;

import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;

/**
 * Contain the code for the interface and event handling
 * Filename SimpleTextEditorGUI
 * Created by Valery Samovich
 * Written on 7/27/16
 */
public class SimpleTextEditorGUI  extends JFrame {
    private JMenuBar mnuBar = new JMenuBar();
    private JMenu mnuFile = new JMenu("Edit");
    private JMenu mnuHelp = new JMenu("Help");
    JPanel plnContent = new JPanel();
    JTextArea txtArea = new JTextArea(200, 100);
    JLabel lblFontSize = new JLabel("Font Size");
    JTextField txtSetSize = new JTextField();

    /**
     * Constructor
     */
    public SimpleTextEditorGUI() {
        setSize(360, 210);
        setLayout(new BorderLayout());
        setJMenuBar(mnuBar);
        txtArea.setLineWrap(true);
        txtArea.setWrapStyleWord(true);
        // add constants from keyboard
        mnuFile.setMnemonic(KeyEvent.VK_F);
        mnuHelp.setMnemonic(KeyEvent.VK_H);
        // add menu
        mnuBar.add(mnuFile);
        mnuBar.add(mnuHelp);
        // text area
        plnContent.setLayout(new BorderLayout());
        plnContent.add(txtArea, BorderLayout.EAST);
        plnContent.add(lblFontSize);
        plnContent.add(txtSetSize);
        setContentPane(plnContent);
    }
}

Add text filed: NOT COMPLETED


package net.vergien.beanautoutils.annotation;

/**
 *  Used as long java8 and java9/10/.. is on the market
 */
public @interface Generated {

  /**
   * The value element MUST have the name of the code generator. The
   * name is the fully qualified name of the code generator.
   *
   * @return The name of the code generator
   */
  String[] value();

  /**
   * Date when the source was generated. The date element must follow the ISO
   * 8601 standard. For example the date element would have the following
   * value 2017-07-04T12:08:56.235-0700 which represents 2017-07-04 12:08:56
   * local time in the U.S. Pacific Time time zone.
   *
   * @return The date the source was generated
   */
  String date() default "";

  /**
   * A place holder for any comments that the code generator may want to
   * include in the generated code.
   *
   * @return Comments that the code generated included
   */
  String comments() default "";
}

package net.vergien.beanautoutils.annotation;

import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.SOURCE;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
 * Used as long java8 and java9/10/.. is on the market
 */
@Retention(SOURCE)
@Target(TYPE)
public @interface Generated
{

   /**
    * The value element MUST have the name of the code generator. The name is
    * the fully qualified name of the code generator.
    *
    * @return The name of the code generator
    */
   String[] value();

   /**
    * Date when the source was generated. The date element must follow the ISO
    * 8601 standard. For example the date element would have the following value
    * 2017-07-04T12:08:56.235-0700 which represents 2017-07-04 12:08:56 local
    * time in the U.S. Pacific Time time zone.
    *
    * @return The date the source was generated
    */
   String date() default "";

   /**
    * A place holder for any comments that the code generator may want to
    * include in the generated code.
    *
    * @return Comments that the code generated included
    */
   String comments() default "";
}

Make custom generated anotation only availabe at source


package com.containersol.minimesos.main;

import com.containersol.minimesos.MinimesosException;

public interface Command {

    /**
     * Validates combination of command parameters
     *
     * @return true if command parameters are valid
     */
    boolean validateParameters();

    /**
     * @return name of the command
     */
    String getName();

    /**
     * Executes the command
     */
    void execute() throws MinimesosException;

}

package com.containersol.minimesos.main;

public interface Command {

    /**
     * Validates combination of command parameters
     *
     * @return true if command parameters are valid
     */
    boolean validateParameters();

    /**
     * @return name of the command
     */
    String getName();

    /**
     * Executes the command
     */
    void execute();

}

Remove declaration of unchecked exception throwing


package org.metaborg.util.iterators;

import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Queue;

import com.google.common.collect.Queues;

public class CompoundIterator<T> implements Iterator<T> {
    private final Queue<? extends Iterator<T>> iterators;

    public CompoundIterator(Iterable<? extends Iterator<T>> iterators) {
        this.iterators = Queues.newArrayDeque(iterators);
    }

    @Override public boolean hasNext() {
        final Iterator<T> iterator = iterators.peek();
        if(iterator == null) {
            return false;
        }
        return iterator.hasNext();
    }

    @Override public T next() {
        final Iterator<T> iterator = iterators.peek();
        if(iterator == null) {
            throw new NoSuchElementException();
        }

        if(iterator.hasNext()) {
            return iterator.next();
        } else {
            iterators.poll();
            return next();
        }
    }

    @Override public void remove() {
        throw new UnsupportedOperationException();
    }
}

package org.metaborg.util.iterators;

import java.util.Iterator;
import java.util.NoSuchElementException;

import com.google.common.collect.Iterators;

public class CompoundIterator<T> implements Iterator<T> {
    private final Iterator<? extends Iterator<T>> iterators;
    private Iterator<T> iterator = Iterators.emptyIterator();

    public CompoundIterator(Iterable<? extends Iterator<T>> iterators) {
        this.iterators = iterators.iterator();
    }

    @Override public boolean hasNext() {
        if(iterator.hasNext()) {
            return true;
        }
        try {
            iterator = iterators.next();
        } catch(NoSuchElementException ex) {
            return false;
        }
        return hasNext();
    }

    @Override public T next() {
        try {
            return iterator.next();
        } catch(NoSuchElementException ex) {
            iterator = iterators.next();
        }
        return next();
    }

    @Override public void remove() {
        throw new UnsupportedOperationException();
    }
}

Fix compound iterator for case where empty iterators appear in the list.


package org.pdxfinder.graph.dao;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.util.Set;

/**
 * Created by jmason on 21/07/2017.
 */
@NodeEntity
public class Platform {

    @GraphId
    private Long id;
    private String name;
    private String url;

    @Relationship(type = "GROUP", direction = Relationship.INCOMING)
    private Group group;

    @Relationship(type = "ASSOCIATED_WITH")
    private Set<PlatformAssociation> platformAssociations;

    public Platform() {
    }

    public Platform(Set<PlatformAssociation> platformAssociations) {
        this.platformAssociations = platformAssociations;
    }

    public Set<PlatformAssociation> getPlatformAssociations() {
        return platformAssociations;
    }

    public void setPlatformAssociations(Set<PlatformAssociation> platformAssociations) {
        this.platformAssociations = platformAssociations;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Group getGroup() {
        return group;
    }

    public void setGroup(Group group) {
        this.group = group;
    }
}

package org.pdxfinder.graph.dao;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.util.Set;

/**
 * Created by jmason on 21/07/2017.
 */
@NodeEntity
public class Platform {

    @GraphId
    private Long id;
    private String name;
    private String url;
    private String type;

    @Relationship(type = "GROUP", direction = Relationship.INCOMING)
    private Group group;

    @Relationship(type = "ASSOCIATED_WITH")
    private Set<PlatformAssociation> platformAssociations;

    public Platform() {
    }

    public Platform(Set<PlatformAssociation> platformAssociations) {
        this.platformAssociations = platformAssociations;
    }

    public Set<PlatformAssociation> getPlatformAssociations() {
        return platformAssociations;
    }

    public void setPlatformAssociations(Set<PlatformAssociation> platformAssociations) {
        this.platformAssociations = platformAssociations;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Group getGroup() {
        return group;
    }

    public void setGroup(Group group) {
        this.group = group;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}

Add platform type to dao


package com.fasterxml.jackson.dataformat.xml.misc;

import com.fasterxml.jackson.annotation.*;

import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;

// test(s) for [dataformat-xml#111]
public class EmptyPolymorphicTest extends XmlTestBase
{
    static class Data {
        public String name;

        @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
        @JsonSubTypes({ @JsonSubTypes.Type(EmptyProxy.class) })
        public Proxy proxy;

        public Data() { }
        public Data(String n) {
            name = n;
            proxy = new EmptyProxy();
        }
    }

    static interface Proxy { }

    @JsonTypeName("empty")
    static class EmptyProxy implements Proxy { }

    /*
    /**********************************************************
    /* Test methods
    /**********************************************************
     */

    protected XmlMapper MAPPER = new XmlMapper();

    public void testEmpty() throws Exception
    {
        String xml = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(new Data("Foobar"));
//System.out.println("XML:\n"+xml);
        final Data data = MAPPER.readValue(xml, Data.class);
//                "<data><name>Foobar</name><proxy><empty></empty></proxy></data>"
        assertNotNull(data);
    }
}

package com.fasterxml.jackson.dataformat.xml.misc;

import com.fasterxml.jackson.annotation.*;

import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;

// test(s) for [dataformat-xml#169]
public class EmptyPolymorphicTest extends XmlTestBase
{
    static class Data {
        public String name;

        @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
        @JsonSubTypes({ @JsonSubTypes.Type(EmptyProxy.class) })
        public Proxy proxy;

        public Data() { }
        public Data(String n) {
            name = n;
            proxy = new EmptyProxy();
        }
    }

    static interface Proxy { }

    @JsonTypeName("empty")
    static class EmptyProxy implements Proxy { }

    /*
    /**********************************************************
    /* Test methods
    /**********************************************************
     */

    protected XmlMapper MAPPER = new XmlMapper();

    public void testEmpty() throws Exception
    {
        String xml = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(new Data("Foobar"));
//System.out.println("XML:\n"+xml);
        final Data data = MAPPER.readValue(xml, Data.class);
//                "<data><name>Foobar</name><proxy><empty></empty></proxy></data>"
        assertNotNull(data);
    }
}

Fix incorrect issue ref in test


/**
 *
 */
package ca.eandb.sortable;

import java.util.LinkedList;
import java.util.List;

import ca.eandb.sortable.Product.Field;

/**
 * @author brad
 *
 */
public final class ProductTrieBuilder implements ProductVisitor {

	private final TrieNode root = new TrieNode();

	/*(non-Javadoc)
	 * @see ca.eandb.sortable.ProductVisitor#visit(ca.eandb.sortable.Product)
	 */
	@Override
	public void visit(Product product) {
		addProduct(product);
	}

	public void addProduct(Product product) {
		processField(product, Field.MANUFACTURER, product.getManufacturer());
		processField(product, Field.FAMILY, product.getFamily());
		processField(product, Field.MODEL, product.getModel());
	}

	private void processField(Product product, Field field, String value) {
		value = StringUtil.normalize(value);
		String[] words = value.split(" ");
		ProductMatch match = new ProductMatch(product, field);

		for (String word : words) {
			TrieNode node = root.insert(word);
			List<ProductMatch> products = (List<ProductMatch>) node.getData();

			if (products == null) {
				products = new LinkedList<ProductMatch>();
				node.setData(products);
			}

			products.add(match);
		}
	}

	public TrieNode getRoot() {
		return root;
	}

}

/**
 *
 */
package ca.eandb.sortable;

import java.util.LinkedList;
import java.util.List;

import ca.eandb.sortable.Product.Field;

/**
 * @author brad
 *
 */
public final class ProductTrieBuilder implements ProductVisitor {

	private final TrieNode root = new TrieNode();

	/*(non-Javadoc)
	 * @see ca.eandb.sortable.ProductVisitor#visit(ca.eandb.sortable.Product)
	 */
	@Override
	public void visit(Product product) {
		addProduct(product);
	}

	public void addProduct(Product product) {
		processField(product, Field.MANUFACTURER, product.getManufacturer());
		processField(product, Field.MODEL, product.getModel());
		if (product.getFamily() != null) {
			processField(product, Field.FAMILY, product.getFamily());
		}
	}

	private void processField(Product product, Field field, String value) {
		value = StringUtil.normalize(value);
		String[] words = value.split(" ");
		ProductMatch match = new ProductMatch(product, field);

		for (String word : words) {
			TrieNode node = root.insert(word);
			List<ProductMatch> products = (List<ProductMatch>) node.getData();

			if (products == null) {
				products = new LinkedList<ProductMatch>();
				node.setData(products);
			}

			products.add(match);
		}
	}

	public TrieNode getRoot() {
		return root;
	}

}

Check if the optional family field is null before attempting to insert.


package tv.rocketbeans.supermafiosi.graphics;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;

import de.bitbrain.braingdx.assets.SharedAssetManager;

public class BitmapFontBaker {

	   public static BitmapFont bake(String fontPath, int fontSize) {
	      FreeTypeFontGenerator generator = SharedAssetManager.getInstance().get(fontPath, FreeTypeFontGenerator.class);
	      FreeTypeFontParameter parameter = new FreeTypeFontParameter();
	      parameter.size = fontSize;
	      parameter.mono = false;
	      parameter.color = Color.WHITE.cpy();
	      BitmapFont font = generator.generateFont(parameter);
	      return font;
	   }
	}

package tv.rocketbeans.supermafiosi.graphics;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;

import de.bitbrain.braingdx.assets.SharedAssetManager;

public class BitmapFontBaker {

	   public static BitmapFont bake(String fontPath, int fontSize) {
	      FreeTypeFontGenerator generator = SharedAssetManager.getInstance().get(fontPath, FreeTypeFontGenerator.class);
	      FreeTypeFontParameter parameter = new FreeTypeFontParameter();
	      parameter.size = fontSize;
	      parameter.mono = true;
	      parameter.color = Color.WHITE.cpy();
	      BitmapFont font = generator.generateFont(parameter);
	      return font;
	   }
	}

Make font rendering mono (disable anti-aliasing to keep pixel looknfeel


package com.nkming.packageinfo;

import android.app.ActivityManager;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.nkming.utils.graphic.BitmapCache;

public class MainActivity extends ActionBarActivity
		implements SearchDialog.SearchDialogListener
{
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		int heapMb = ((ActivityManager)getSystemService(ACTIVITY_SERVICE))
				.getMemoryClass();
		BitmapCache.init(heapMb * 1024 * 1024 / 4);

		setContentView(R.layout.activity_main);
		if (savedInstanceState == null)
		{
			mFrag = new MainFragment();
			getSupportFragmentManager().beginTransaction()
					.add(R.id.container, mFrag)
					.commit();
		}
		getSupportActionBar().setElevation(getResources().getDimension(
				R.dimen.toolbar_z));
	}

	@Override
	public void onSearchRequest(AppFilter req)
	{
		mFrag.onSearchRequest(req);
	}

	private MainFragment mFrag;
}

package com.nkming.packageinfo;

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

import com.nkming.utils.graphic.BitmapCache;

public class MainActivity extends ActionBarActivity
		implements SearchDialog.SearchDialogListener
{
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		int heapMb = ((ActivityManager)getSystemService(ACTIVITY_SERVICE))
				.getMemoryClass();
		BitmapCache.init(heapMb * 1024 * 1024 / 4);

		setContentView(R.layout.activity_main);
		if (savedInstanceState == null)
		{
			mFrag = new MainFragment();
			getSupportFragmentManager().beginTransaction()
					.add(R.id.container, mFrag)
					.commit();
		}
		else
		{
			mFrag = (MainFragment)getSupportFragmentManager().findFragmentById(
					R.id.container);
		}
		getSupportActionBar().setElevation(getResources().getDimension(
				R.dimen.toolbar_z));
	}

	@Override
	public void onSearchRequest(AppFilter req)
	{
		mFrag.onSearchRequest(req);
	}

	private MainFragment mFrag;
}

Fix fragment instance not correctly assigned


package seedu.address.commons.core;

/**
 * Container for user visible messages.
 */
public class Messages {

    public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
    public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
    public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
    public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";

}

package seedu.address.commons.core;

/**
 * Container for user visible messages.
 */
public class Messages {

    public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
    public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
    public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The activity index provided is invalid";
    public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d activities listed!";

}

Update messages to reflect activities


package de.prob2.ui.helpsystem;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import de.prob2.ui.internal.StageManager;
import javafx.fxml.FXML;
import javafx.scene.control.SplitPane;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;

@Singleton
public class HelpSystem extends SplitPane {
    @FXML private TreeView<String> treeView;
    @FXML private WebView webView;
    WebEngine webEngine;

    @Inject
    public HelpSystem(final StageManager stageManager) {
        stageManager.loadFXML(this, "helpsystem.fxml");
        TreeItem<String> root = new TreeItem<>("Root Node");
        root.setExpanded(true);
        root.getChildren().addAll(
                new TreeItem<>("Item 1"),
                new TreeItem<>("Item 2"),
                new TreeItem<>("Item 3")
        );
        treeView.setRoot(root);
        //treeView.setMaxWidth(0);
        webEngine = webView.getEngine();
        webEngine.load("https://www3.hhu.de/stups/prob/index.php/Main_Page");
    }
}

package de.prob2.ui.helpsystem;

import com.google.inject.Inject;
import com.google.inject.Singleton;

import de.prob2.ui.internal.StageManager;

import javafx.fxml.FXML;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.layout.StackPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;

@Singleton
public class HelpSystem extends StackPane {
    @FXML private TreeView<String> treeView;
    @FXML private WebView webView;
    WebEngine webEngine;

    @Inject
    public HelpSystem(final StageManager stageManager) {
        stageManager.loadFXML(this, "helpsystem.fxml");
        TreeItem<String> root = new TreeItem<>("Root Node");
        root.setExpanded(true);
        root.getChildren().addAll(
                new TreeItem<>("Item 1"),
                new TreeItem<>("Item 2"),
                new TreeItem<>("Item 3")
        );
        treeView.setRoot(root);
        //treeView.setMaxWidth(0);
        webEngine = webView.getEngine();
        webEngine.load("https://www3.hhu.de/stups/prob/index.php/Main_Page");
    }
}

Fix Mac menu bar in help system window


package fi.tekislauta.webserver;

import com.google.gson.Gson;
import fi.tekislauta.db.Database;
import fi.tekislauta.models.Board;
import fi.tekislauta.models.Post;
import fi.tekislauta.models.Resolvable;

import static spark.Spark.*;

import static spark.Spark.get;

public class Webserver {

    private final int port;
    private final Gson gson;
    private final Database db;

    public Webserver(int port) {
        this.port = port;
        this.gson = new Gson();
        this.db = new Database();
    }

    public void listen() {
        port(this.port);

        // spark starts listening when first method listener is added, I think ~cx
        get("/api/boards/:abbreviation", (req, res) -> {
            res.header("Content-Type","application/json");
            Board b = new Board();
            db.resolve(b, req.params("abbreviation"));
            return gson.toJson(b);
        });
    }
}

package fi.tekislauta.webserver;

import com.google.gson.Gson;
import fi.tekislauta.db.Database;
import fi.tekislauta.models.Board;
import fi.tekislauta.models.Post;
import fi.tekislauta.models.Resolvable;

import static spark.Spark.*;

import static spark.Spark.get;

public class Webserver {

    private final int port;
    private final Gson gson;
    private final Database db;

    public Webserver(int port) {
        this.port = port;
        this.gson = new Gson();
        this.db = new Database();
    }

    public void listen() {
        port(this.port);

        // spark starts listening when first method listener is added, I think ~cx
        get("/api/boards/:abbreviation", (req, res) -> {
            res.header("Content-Type","application/json; charset=utf-8");
            Board b = new Board();
            db.resolve(b, req.params("abbreviation"));
            return gson.toJson(b);
        });
    }
}

Add accidentally removed charset header


package seedu.ezdo.logic.parser;

import java.util.regex.Pattern;

import seedu.ezdo.logic.parser.ArgumentTokenizer.Prefix;

/**
 * Contains Command Line Interface (CLI) syntax definitions common to multiple commands
 */
public class CliSyntax {

    /* Prefix definitions */
    public static final Prefix PREFIX_PRIORITY = new Prefix("p/");
    public static final Prefix PREFIX_STARTDATE = new Prefix("s/");
    public static final Prefix PREFIX_DUEDATE = new Prefix("d/");
    public static final Prefix PREFIX_TAG = new Prefix("t/");

    /* Patterns definitions */
    public static final Pattern KEYWORDS_ARGS_FORMAT =
            Pattern.compile("(?<keywords>\\S+(?:\\s+\\S+)*)"); // one or more keywords separated by whitespace

}

package seedu.ezdo.logic.parser;

import java.util.regex.Pattern;

import seedu.ezdo.logic.parser.ArgumentTokenizer.Prefix;

/**
 * Contains Command Line Interface (CLI) syntax definitions common to multiple commands
 */
public class CliSyntax {

    /* Prefix definitions */
    public static final Prefix PREFIX_PRIORITY = new Prefix("p/");
    public static final Prefix PREFIX_STARTDATE = new Prefix("s/");
    public static final Prefix PREFIX_DUEDATE = new Prefix("d/");
    public static final Prefix PREFIX_TAG = new Prefix("t/");
    public static final Prefix PREFIX_MONTH = new Prefix("month/");
    public static final Prefix PREFIX_YEAR = new Prefix("year/");
    public static final Prefix PREFIX_DAY = new Prefix("day/");

    /* Patterns definitions */
    public static final Pattern KEYWORDS_ARGS_FORMAT =
            Pattern.compile("(?<keywords>\\S+(?:\\s+\\S+)*)"); // one or more keywords separated by whitespace

}

Add new prefix options for future opportunities to improve functionalities


package org.freecompany.redline;

import java.io.File;
import org.junit.Test;

public class ScannerTest extends TestBase
{

    @Test
    public void scanNoArchRPMTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-1-1.0-1.noarch.rpm" } );
    }

    @Test
    public void scanSomeArchTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-3-1.0-1.somearch.rpm" } );
    }
}

package org.freecompany.redline;

import java.io.File;
import org.junit.Test;

public class ScannerTest extends TestBase
{

    @Test
    public void scanNoArchRPMTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-1-1.0-1.noarch.rpm" } );
    }

    @Test(expected = ArrayIndexOutOfBoundsException.class)
    public void scanSomeArchTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-3-1.0-1.somearch.rpm" } );
    }
}

Fix for failing test case.


package seedu.gtd.commons.core;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import seedu.gtd.commons.core.Config;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : TaryTest\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/tasklist.xml\n" +
                "Task List name : MyTaskList";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod(){
        Config defaultConfig = new Config();
        assertFalse(defaultConfig.equals(null));
        assertTrue(defaultConfig.equals(defaultConfig));
    }

}

package seedu.gtd.commons.core;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import seedu.gtd.commons.core.Config;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : Tary\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/tasklist.xml\n" +
                "Task List name : MyTaskList";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod(){
        Config defaultConfig = new Config();
        assertFalse(defaultConfig.equals(null));
        assertTrue(defaultConfig.equals(defaultConfig));
    }

}

Make test config consistent with original config


package com.stewesho.wator;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.OrthographicCamera;

public class Main extends ApplicationAdapter {
	SpriteBatch batch;
	OrthographicCamera cam;
	WorldManager world;

	@Override
	public void create () {
		batch = new SpriteBatch();
		cam = new OrthographicCamera(50, 50);
		world = new WorldManager(25, 25);
	}

	@Override
	public void render () {
		Gdx.gl.glClearColor(0.250f, 0.250f, 0.300f, 1.000f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

		batch.setProjectionMatrix(cam.combined);
		batch.begin();

		batch.draw(world.run(), -world.getMap.getWidth()/2, -world.getMap.getHeight()/2);

		batch.end();
	}

	@Override
	public void dispose () {
		batch.dispose();
		// map.disposeResources();
	}
}

package com.stewesho.wator;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.OrthographicCamera;

public class Main extends ApplicationAdapter {
	SpriteBatch batch;
	OrthographicCamera cam;

	@Override
	public void create () {
		batch = new SpriteBatch();
		cam = new OrthographicCamera(50, 50);
	}

	@Override
	public void render () {
		Gdx.gl.glClearColor(0.250f, 0.250f, 0.300f, 1.000f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

		batch.setProjectionMatrix(cam.combined);
		batch.begin();

		// batch.draw(map.render(), -map.getWidth()/2, -map.getHeight()/2);

		batch.end();
	}

	@Override
	public void dispose () {
		batch.dispose();
		// map.disposeResources();
	}
}

Revert "added entity lists(libgdx arrays) for fishes and sharks"


package com.catpeds;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * Main class for the standalone Spring Boot application execution.
 *
 * @author padriano
 *
 */
@SpringBootApplication
public class Application {

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

}

package com.catpeds;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * Main class for the standalone Spring Boot application execution.
 *
 * @author padriano
 *
 */
@SpringBootApplication
public class Application {

	private Application() { }

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

}

Fix code smell for non instantiation


/*
 * This file is part of Relaxe.
 * Copyright (c) 2014 Topi Nieminen
 * Author: Topi Nieminen <topi.nieminen@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, see http://www.gnu.org/licenses or write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA, 02110-1301 USA.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License.
 */
package com.appspot.relaxe.ent;

import com.appspot.relaxe.ent.value.Attribute;
import com.appspot.relaxe.types.AbstractType;

public interface HasAttribute<
	V extends AbstractType<V>,
	K extends Attribute<E, V, K>,
	E extends HasAttribute<V, K, E>
> {

}

/*
 * This file is part of Relaxe.
 * Copyright (c) 2014 Topi Nieminen
 * Author: Topi Nieminen <topi.nieminen@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, see http://www.gnu.org/licenses or write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA, 02110-1301 USA.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License.
 */
package com.appspot.relaxe.ent;

import com.appspot.relaxe.ent.value.Attribute;
import com.appspot.relaxe.types.Type;

public interface HasAttribute<
	V extends Type<V>,
	K extends Attribute<E, V, K>,
	E extends HasAttribute<V, K, E>
> {

}

Use interface type instead of abstract class


//
// $Id: Cluster.java,v 1.5 2003/03/26 23:42:41 mdb Exp $

package com.threerings.whirled.spot.data;

import java.awt.Rectangle;

import com.threerings.io.SimpleStreamableObject;
import com.threerings.presents.dobj.DSet;

/**
 * Contains information on clusters.
 */
public class Cluster extends SimpleStreamableObject
    implements DSet.Entry
{
    /** A unique identifier for this cluster (also the distributed object
     * id of the cluster chat object). */
    public int clusterOid;

    /** The bounds of the cluster in the scene. */
    public int x, y, width, height;

    /**
     * Returns the "footprint" of this cluster in tile coordinates.
     */
    public Rectangle getFootprint ()
    {
        return new Rectangle(x, y, width, height);
    }

    // documentation inherited
    public Comparable getKey ()
    {
        if (_key == null) {
            _key = new Integer(clusterOid);
        }
        return _key;
    }

    // documentation inherited
    public boolean equals (Object other)
    {
        if (other instanceof Cluster) {
            return ((Cluster)other).clusterOid == clusterOid;
        } else {
            return false;
        }
    }

    // documentation inherited
    public int hashCode ()
    {
        return clusterOid;
    }

    /** Used for {@link #geyKey}. */
    protected transient Integer _key;
}

//
// $Id: Cluster.java,v 1.6 2003/03/27 15:57:47 mdb Exp $

package com.threerings.whirled.spot.data;

import java.awt.Rectangle;

import com.samskivert.util.StringUtil;

import com.threerings.io.SimpleStreamableObject;
import com.threerings.io.Streamable;

import com.threerings.presents.dobj.DSet;

/**
 * Contains information on clusters.
 */
public class Cluster extends Rectangle
    implements DSet.Entry, Streamable
{
    /** A unique identifier for this cluster (also the distributed object
     * id of the cluster chat object). */
    public int clusterOid;

    // documentation inherited
    public Comparable getKey ()
    {
        if (_key == null) {
            _key = new Integer(clusterOid);
        }
        return _key;
    }

    // documentation inherited
    public boolean equals (Object other)
    {
        if (other instanceof Cluster) {
            return ((Cluster)other).clusterOid == clusterOid;
        } else {
            return false;
        }
    }

    // documentation inherited
    public int hashCode ()
    {
        return clusterOid;
    }

    /**
     * Generates a string representation of this instance.
     */
    public String toString ()
    {
        return StringUtil.fieldsToString(this);
    }

    /** Used for {@link #geyKey}. */
    protected transient Integer _key;
}

Make cluster extend Rectangle so that we get all of its lovely methods.


package net.trajano.ms.engine.sample;

import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
import net.trajano.ms.engine.JaxRsRoute;

public class Main {

    public static void main(final String[] args) {

        final VertxOptions options = new VertxOptions();
        Vertx.clusteredVertx(options, event -> {
            final Vertx vertx = event.result();

            final Router router = Router.router(vertx);
            final HttpServer http = vertx.createHttpServer();

            JaxRsRoute.route(vertx, router, MyApp.class);
            http.requestHandler(req -> router.accept(req)).listen(8280);
        });

        //final Vertx vertx = Vertx.vertx();

    }
}

package net.trajano.ms.engine.sample;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
import net.trajano.ms.engine.JaxRsRoute;

public class Main extends AbstractVerticle {

    public static void main(final String[] args) {

        final VertxOptions options = new VertxOptions();
        Vertx.clusteredVertx(options, event -> {
            final Vertx vertx = event.result();
            vertx.deployVerticle(new Main());

        });

        //final Vertx vertx = Vertx.vertx();

    }

    @Override
    public void start() throws Exception {

        final Router router = Router.router(vertx);
        final HttpServer http = vertx.createHttpServer();

        JaxRsRoute.route(vertx, router, MyApp.class);
        http.requestHandler(req -> router.accept(req)).listen(8280);
    }
}

Convert main to a verticle


package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import seedu.ezdo.commons.core.Messages;
import seedu.ezdo.testutil.TestTask;

public class FindCommandTest extends EzDoGuiTest {

    @Test
    public void find_nonEmptyList() {
        assertFindResult("find Mark"); // no results
        assertFindResult("find Meier", td.benson, td.daniel); // multiple results

        //find after deleting one result
        commandBox.runCommand("kill 1");
        assertFindResult("find Meier", td.daniel);
    }

    @Test
    public void find_emptyList() {
        commandBox.runCommand("clear");
        assertFindResult("find Jean"); // no results
    }

    @Test
    public void find_invalidCommand_fail() {
        commandBox.runCommand("findgeorge");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
    }

    private void assertFindResult(String command, TestTask... expectedHits) {
        commandBox.runCommand(command);
        assertListSize(expectedHits.length);
        assertResultMessage(expectedHits.length + " tasks listed!");
        assertTrue(taskListPanel.isListMatching(expectedHits));
    }
}

package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import seedu.ezdo.commons.core.Messages;
import seedu.ezdo.testutil.TestTask;

public class FindCommandTest extends EzDoGuiTest {

    @Test
    public void find_nonEmptyList() {
        assertFindResult("find Mark"); // no results
        assertFindResult("find Meier", td.benson, td.daniel); // multiple results

        //find after deleting one result
        commandBox.runCommand("kill 1");
        assertFindResult("find Meier", td.daniel);
    }

    @Test
    public void find_shortCommand() {
        assertFindResult("f Mark"); // no results
        assertFindResult("f Meier", td.benson, td.daniel); // multiple results

        //find after deleting one result
        commandBox.runCommand("kill 1");
        assertFindResult("f Meier", td.daniel);
    }

    @Test
    public void find_emptyList() {
        commandBox.runCommand("clear");
        assertFindResult("find Jean"); // no results
    }

    @Test
    public void find_invalidCommand_fail() {
        commandBox.runCommand("findgeorge");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
    }

    private void assertFindResult(String command, TestTask... expectedHits) {
        commandBox.runCommand(command);
        assertListSize(expectedHits.length);
        assertResultMessage(expectedHits.length + " tasks listed!");
        assertTrue(taskListPanel.isListMatching(expectedHits));
    }
}

Add test for shortened find command


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

package com.crystalcraftmc.pvpstorm;

import org.bukkit.command.CommandExecutor;
import org.bukkit.event.Listener;

public class GameEndListener implements Listener, CommandExecutor {
    PvPStorm plugin;

    public GameEndListener(PvPStorm plugin) {
        this.plugin = plugin;
    }
}

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

package com.crystalcraftmc.pvpstorm;

import org.bukkit.command.CommandExecutor;
import org.bukkit.event.Listener;

public class GameEndListener implements Listener, CommandExecutor {
    // TODO Finish and test GameStartListener before working on this.

    PvPStorm plugin;

    public GameEndListener(PvPStorm plugin) {
        this.plugin = plugin;
    }
}

Mark for completion after GameStartListener


package org.embulk.parser.apache.log;

import org.embulk.spi.PageBuilder;
import org.embulk.spi.time.Timestamp;
import org.embulk.spi.time.TimestampParser;

import static org.embulk.spi.type.Types.TIMESTAMP;

public class TimestampLogElement extends LogElement<Timestamp> {

    private final TimestampParser parser;

    public TimestampLogElement(TimestampParser.Task task, String name, String regex) {
        this(task, name, regex, "%d/%b/%Y:%T %z");
    }

    public TimestampLogElement(TimestampParser.Task task, String name, String regex, String pattern) {
        super(name, regex, TIMESTAMP);
        this.parser = new TimestampParser(task.getJRuby(), pattern, task.getDefaultTimeZone());
    }

    @Override
    public Timestamp parse(String s) {
        try{
            return parser.parse(s);
        }catch (Exception e){
            return null;
        }
    }

    @Override
    public void setToPageBuilder(PageBuilder pageBuilder, int i, String value) {
        Timestamp parse = parse(value);
        if(parse != null){
            pageBuilder.setTimestamp(i, parse);
        }else{
            pageBuilder.setNull(i);
        }
    }
}

package org.embulk.parser.apache.log;

import org.embulk.config.ConfigSource;
import org.embulk.config.Task;
import org.embulk.spi.Exec;
import org.embulk.spi.PageBuilder;
import org.embulk.spi.time.Timestamp;
import org.embulk.spi.time.TimestampParser;

import static org.embulk.spi.type.Types.TIMESTAMP;

public class TimestampLogElement extends LogElement<Timestamp> {

    private final TimestampParser parser;

    public TimestampLogElement(TimestampParser.Task task, String name, String regex) {
        this(task, name, regex, "%d/%b/%Y:%T %z");
    }

    private static interface ParserIntlTask extends Task, TimestampParser.Task {}
    private static interface ParserIntlColumnOption extends Task, TimestampParser.TimestampColumnOption {}

    public TimestampLogElement(TimestampParser.Task task, String name, String regex, String pattern) {
        super(name, regex, TIMESTAMP);
        // TODO: Switch to a newer TimestampParser constructor after a reasonable interval.
        // Traditional constructor is used here for compatibility.
        final ConfigSource configSource = Exec.newConfigSource();
        configSource.set("format", pattern);
        configSource.set("timezone", task.getDefaultTimeZone());
        this.parser = new TimestampParser(
            Exec.newConfigSource().loadConfig(ParserIntlTask.class),
            configSource.loadConfig(ParserIntlColumnOption.class));
    }

    @Override
    public Timestamp parse(String s) {
        try{
            return parser.parse(s);
        }catch (Exception e){
            return null;
        }
    }

    @Override
    public void setToPageBuilder(PageBuilder pageBuilder, int i, String value) {
        Timestamp parse = parse(value);
        if(parse != null){
            pageBuilder.setTimestamp(i, parse);
        }else{
            pageBuilder.setNull(i);
        }
    }
}

Use traditional constructors of TimestampParser against Embulk core deprecation


/*
 * Copyright (C) 2011 Archie L. Cobbs. All rights reserved.
 *
 * $Id$
 */

/**
 * Classes supporting automated database schema management.
 *
 * <p>
 * The central classes are {@link org.dellroad.stuff.schema.SchemaUpdater} and
 * {@link org.dellroad.stuff.schema.SpringSchemaUpdater}.
 */
package org.dellroad.stuff.schema;

/*
 * Copyright (C) 2011 Archie L. Cobbs. All rights reserved.
 *
 * $Id$
 */

/**
 * Classes supporting automated database schema management.
 *
 *

 * Features include:
 *

 *
Automatic initialization of the database schema when the application runs for the first time

 *
Automatic application of database schema updates as needed during each application startup cycle

 *
Automated tracking and constraint-based ordering of schema updates supporting multiple code branches

 *
Integration with Spring allowing simple XML declaration of updates

 *
An ant task that verifies schema update correctness

 *

 *

 *
 *

 * See {@link org.dellroad.stuff.schema.SpringSchemaUpdater} for an example of how to declare your
 * {@link javax.sql.DataSource DataSource} and associated schema updates in a Spring application context.
 *

 *
 *

 * Updates may have ordering constraints, and these should be declared explicitly. Once you have done so, then
 * you may safely "cherry pick" individual schema updates for merging into different code branches without worrying
 * whether the schema will get messed up, because any ordering constraint violations will be detected automatically.
 * This verification step is required to detect inconsistencies between the updates and the current code.
 *

 *
 *

 * See DellRoad Stuff's ant macros for the {@code schemacheck}
 * ant macro that can be used to verify that your delcared schema updates, when applied to the original schema,
 * yield the expected result (which is typically generated automatically by your schema generation tool from
 * your current code). It is also a good idea to compare your generated shema matches to an expected result
 * during each build to detect schema changes caused by e.g., inadvertent changes to model classes.
 *

 *
 *

 * The central classes are {@link org.dellroad.stuff.schema.SchemaUpdater} and
 * {@link org.dellroad.stuff.schema.SpringSchemaUpdater}.
 *

 */
package org.dellroad.stuff.schema;

Add some Javadoc describing how schema updates work.


package com.satsumasoftware.timetable.db;

public final class ClassesSchema {

    public static final String TABLE_NAME = "classes";
    public static final String COL_ID = "id";
    public static final String COL_SUBJECT_ID = "subject_id";
    public static final String COL_DAY = "day";
    public static final String COL_START_TIME = "start_time";
    public static final String COL_END_TIME = "end_time";
    public static final String COL_ROOM = "room";
    public static final String COL_TEACHER = "teacher";

    protected static final String SQL_CREATE = "CREATE TABLE " + TABLE_NAME + "( " +
            COL_ID + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_SUBJECT_ID + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_DAY + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_START_TIME + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_END_TIME + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_ROOM + SchemaUtilsKt.TEXT_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_TEACHER + SchemaUtilsKt.TEXT_TYPE +
            " )";

    protected static final String SQL_DELETE =
            "DROP TABLE IF EXISTS " + TABLE_NAME;
}

package com.satsumasoftware.timetable.db;

public final class ClassesSchema {

    public static final String TABLE_NAME = "classes";
    public static final String COL_ID = "id";
    public static final String COL_SUBJECT_ID = "subject_id";
    public static final String COL_DAY = "day";
    public static final String COL_START_TIME_HRS = "start_time_hrs";
    public static final String COL_START_TIME_MINS = "start_time_mins";
    public static final String COL_END_TIME_HRS = "end_time_hrs";
    public static final String COL_END_TIME_MINS = "end_time_mins";
    public static final String COL_ROOM = "room";
    public static final String COL_TEACHER = "teacher";

    protected static final String SQL_CREATE = "CREATE TABLE " + TABLE_NAME + "( " +
            COL_ID + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_SUBJECT_ID + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_DAY + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_START_TIME_HRS + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_START_TIME_MINS + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_END_TIME_HRS + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_END_TIME_MINS + SchemaUtilsKt.INTEGER_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_ROOM + SchemaUtilsKt.TEXT_TYPE + SchemaUtilsKt.COMMA_SEP +
            COL_TEACHER + SchemaUtilsKt.TEXT_TYPE +
            " )";

    protected static final String SQL_DELETE =
            "DROP TABLE IF EXISTS " + TABLE_NAME;
}

Improve the schema for classes to store hours and minutes separately


package org.xblackcat.sjpu.builder;

import org.xblackcat.sjpu.storage.IFunctionalAH;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

/**
 * Functional builder allows only one abstract method per class/interface.
 *
 * @author xBlackCat
 */
public class FunctionalClassBuilder<Base> extends ClassBuilder<Base> {
    public FunctionalClassBuilder(IDefiner definerF, IMethodBuilder... builders) {
        super(definerF, builders);
    }

    @Override
    public <T extends Base> Class<? extends T> build(
            Class<T> target
    ) throws GeneratorException {
        int abstractCount = 0;
        for (Method m : target.getMethods()) {
            if (Modifier.isAbstract(m.getModifiers())) {
                abstractCount++;
            }
        }
        for (Method m : target.getDeclaredMethods()) {
            if (!Modifier.isPublic(m.getModifiers()) && Modifier.isAbstract(m.getModifiers())) {
                abstractCount++;
            }
        }

        if (abstractCount != 1) {
            throw new GeneratorException(
                    "Only single abstract method is allowed for implementation of " +
                            BuilderUtils.getName(IFunctionalAH.class) + ". " + BuilderUtils.getName(target) + " has " +
                            abstractCount
            );
        }

        return super.build(target);
    }
}

package org.xblackcat.sjpu.builder;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

/**
 * Functional builder allows only one abstract method per class/interface.
 *
 * @author xBlackCat
 */
public class FunctionalClassBuilder<Base> extends ClassBuilder<Base> {
    public FunctionalClassBuilder(IDefiner definerF, IMethodBuilder... builders) {
        super(definerF, builders);
    }

    @Override
    public <T extends Base> Class<? extends T> build(
            Class<T> target
    ) throws GeneratorException {
        int abstractCount = 0;
        for (Method m : target.getMethods()) {
            if (Modifier.isAbstract(m.getModifiers())) {
                abstractCount++;
            }
        }
        for (Method m : target.getDeclaredMethods()) {
            if (!Modifier.isPublic(m.getModifiers()) && Modifier.isAbstract(m.getModifiers())) {
                abstractCount++;
            }
        }

        if (abstractCount != 1) {
            throw new GeneratorException(
                    "Only single abstract method is allowed for implementation of functional interface/class. "
                            + BuilderUtils.getName(target) + " has " + abstractCount
            );
        }

        return super.build(target);
    }
}

Remove extra dependency for class builder


package com.alexrnl.gameoflife.service;

import com.alexrnl.gameoflife.world.World;

/**
 * Interface for listeners on a world in the game of life.
 * @author barfety_a
 */
public interface WorldListener {

	/**
	 * Called when a new generation has been generated.
	 * @param word
	 *        the world generated.
	 */
	void newGeneration (World word);

	/**
	 * Called when a world that was previously generated is generated again.
	 * @param world
	 *        the world generated.
	 * @param previousOccurence
	 *        the number of the generation is has occurred before.
	 */
	void loopGeneration (World world, int previousOccurence);
}

package com.alexrnl.gameoflife.service;

import com.alexrnl.gameoflife.world.World;

/**
 * Interface for listeners on a world in the game of life.
 * @author barfety_a
 */
public interface WorldListener {

	/**
	 * Called when a new generation has been generated.
	 * @param world
	 *        the world generated.
	 */
	void newGeneration (World world);

	/**
	 * Called when a world that was previously generated is generated again.
	 * @param world
	 *        the world generated.
	 * @param previousOccurence
	 *        the number of the generation is has occurred before.
	 */
	void loopGeneration (World world, int previousOccurence);
}

Fix spelling error in parameter


package org.browsermob.proxy;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.inject.Provider;

import java.util.Hashtable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

@Singleton
public class ProxyManager {
    private AtomicInteger portCounter = new AtomicInteger(9090);
    private Provider<ProxyServer> proxyServerProvider;
    private Map<Integer, ProxyServer> proxies = new ConcurrentHashMap<Integer, ProxyServer>();

    @Inject
    public ProxyManager(Provider<ProxyServer> proxyServerProvider) {
        this.proxyServerProvider = proxyServerProvider;
    }

    public ProxyServer create(Map<String, String> options) throws Exception {
        int port = portCounter.incrementAndGet();
        ProxyServer proxy = proxyServerProvider.get();

        proxy.setPort(port);
        proxy.start();
        proxy.setOptions(options);

        proxies.put(port, proxy);

        return proxy;
    }

    public ProxyServer get(int port) {
        return proxies.get(port);
    }

    public void delete(int port) throws Exception {
        ProxyServer proxy = proxies.remove(port);
        proxy.stop();
    }
}

package org.browsermob.proxy;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.inject.Provider;

import java.util.Hashtable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

@Singleton
public class ProxyManager {
    private AtomicInteger portCounter = new AtomicInteger(9090);
    private Provider<ProxyServer> proxyServerProvider;
    private Map<Integer, ProxyServer> proxies = new ConcurrentHashMap<Integer, ProxyServer>();

    @Inject
    public ProxyManager(Provider<ProxyServer> proxyServerProvider) {
        this.proxyServerProvider = proxyServerProvider;
    }

    public ProxyServer create(Map<String, String> options, int port) throws Exception {
        ProxyServer proxy = proxyServerProvider.get();
        proxy.setPort(port);
        proxy.start();
        proxy.setOptions(options);
        proxies.put(port, proxy);
        return proxy;
    }

    public ProxyServer create(Map<String, String> options) throws Exception {
        int port = portCounter.incrementAndGet();
        ProxyServer proxy = proxyServerProvider.get();

        proxy.setPort(port);
        proxy.start();
        proxy.setOptions(options);

        proxies.put(port, proxy);

        return proxy;
    }

    public ProxyServer get(int port) {
        return proxies.get(port);
    }

    public void delete(int port) throws Exception {
        ProxyServer proxy = proxies.remove(port);
        proxy.stop();
    }
}

Add constructor for proxy on specific port Create a proxy on a specific port rather than just increment the count


package br.com.MDSGPP.ChamadaParlamentar.exception;

/*esta exception é para verificar se a data foi inserida *
 * corretamente pelo usuario *
 */
public class DataFormatoErradoException extends Exception {

	private static final long serialVersionUID = 1L;

	public DataFormatoErradoException() {
		super();
	}

}

package br.com.MDSGPP.ChamadaParlamentar.exception;

/*esta exception é para verificar se a data foi inserida *
 * corretamente pelo usuario *
 */
public class DataFormatoErradoException extends Exception {

	private static final long serialVersionUID = 1L;

	/**
	 * This exception is to check whether the date was entered correctly by
	 * User.
	 */

	public DataFormatoErradoException() {
		super();
	}

}

Comment the method of class DataFormatoErradoExce


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

import com.diffplug.gradle.oomph.IUs;
import com.diffplug.gradle.oomph.OomphIdeExtension;

/**
 * Adds the [minimalist gradle editor](https://github.com/Nodeclipse/nodeclipse-1/tree/master/org.nodeclipse.enide.editors.gradle).
 */
public class ConventionMinimalistGradleEditor extends WithRepoConvention {
	public static final String REPO = "https://www.nodeclipse.org/updates/gradle-ide-pack/";
	public static final String FEATURE = "org.nodeclipse.enide.editors.gradle.feature";

	ConventionMinimalistGradleEditor(OomphIdeExtension extension) {
		super(extension, REPO);
		requireIUs(IUs.featureGroup(FEATURE));
	}
}

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

import com.diffplug.gradle.oomph.IUs;
import com.diffplug.gradle.oomph.OomphIdeExtension;

/**
 * Adds the [minimalist gradle editor](https://github.com/Nodeclipse/nodeclipse-1/tree/master/org.nodeclipse.enide.editors.gradle).
 */
public class ConventionMinimalistGradleEditor extends WithRepoConvention {
	public static final String REPO = "https://nodeclipse.github.io/updates/gradle-ide-pack/";
	public static final String FEATURE = "org.nodeclipse.enide.editors.gradle.feature";

	ConventionMinimalistGradleEditor(OomphIdeExtension extension) {
		super(extension, REPO);
		requireIUs(IUs.featureGroup(FEATURE));
	}
}

Update URL for the minimalistGradleEditor update-site.


package cn.six.uav.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by songzhw on 2016/3/10.
 */
public class CommandRunner {

    private List<String> outputs;

    public void run(List<String> cmds) throws Exception {
        outputs = new ArrayList<>();
        ProcessBuilder procBuilder = new ProcessBuilder(cmds)
                                            .redirectErrorStream(true);
        final Process proc = procBuilder.start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                String line;
                outputs.clear();
                try {
                    InputStream is = proc.getInputStream();
                    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
                    while( (line = reader.readLine()) != null){
                        outputs.add(line);
                    }

                    for(String aline : outputs){
                        System.out.println("szw line = "+aline);
                    }

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

    }
}

package cn.six.uav.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by songzhw on 2016/3/10.
 */
public class CommandRunner {

    private List<String> outputs;

    public int run(List<String> cmds) throws Exception {
        outputs = new ArrayList<>();
        ProcessBuilder procBuilder = new ProcessBuilder(cmds)
                                            .redirectErrorStream(true);
        final Process proc = procBuilder.start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                String line;
                outputs.clear();
                try {
                    InputStream is = proc.getInputStream();
                    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
                    while( (line = reader.readLine()) != null){
                        outputs.add(line);
                    }

                    for(String aline : outputs){
                        System.out.println("szw line = "+aline);
                    }

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

        return proc.waitFor();
    }
}

Fix the bug : the running of two processes are not synchronous


/*
 * Created on 28-Jan-2006
 */
package uk.org.ponder.htmlutil;

public class HTMLConstants {

  public static final String JS_BLOCK_START = "\n//<![CDATA[\n";
  public static final String JS_BLOCK_END = "\n//]]>\n";

  public static String[][] tagtoURL = {
    {"href", "<a ", "<link "},
    {"src", "<img ", "<frame ", "<script ", "<iframe ", "<style ", "<input ", "<embed "},
    {"action", "<form "}
  };
// Every tag may have a "background" attribute holding a URL
  public static String[] ubiquitousURL = {"background"};
}

/*
 * Created on 28-Jan-2006
 */
package uk.org.ponder.htmlutil;

public class HTMLConstants {

  public static final String JS_BLOCK_START = "\n//<![CDATA[\n";
  public static final String JS_BLOCK_END = "\n//]]>\n";

  public static String[][] tagtoURL = {
    {"href", "<a ", "<link "},
    {"src", "<img ", "<frame ", "<script ", "<iframe ", "<style ", "<input ", "<embed ", },
    {"action", "<form "},
    {"codebase", "<applet ", "<object "}
  };
// Every tag may have a "background" attribute holding a URL
  public static String[] ubiquitousURL = {"background"};
}

Support for applet and object codebase


/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Ivan Maslov
 *
 * 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 info.maslowis.twitterripper.command;

import twitter4j.Twitter;

/**
 * The superclass for any twitter command
 *
 * @author Ivan Maslov
 */
public abstract class TwitterCommand extends Command {
    protected Twitter twitter;

    protected TwitterCommand(Twitter twitter) {
        super();
        this.twitter = twitter;
    }
}

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Ivan Maslov
 *
 * 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 info.maslowis.twitterripper.command;

import twitter4j.Twitter;
import twitter4j.TwitterFactory;

/**
 * The superclass for any twitter command
 *
 * @author Ivan Maslov
 */
public abstract class TwitterCommand extends Command {
    protected Twitter twitter;

    protected TwitterCommand() {
        super();
        this.twitter = TwitterFactory.getSingleton();
    }
}

Change reference on the twitter's singleton


package com.newsblur.activity;

import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.newsblur.R;
import com.newsblur.util.PrefConstants;

import android.os.Bundle;

public class Settings extends SherlockPreferenceActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.getPreferenceManager().setSharedPreferencesName(PrefConstants.PREFERENCES);
        addPreferencesFromResource(R.layout.activity_settings);
    }

}

package com.newsblur.activity;

import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.actionbarsherlock.view.MenuItem;
import com.newsblur.R;
import com.newsblur.util.PrefConstants;

import android.os.Bundle;

public class Settings extends SherlockPreferenceActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        super.getPreferenceManager().setSharedPreferencesName(PrefConstants.PREFERENCES);
        addPreferencesFromResource(R.layout.activity_settings);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case android.R.id.home:
            finish();
            return true;
        default:
            return super.onOptionsItemSelected(item);
        }
    }
}

Support navigating back to home page from action bar in Preferences


package main.managepdf;

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

/**
 * Define funes para gerenciar em um PDF.
 * @author Alex
 *
 * @param <T> - Tipo da informao a ser gerenciada.
 */
public interface ManageBasePDF<T>{

	/**
	 * Cria um PDF com anotaes.
	 * @param infos - lista de anotaes a serem adicionadas a um PDF
	 * @param pdfFile - O pdf sem as anotaes
	 * @return pdf com anotaes
	 * @throws FileNotFoundException - Pdf nao foi encontrado
	 */
	public File createPDFWithInfo(List<T> objects, File pdfFile) throws FileNotFoundException;

}

package main.managepdf;

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

/**
 * Define funes para gerenciar em um PDF.
 * @author Alex
 *
 * @param <T> - Tipo da informao a ser gerenciada.
 */
public interface ManageBasePDF<T>{

	/**
	 * Cria um PDF com anotaes.
	 * @param infos - lista de anotaes a serem adicionadas a um PDF
	 * @param pdfFile - O pdf sem as anotaes
	 * @return pdf com anotaes
	 * @throws FileNotFoundException - Pdf nao foi encontrado
	 * @throws IOException - Erro ao tentar salvar PDF com anotaes
	 */
	public File createPDFWithInfo(List<T> objects, File pdfFile) throws FileNotFoundException, IOException;

}

Add de execessao ao tentar salvar PDF com anotações


package org.pdxfinder.dao;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;

/**
 * Created by jmason on 17/03/2017.
 */
@NodeEntity
public class QualityAssurance {

    @GraphId
    Long id;

    private String technology;
    private String description;
    private String passages;

    public QualityAssurance() {
    }

    public QualityAssurance(String technology, String description, String passages) {
        this.technology = technology;
        this.description = description;

        this.passages = passages;
    }

    public String getTechnology() {
        return technology;
    }

    public void setTechnology(String technology) {
        this.technology = technology;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPassages() {
        return passages;
    }

    public void setPassages(String passages) {
        this.passages = passages;
    }
}

package org.pdxfinder.dao;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;

/**
 * Created by jmason on 17/03/2017.
 */
@NodeEntity
public class QualityAssurance {

    @GraphId
    Long id;

    private String technology;
    private String description;
    private String passages;
    private String validationHostStrain;

    public QualityAssurance() {
    }

    public QualityAssurance(String technology, String description, String passages) {
        this.technology = technology;
        this.description = description;

        this.passages = passages;
    }

    public QualityAssurance(String technology, String description, String passages, String validationHostStrain) {
        this.technology = technology;
        this.description = description;
        this.passages = passages;
        this.validationHostStrain = validationHostStrain;
    }

    public String getTechnology() {
        return technology;
    }

    public void setTechnology(String technology) {
        this.technology = technology;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPassages() {
        return passages;
    }

    public void setPassages(String passages) {
        this.passages = passages;
    }

    public String getValidationHostStrain() {
        return validationHostStrain;
    }

    public void setValidationHostStrain(String validationHostStrain) {
        this.validationHostStrain = validationHostStrain;
    }
}

Add host strain to validation


package org.wikipedia.dataclient.mwapi;

import android.support.annotation.Nullable;

import com.google.gson.annotations.SerializedName;

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

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

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

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

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

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

package org.wikipedia.dataclient.mwapi;

import android.support.annotation.Nullable;

import com.google.gson.annotations.SerializedName;

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

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

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

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

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

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

Update field name from API response.


package cucumber.runtime.java;

import cucumber.api.java.ObjectFactory;
import cucumber.runtime.CucumberException;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;

/**
 * This class has package scope so it doesn't get loaded by reflection,
 * thereby colliding with other DI implementations.
 */
class DefaultJavaObjectFactory implements ObjectFactory {
    private final Map<Class<?>, Object> instances = new HashMap<Class<?>, Object>();

    public void start() {
        // No-op
    }

    public void stop() {
        instances.clear();
    }

    public boolean addClass(Class<?> clazz) {
        return true;
    }

    public <T> T getInstance(Class<T> type) {
        T instance = type.cast(instances.get(type));
        if (instance == null) {
            instance = cacheNewInstance(type);
        }
        return instance;
    }

    private <T> T cacheNewInstance(Class<T> type) {
        try {
            Constructor<T> constructor = type.getConstructor();
            T instance = constructor.newInstance();
            instances.put(type, instance);
            return instance;
        } catch (NoSuchMethodException e) {
            throw new CucumberException(String.format("%s doesn't have an empty constructor. If you need DI, put cucumber-picocontainer on the classpath", type), e);
        } catch (Exception e) {
            throw new CucumberException(String.format("Failed to instantiate %s", type), e);
        }
    }
}

package cucumber.runtime.java;

import cucumber.api.java.ObjectFactory;
import cucumber.runtime.CucumberException;

import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;

/**
 * This class has package scope so it doesn't get loaded by reflection,
 * thereby colliding with other DI implementations.
 */
class DefaultJavaObjectFactory implements ObjectFactory {
    private final Map<Class<?>, Object> instances = new HashMap<Class<?>, Object>();

    public void start() {
        // No-op
    }

    public void stop() {
        instances.clear();
    }

    public boolean addClass(Class<?> clazz) {
        return true;
    }

    public <T> T getInstance(Class<T> type) {
        T instance = type.cast(instances.get(type));
        if (instance == null) {
            instance = cacheNewInstance(type);
        }
        return instance;
    }

    private <T> T cacheNewInstance(Class<T> type) {
        try {
            Constructor<T> constructor = type.getConstructor();
            T instance = constructor.newInstance();
            instances.put(type, instance);
            return instance;
        } catch (NoSuchMethodException e) {
            throw new CucumberException(String.format("%s doesn't have an empty constructor. If you need DI, put cucumber-picocontainer on the classpath", type), e);
        } catch (Exception e) {
            throw new CucumberException(String.format("Failed to instantiate %s", type), e);
        }
    }
}

Use service loader for ObjectFactory


/*
 * This file is part of Bisq.
 *
 * Bisq is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 *
 * Bisq is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Bisq. If not, see <http://www.gnu.org/licenses/>.
 */

package bisq.network.p2p.storage;

import bisq.network.p2p.storage.payload.ProtectedStorageEntry;

import java.util.Collection;

public interface HashMapChangedListener {
    void onAdded(Collection<ProtectedStorageEntry> protectedStorageEntries);

    @SuppressWarnings("UnusedParameters")
    void onRemoved(Collection<ProtectedStorageEntry> protectedStorageEntries);
}

/*
 * This file is part of Bisq.
 *
 * Bisq is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 *
 * Bisq is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Bisq. If not, see <http://www.gnu.org/licenses/>.
 */

package bisq.network.p2p.storage;

import bisq.network.p2p.storage.payload.ProtectedStorageEntry;

import java.util.Collection;

public interface HashMapChangedListener {
    void onAdded(Collection<ProtectedStorageEntry> protectedStorageEntries);

    default void onRemoved(Collection<ProtectedStorageEntry> protectedStorageEntries) {
        // Often we are only interested in added data as there is no use case for remove
    }
}

Make onRemoved default in interface