package org.realityforge.replicant.client;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nonnull;

/**
 * Representation of a subscriptions that impact entity.
 */
public class EntitySubscriptionEntry
{
  private final Map<GraphDescriptor, GraphSubscriptionEntry> _graphSubscriptions =
    new HashMap<GraphDescriptor, GraphSubscriptionEntry>();
  private final Map<GraphDescriptor, GraphSubscriptionEntry> _roGraphSubscriptions =
    Collections.unmodifiableMap( _graphSubscriptions );
  private final Class<?> _type;
  private final Object _id;

  public EntitySubscriptionEntry( @Nonnull final Class<?> type, @Nonnull final Object id )
  {
    _type = type;
    _id = id;
  }

  @Nonnull
  public Class<?> getType()
  {
    return _type;
  }

  @Nonnull
  public Object getID()
  {
    return _id;
  }

  public Map<GraphDescriptor, GraphSubscriptionEntry> getGraphSubscriptions()
  {
    return _roGraphSubscriptions;
  }

  final Map<GraphDescriptor, GraphSubscriptionEntry> getRwGraphSubscriptions()
  {
    return _graphSubscriptions;
  }
}

package org.realityforge.replicant.client;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nonnull;

/**
 * Representation of a subscriptions that impact entity.
 */
public class EntitySubscriptionEntry
{
  private final Map<GraphDescriptor, GraphSubscriptionEntry> _graphSubscriptions = new HashMap<>();
  private final Map<GraphDescriptor, GraphSubscriptionEntry> _roGraphSubscriptions =
    Collections.unmodifiableMap( _graphSubscriptions );
  private final Class<?> _type;
  private final Object _id;

  public EntitySubscriptionEntry( @Nonnull final Class<?> type, @Nonnull final Object id )
  {
    _type = type;
    _id = id;
  }

  @Nonnull
  public Class<?> getType()
  {
    return _type;
  }

  @Nonnull
  public Object getID()
  {
    return _id;
  }

  public Map<GraphDescriptor, GraphSubscriptionEntry> getGraphSubscriptions()
  {
    return _roGraphSubscriptions;
  }

  final Map<GraphDescriptor, GraphSubscriptionEntry> getRwGraphSubscriptions()
  {
    return _graphSubscriptions;
  }
}

Use a diamond operator where possible

Use a diamond operator where possible


package com.thaiopensource.relaxng;

import org.relaxng.datatype.ValidationContext;

import org.xml.sax.SAXException;

class AttributeAtom extends Atom {
  String namespaceURI;
  String localName;
  StringAtom value;

  AttributeAtom(String namespaceURI, String localName, String value, ValidationContext vc) {
    this.namespaceURI = namespaceURI;
    this.localName = localName;
    this.value = value == null ? null : new StringAtom(value, vc);
  }
  boolean matchesAttribute(PatternBuilder b, NameClass nc, Pattern valuePattern) {
    return (nc.contains(namespaceURI, localName)
	    && (value == null
		|| valuePattern.residual(b, value).isNullable()));
  }
  boolean isAttribute() {
    return true;
  }
}

package com.thaiopensource.relaxng;

import org.relaxng.datatype.ValidationContext;

import org.xml.sax.SAXException;

class AttributeAtom extends Atom {
  String namespaceURI;
  String localName;
  StringAtom value;

  AttributeAtom(String namespaceURI, String localName, String value, ValidationContext vc) {
    this.namespaceURI = namespaceURI;
    this.localName = localName;
    this.value = value == null ? null : new StringAtom(value, vc);
  }
  boolean matchesAttribute(PatternBuilder b, NameClass nc, Pattern valuePattern) {
    if (!nc.contains(namespaceURI, localName))
      return false;
    if (value == null)
      return true;
    if (value.isEmpty() && valuePattern.isNullable())
      return true;
    return valuePattern.residual(b, value).isNullable();
  }
  boolean isAttribute() {
    return true;
  }
}

Allow an empty attribute value to match <empty/>.


package br.com.caelum.brutal.infra;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5 {
    /**
     * Encodes a string
     *
     * @param str
     *            String to encode
     * @return Encoded String
     */
    public static String crypt(String str) {
        if (str == null || str.length() == 0) return str;

        StringBuffer hexString = new StringBuffer();

        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(str.getBytes());
            byte[] hash = md.digest();

            for (int i = 0; i < hash.length; i++) {
                if ((0xff & hash[i]) < 0x10) {
                    hexString.append("0" + Integer.toHexString((0xFF & hash[i])));
                } else {
                    hexString.append(Integer.toHexString(0xFF & hash[i]));
                }
            }
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }

        return hexString.toString();
    }
}

package br.com.caelum.brutal.infra;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5 {
    /**
     * Encodes a string
     *
     * @param str
     *            String to encode
     * @return Encoded String
     */
    public static String crypt(String str) {
        if (str == null || str.length() == 0) {
            throw new IllegalArgumentException("String to encript cannot be null or zero length");
        }

        StringBuffer hexString = new StringBuffer();

        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(str.getBytes());
            byte[] hash = md.digest();

            for (int i = 0; i < hash.length; i++) {
                if ((0xff & hash[i]) < 0x10) {
                    hexString.append("0" + Integer.toHexString((0xFF & hash[i])));
                } else {
                    hexString.append(Integer.toHexString(0xFF & hash[i]));
                }
            }
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }

        return hexString.toString();
    }
}

Revert "parando de lançar exceção"

Revert "parando de lançar exceção"

This reverts commit 6153703a5c2a3d4dda559c2b8bc285760b4f9bf1.


package com.mesc.service.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = { "com.mesc.service.controller" })
@Import({PersistenceContext.class})
public class ApplicationContext {
	@Configuration
    @PropertySource("classpath:application.properties")
    static class ApplicationProperties {}

	@Bean
    PropertySourcesPlaceholderConfigurer propertyPlaceHolderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }
}

package com.mesc.service.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = { "com.mesc.service.controller", "com.mesc.service.services" })
@Import({PersistenceContext.class})
public class ApplicationContext {
	@Configuration
    @PropertySource("classpath:application.properties")
    static class ApplicationProperties {}

	@Bean
    PropertySourcesPlaceholderConfigurer propertyPlaceHolderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }
}

Change on component scan to support AutoWired


package de.jotomo.ruffy.spi;

public class BasalProfile {
    public final int number;
    public final double[] hourlyRates;

    public BasalProfile(int number, double[] hourlyRates) {
        this.number = number;
        if (hourlyRates.length != 24)
            throw new IllegalArgumentException("Profile must have 24 hourly rates");
        this.hourlyRates = hourlyRates;
    }
}

package de.jotomo.ruffy.spi;

public class BasalProfile {
    public final double[] hourlyRates;

    public BasalProfile( double[] hourlyRates) {
        this.hourlyRates = hourlyRates;
    }
}

Remove basal rate profile number, only using one.


package nerd.tuxmobil.fahrplan.congress.base;

import android.support.v4.app.ListFragment;

import nerd.tuxmobil.fahrplan.congress.models.Lecture;

/**
 * A fragment representing a list of Items.
 *

 * Large screen devices (such as tablets) are supported by replacing the ListView
 * with a GridView.
 *

 * Activities containing this fragment MUST implement the {@link OnLectureListClick}
 * interface.
 */
public abstract class AbstractListFragment extends ListFragment {

    /**
     * This interface must be implemented by activities that contain this
     * fragment to allow an interaction in this fragment to be communicated
     * to the activity and potentially other fragments contained in that
     * activity.
     *
     * @param lecture                The lecture which was clicked.
     * @param requiresScheduleReload Boolean flag to indicate whether the schedule
     *                               must be reload from the data source or not.
     */
    public interface OnLectureListClick {
        void onLectureListClick(Lecture lecture, boolean requiresScheduleReload);
    }

}

package nerd.tuxmobil.fahrplan.congress.base;

import android.support.v4.app.ListFragment;

import nerd.tuxmobil.fahrplan.congress.models.Lecture;

/**
 * A fragment representing a list of Items.
 *

 * Large screen devices (such as tablets) are supported by replacing the ListView
 * with a GridView.
 *

 * Activities containing this fragment MUST implement the {@link OnLectureListClick}
 * interface.
 */
public abstract class AbstractListFragment extends ListFragment {

    public interface OnLectureListClick {

        /**
         * This interface must be implemented by activities that contain this
         * fragment to allow an interaction in this fragment to be communicated
         * to the activity and potentially other fragments contained in that
         * activity.
         *
         * @param lecture                The lecture which was clicked.
         * @param requiresScheduleReload Boolean flag to indicate whether the schedule
         *                               must be reload from the data source or not.
         */
        void onLectureListClick(Lecture lecture, boolean requiresScheduleReload);
    }

}

Fix JavaDoc "Cannot resolved symbol" issues.


/*
 * FindBugs - Find Bugs in Java programs
 * Copyright (C) 2003-2008 University of Maryland
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package edu.umd.cs.findbugs.classfile.engine.asm;

import static java.lang.Boolean.parseBoolean;
import static java.util.Objects.isNull;

import org.objectweb.asm.Opcodes;

/**
 * @author pugh
 */
public class FindBugsASM {

    private static final String EXPERIMENTAL_PROPERTY_VALUE = System.getProperty("spotbugs.experimental");
    private static final boolean USE_EXPERIMENTAL = isNull(EXPERIMENTAL_PROPERTY_VALUE) || parseBoolean(EXPERIMENTAL_PROPERTY_VALUE);

    public static final int ASM_VERSION = USE_EXPERIMENTAL ? Opcodes.ASM7_EXPERIMENTAL : Opcodes.ASM6;

}

/*
 * FindBugs - Find Bugs in Java programs
 * Copyright (C) 2003-2008 University of Maryland
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package edu.umd.cs.findbugs.classfile.engine.asm;

import org.objectweb.asm.Opcodes;

/**
 * @author pugh
 */
public class FindBugsASM {

    private static final boolean USE_EXPERIMENTAL = Boolean.parseBoolean(System.getProperty("spotbugs.experimental", "true"));

    public static final int ASM_VERSION = USE_EXPERIMENTAL ? Opcodes.ASM7_EXPERIMENTAL : Opcodes.ASM6;

}

Use System.getProperty("spotbugs.experimental", "true") to simplify code


package com.tisawesomeness.minecord.command.misc;

import com.tisawesomeness.minecord.Bot;
import com.tisawesomeness.minecord.command.Command;
import com.tisawesomeness.minecord.util.MessageUtils;

import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.utils.MarkdownUtil;

public class VoteCommand extends Command {

    public CommandInfo getInfo() {
		return new CommandInfo(
			"vote",
			"Vote for the bot!",
			null,
			new String[]{"upvote", "updoot", "rep"},
			0,
			false,
			false,
			false
		);
    }

    public Result run(String[] args, MessageReceivedEvent e) throws Exception {
        String m = "Top.gg: " + MarkdownUtil.maskedLink("VOTE", "https://top.gg/bot/292279711034245130/vote");
        return new Result(Outcome.SUCCESS, MessageUtils.embedMessage("Vote for Minecord!", null, m, Bot.color));
    }

}

package com.tisawesomeness.minecord.command.misc;

import com.tisawesomeness.minecord.Bot;
import com.tisawesomeness.minecord.command.Command;
import com.tisawesomeness.minecord.util.MessageUtils;

import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.utils.MarkdownUtil;

public class VoteCommand extends Command {

    public CommandInfo getInfo() {
		return new CommandInfo(
			"vote",
			"Vote for the bot!",
			null,
			new String[]{"v", "upvote", "updoot", "rep"},
			0,
			false,
			false,
			false
		);
    }

    public Result run(String[] args, MessageReceivedEvent e) throws Exception {
        String m = "Top.gg: " + MarkdownUtil.maskedLink("VOTE", "https://top.gg/bot/292279711034245130/vote");
        return new Result(Outcome.SUCCESS, MessageUtils.embedMessage("Vote for Minecord!", null, m, Bot.color));
    }

}

Add &v as alias for &vote

Add &v as alias for &vote


/**
   Copyright 2017 Carlos Macasaet

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

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

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

/**
 * This exception indicates that a Fernet token could not be created because one or more of the parameters was invalid.
 *
 *
Copyright © 2017 Carlos Macasaet.

 *
 * @author Carlos Macasaet
 */
public class IllegalTokenException extends IllegalArgumentException {

    private static final long serialVersionUID = 8019898267609912205L;

    public IllegalTokenException(final String message) {
        super(message);
    }

    public IllegalTokenException(final String message, final Throwable cause) {
        super(message, cause);
    }

}

/**
   Copyright 2017 Carlos Macasaet

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

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

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

/**
 * This exception indicates that a Fernet token could not be created because one or more of the parameters was invalid.
 *
 *
Copyright © 2017 Carlos Macasaet.

 *
 * @author Carlos Macasaet
 */
public class IllegalTokenException extends IllegalArgumentException {

    private static final long serialVersionUID = -1794971941479648725L;

    public IllegalTokenException(final String message) {
        super(message);
    }

    public IllegalTokenException(final String message, final Throwable cause) {
        super(message, cause);
    }

}

Update serialVersionUID for updated public API


package tld.testmod.common.animation;

import net.minecraft.world.World;
import net.minecraftforge.client.model.animation.Animation;
import tld.testmod.ModLogger;

public enum ModAnimation
{

    INSTANCE;
    static long timeOffset;
    static Object lastWorld;

    /**
     * Get the global world time for the current tick, in seconds.
     */
    public static float getWorldTime(World world)
    {
        return getWorldTime(world, 0);
    }

    /**
     * Get the global world time for the current tick + partial tick progress, in seconds.
     */
    public static float getWorldTime(World world, float tickProgress)
    {
        if (!world.equals(lastWorld))
        {
            timeOffset = world.getTotalWorldTime();
            lastWorld = world;
        }
        long diff = world.getTotalWorldTime() - timeOffset;
        //ModLogger.info("Animation#getWorldTime: World: %s, time: %d, offset %d, diff: %d", lastWorld, world.getTotalWorldTime(), timeOffset, diff);
        return (world.getTotalWorldTime() - timeOffset  + tickProgress) / 20;
    }

    /**
     * Get current partialTickTime.
     */
    public static float getPartialTickTime()
    {
        return Animation.getPartialTickTime();
    }

}

package tld.testmod.common.animation;

import net.minecraft.world.World;
import net.minecraftforge.client.model.animation.Animation;

public enum ModAnimation
{

    INSTANCE;
    static long timeOffset;
    static int lastWorldHashCode;

    /**
     * Get the global world time for the current tick, in seconds.
     */
    public static float getWorldTime(World world)
    {
        return getWorldTime(world, 0);
    }

    /**
     * Get the global world time for the current tick + partial tick progress, in seconds.
     */
    public static float getWorldTime(World world, float tickProgress)
    {
        int worldHashCode = world.hashCode();
        if (worldHashCode != lastWorldHashCode)
        {
            timeOffset = world.getTotalWorldTime();
            lastWorldHashCode = worldHashCode;
        }
        //long diff = world.getTotalWorldTime() - timeOffset;
        //ModLogger.info("Animation#getWorldTime: World: %s, time: %d, offset %d, diff: %d", lastWorldHashCode, world.getTotalWorldTime(), timeOffset, diff);
        return (world.getTotalWorldTime() - timeOffset  + tickProgress) / 20;
    }

    /**
     * Get current partialTickTime.
     */
    public static float getPartialTickTime()
    {
        return Animation.getPartialTickTime();
    }

}

Use the world hashcode instead of the world instance.


package com.sailthru.client.params.job;

import com.google.gson.reflect.TypeToken;
import com.sailthru.client.params.ApiFileParams;

import java.io.File;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;

public class PurchaseImportJob extends Job implements ApiFileParams {

    protected transient File file = null;

    public PurchaseImportJob() {
        this.job = "purchase_import";
    }

    public PurchaseImportJob setFile(String filePath) {
        this.file = new File(filePath);
        return this;
    }

    public PurchaseImportJob setFile(File file) {
        this.file = file;
        return this;
    }

    @Override
    public Type getType() {
        return new TypeToken<PurchaseImportJob>() {}.getType();
    }

    public Map<String, File> getFileParams() {
        Map<String, File> files = new HashMap<String, File>();
        if (this.file != null) {
            files.put("file", this.file);
        }
        return files;
    }
}

package com.sailthru.client.params.job;

import com.google.gson.reflect.TypeToken;
import com.sailthru.client.params.ApiFileParams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;

public class PurchaseImportJob extends Job implements ApiFileParams {
    protected static Logger logger = LoggerFactory.getLogger(PurchaseImportJob.class);
    protected transient FileInputStream file = null;

    public PurchaseImportJob() {
        this.job = "purchase_import";
    }

    public PurchaseImportJob setFile(String filePath) {
        try {
            this.file = new FileInputStream(filePath);
        } catch (FileNotFoundException e) {
            logger.error(e.getMessage());
        }
        return this;
    }

    public PurchaseImportJob setFile(File file) {
        try {
            this.file = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            logger.error(e.getMessage());
        }
        return this;
    }

    @Override
    public Type getType() {
        return new TypeToken<PurchaseImportJob>() {}.getType();
    }

    public Map<String, FileInputStream> getFileParams() {
        Map<String, FileInputStream> files = new HashMap<String, FileInputStream>();
        if (this.file != null) {
            files.put("file", this.file);
        }
        return files;
    }
}

SRE-9014: Change implementation from File to FileInputStream


package org.ensembl.healthcheck.testcase.funcgen;

import java.sql.Connection;

import org.ensembl.healthcheck.DatabaseRegistryEntry;
import org.ensembl.healthcheck.ReportManager;

public abstract class AbstractExternalFileUsingTestcase extends AbstractCoreDatabaseUsingTestCase {

	protected String getSpeciesAssemblyDataFileBasePath(DatabaseRegistryEntry dbre) {

		Connection coreConnection = getCoreDb(dbre).getConnection();

		String productionName = getProductionName(coreConnection);
		String assemblyName   = getAssembly(coreConnection);
		String dbFileRootDir  = getDataFileBasePath();

		if (dbFileRootDir.equals("")) {
			ReportManager.problem(this, dbre.getConnection(), "datafile_base_path has not been set!");
		}
		String speciesAssemblyDataFileBasePath = dbFileRootDir + "/" + productionName + "/" + assemblyName;

		return speciesAssemblyDataFileBasePath;
	}
}

package org.ensembl.healthcheck.testcase.funcgen;

import java.sql.Connection;

import org.ensembl.healthcheck.DatabaseRegistryEntry;
import org.ensembl.healthcheck.ReportManager;

/**
 * @author mnuhn
 *
 * Abstract class providing method "getSpeciesAssemblyDataFileBasePath". This
 * can be used to write checks for external files.
 *
 */
public abstract class AbstractExternalFileUsingTestcase extends AbstractCoreDatabaseUsingTestCase {

	protected String getSpeciesAssemblyDataFileBasePath(DatabaseRegistryEntry dbre) {

		Connection coreConnection = getCoreDb(dbre).getConnection();

		String productionName = getProductionName(coreConnection);
		String assemblyName   = getAssembly(coreConnection);
		String dbFileRootDir  = getDataFileBasePath();

		if (dbFileRootDir.equals("")) {
			ReportManager.problem(this, dbre.getConnection(), "datafile_base_path has not been set!");
		}
		String speciesAssemblyDataFileBasePath = dbFileRootDir + "/" + productionName + "/" + assemblyName;

		return speciesAssemblyDataFileBasePath;
	}
}

Update with some boilerplate comment header


/*
 * 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.catalina.tribes;

/**
 *
 *
Title: MessageListener

 *
 *
Description: The listener to be registered with the ChannelReceiver, internal Tribes component

 *
 * @author Filip Hanik
 * @version 1.0
 */

public interface MessageListener {

    /**
     * Receive a message from the IO components in the Channel stack
     * @param msg ChannelMessage
     */
    public void messageReceived(ChannelMessage msg);

    public boolean accept(ChannelMessage msg);

    @Override
    public boolean equals(Object listener);

    @Override
    public int hashCode();

}

/*
 * 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.catalina.tribes;

/**
 *
 *
Title: MessageListener

 *
 *
Description: The listener to be registered with the ChannelReceiver, internal Tribes component

 *
 * @author Filip Hanik
 * @version 1.0
 */

public interface MessageListener {

    /**
     * Receive a message from the IO components in the Channel stack
     * @param msg ChannelMessage
     */
    public void messageReceived(ChannelMessage msg);

    public boolean accept(ChannelMessage msg);
}

REmove unnecessary methods from interface

git-svn-id: 79cef5a5a257cc9dbe40a45ac190115b4780e2d0@1222403 13f79535-47bb-0310-9956-ffa450edef68


package ru.agentlab.maia.event;

import java.util.Objects;

import ru.agentlab.maia.IEvent;

public abstract class Event<T> implements IEvent<T> {

	protected final T payload;

	public Event(T payload) {
		this.payload = payload;
	}

	@Override
	public T getPayload() {
		return payload;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (obj == this) {
			return true;
		}
		if (obj instanceof IEvent<?>) {
			IEvent<?> other = (IEvent<?>) obj;
			return (payload == other.getPayload()) && (this.getType() == other.getType());
		} else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return Objects.hash(getType(), payload);
	}

}

package ru.agentlab.maia.event;

import java.util.Objects;

import ru.agentlab.maia.IEvent;

public abstract class Event<T> implements IEvent<T> {

	protected final T payload;

	public Event(T payload) {
		this.payload = payload;
	}

	@Override
	public T getPayload() {
		return payload;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (obj == this) {
			return true;
		}
		if (obj instanceof IEvent<?>) {
			IEvent<?> other = (IEvent<?>) obj;
			return (payload == other.getPayload()) && (this.getType() == other.getType());
		} else {
			return false;
		}
	}

	@Override
	public String toString() {
		return getClass().getSimpleName() + " " + payload.toString();
	}

	@Override
	public int hashCode() {
		return Objects.hash(getType(), payload);
	}

}

Change toString() serializations for debug


package aya.entities;

import java.util.ArrayList;
import java.util.EmptyStackException;

import aya.obj.Obj;
import aya.obj.block.Block;

public class Tuple {
	Block[] elements;

	/**
	 * Tuples will not need to be resized during runtime
	 * @param blocks
	 */
	public Tuple(Block[] blocks) {
		elements = blocks;
	}

	/**
	 * evals each of the blocks and returns an array containing each
	 * of the results
	 * @return
	 */
	public ArrayList<Obj> evalToResults() {
		ArrayList<Obj> out = new ArrayList<Obj>(elements.length);
		for (int i = 0; i < elements.length; i++) {
			Block b = elements[i].duplicate();
			try {
				b.eval();
			} catch (EmptyStackException e) {
				throw new RuntimeException("Empty Stack in tuple");
			}
			out.add(b.pop());
		}
		return out;
	}

	public String toString() {
		String s = "(";
		for(int i = 0; i < elements.length; i++) {
			if(i!=0) {
				s += ", ";
			}
			s += elements[i].toString(false);
		}
		return s + ")";
	}

}

package aya.entities;

import java.util.ArrayList;
import java.util.EmptyStackException;

import aya.exceptions.AyaRuntimeException;
import aya.obj.Obj;
import aya.obj.block.Block;

public class Tuple {
	Block[] elements;

	/**
	 * Tuples will not need to be resized during runtime
	 * @param blocks
	 */
	public Tuple(Block[] blocks) {
		elements = blocks;
	}

	/**
	 * evals each of the blocks and returns an array containing each
	 * of the results
	 * @return
	 */
	public ArrayList<Obj> evalToResults() {
		ArrayList<Obj> out = new ArrayList<Obj>(elements.length);
		for (int i = 0; i < elements.length; i++) {
			Block b = elements[i].duplicate();
			try {
				b.eval();
			} catch (EmptyStackException e) {
				throw new AyaRuntimeException("Empty Stack in tuple");
			}
			out.add(b.pop());
		}
		return out;
	}

	public String toString() {
		String s = "(";
		for(int i = 0; i < elements.length; i++) {
			if(i!=0) {
				s += ", ";
			}
			s += elements[i].toString(false);
		}
		return s + ")";
	}

}

Fix runtime exception in tuple execution


package com.hpe.caf.autoscale.scaler.marathon;

import com.hpe.caf.api.ConfigurationException;
import com.hpe.caf.api.ConfigurationSource;
import com.hpe.caf.api.autoscale.ScalerException;
import com.hpe.caf.api.autoscale.ServiceScaler;
import com.hpe.caf.api.autoscale.ServiceScalerProvider;
import com.hpe.caf.autoscale.MarathonAutoscaleConfiguration;
import mesosphere.marathon.client.MarathonClient;

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

public class MarathonServiceScalerProvider implements ServiceScalerProvider
{
    @Override
    public ServiceScaler getServiceScaler(final ConfigurationSource configurationSource)
            throws ScalerException
    {
        try {
            MarathonAutoscaleConfiguration config = configurationSource.getConfiguration(MarathonAutoscaleConfiguration.class);
            URL url = new URL(config.getEndpoint());
            return new MarathonServiceScaler(MarathonClient.getInstance(url.toString()), config.getMaximumInstances(), url);
        } catch (ConfigurationException | MalformedURLException e) {
            throw new ScalerException("Failed to create service scaler", e);
        }
    }
}

package com.hpe.caf.autoscale.scaler.marathon;

import com.hpe.caf.api.ConfigurationException;
import com.hpe.caf.api.ConfigurationSource;
import com.hpe.caf.api.autoscale.ScalerException;
import com.hpe.caf.api.autoscale.ServiceScaler;
import com.hpe.caf.api.autoscale.ServiceScalerProvider;
import com.hpe.caf.autoscale.MarathonAutoscaleConfiguration;
import feign.Feign;
import feign.Request;
import mesosphere.marathon.client.Marathon;
import mesosphere.marathon.client.MarathonClient;

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

public class MarathonServiceScalerProvider implements ServiceScalerProvider
{
    private static final int MARATHON_TIMEOUT = 10_000;

    @Override
    public ServiceScaler getServiceScaler(final ConfigurationSource configurationSource)
            throws ScalerException
    {
        try {
            MarathonAutoscaleConfiguration config = configurationSource.getConfiguration(MarathonAutoscaleConfiguration.class);
            URL url = new URL(config.getEndpoint());
            Feign.Builder builder = Feign.builder().options(new Request.Options(MARATHON_TIMEOUT, MARATHON_TIMEOUT));
            Marathon marathon = MarathonClient.getInstance(builder, url.toString());
            return new MarathonServiceScaler(marathon, config.getMaximumInstances(), url);
        } catch (ConfigurationException | MalformedURLException e) {
            throw new ScalerException("Failed to create service scaler", e);
        }
    }
}

Set HTTP timeout to 10 seconds

Set HTTP timeout to 10 seconds


package org.robockets.stronghold.robot.highgoalshooter;

import org.robockets.stronghold.robot.Robot;
import org.robockets.stronghold.robot.RobotMap;

import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
 *
 */
public class UpdateHighGoalShooterDashboard extends Command {

    public UpdateHighGoalShooterDashboard() {
    }

    protected void initialize() {
    }

    protected void execute() {
    	SmartDashboard.putNumber("Turn table encoder", new EncoderPIDSource(RobotMap.turnTableEncoder, 0.16096579).pidGet());
    }

    protected boolean isFinished() {
        return false;
    }

    protected void end() {
    }

    protected void interrupted() {
    }
}

package org.robockets.stronghold.robot.highgoalshooter;

import org.robockets.stronghold.robot.EncoderPIDSource;
import org.robockets.stronghold.robot.Robot;
import org.robockets.stronghold.robot.RobotMap;

import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
 *
 */
public class UpdateHighGoalShooterDashboard extends Command {

    public UpdateHighGoalShooterDashboard() {
    }

    protected void initialize() {
    }

    protected void execute() {
    	SmartDashboard.putNumber("Turn table encoder", new EncoderPIDSource(RobotMap.turnTableEncoder, 0.16096579).pidGet());
    }

    protected boolean isFinished() {
        return false;
    }

    protected void end() {
    }

    protected void interrupted() {
    }
}

Fix petty error in dashboard.

Fix petty error in dashboard.


package com.github.alexvictoor.livereload;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;

public class FileReader {

    public String readFileFromClassPath(String classPath) {
        try {
            URL resource = getClass().getResource(classPath);
            if (resource==null) {
                throw new IllegalArgumentException("Incorrect path file");
            }
            URI fileURI = resource.toURI();
            byte[] encoded = Files.readAllBytes(Paths.get(fileURI));
            return new String(encoded, Charset.defaultCharset());
        } catch (IOException e) {
            throw new RuntimeException(e);
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
    }
}

package com.github.alexvictoor.livereload;

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

import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Scanner;

public class FileReader {

    public static final Logger logger = LoggerFactory.getLogger(FileReader.class);

    public String readFileFromClassPath(String classPath) {

            return new Scanner(getClass().getResourceAsStream(classPath)).useDelimiter("\\Z").next();
            //byte[] encoded = Files.readAllBytes(Paths.get(fileURI));
            //return new String(encoded, Charset.defaultCharset());

    }
}

Fix filereader to allow reading from jar file


package eu.nerro.wolappla.entity;

import org.junit.Test;

public class MacAddressTest {
  @Test(expected = IllegalArgumentException.class)
  public void valueOf_shouldThrowAIEIfAddressIsNull() {
    MacAddress.valueOf(null);
  }

  @Test(expected = IllegalArgumentException.class)
  public void valueOf_shouldThrowAIEIfAddressArrayLengthIsNotSix() {
    byte[] invalidAddress = { 1, 2, 3, 4, 5 };
    MacAddress.valueOf(invalidAddress);
  }
}

package eu.nerro.wolappla.entity;

import org.junit.Test;

public class MacAddressTest {
  @Test(expected = IllegalArgumentException.class)
  public void valueOf_shouldThrowIAEIfAddressIsNull() {
    MacAddress.valueOf(null);
  }

  @Test(expected = IllegalArgumentException.class)
  public void valueOf_shouldThrowIAEIfAddressArrayLengthIsNotSix() {
    byte[] invalidAddress = { 1, 2, 3, 4, 5 };
    MacAddress.valueOf(invalidAddress);
  }
}

Fix typo in test class of mac address

Fix typo in test class of mac address


package de.fruitfly.ovr.enums;

public enum EyeType
{
    ovrEye_Left(0),
    ovrEye_Right(1),
    ovrEye_Count(2);

    private final int eyeTypeEnum;

    private EyeType(int value)
    {
        this.eyeTypeEnum = value;
    }

    public int value()
    {
        return this.eyeTypeEnum;
    }

    public static EyeType fromInteger(int x) {
        switch(x) {
            case 0:
                return ovrEye_Left;
            case 1:
                return ovrEye_Right;
        }
        return ovrEye_Count;
    }

    public static String toString(EyeType type)
    {
        switch(type)
        {
            case ovrEye_Left:
                return "ovrEye_Left";
            case ovrEye_Right:
                return "ovrEye_Right";
        }

        return "ovrEye_Count";
    }
}

package de.fruitfly.ovr.enums;

public enum EyeType
{
    ovrEye_Center(-1),
    ovrEye_Left(0),
    ovrEye_Right(1),
    ovrEye_Count(2);

    private final int eyeTypeEnum;

    private EyeType(int value)
    {
        this.eyeTypeEnum = value;
    }

    public int value()
    {
        return this.eyeTypeEnum;
    }

    public static EyeType fromInteger(int x) {
        switch(x) {
            case -1:
                return ovrEye_Center;
            case 0:
                return ovrEye_Left;
            case 1:
                return ovrEye_Right;
        }
        return ovrEye_Count;
    }

    public static String toString(EyeType type)
    {
        switch(type)
        {
            case ovrEye_Center:
                return "ovrEye_Center";
            case ovrEye_Left:
                return "ovrEye_Left";
            case ovrEye_Right:
                return "ovrEye_Right";
        }

        return "ovrEye_Count";
    }
}

Allow eyetype of 'center' (yes, cyclops?)


/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.util;

import alluxio.test.util.CommonUtils;

import org.junit.Assert;
import org.junit.Test;

import java.util.Random;

public final class WaitForOptionsTest {
  @Test
  public void defaults() {
    WaitForOptions options = WaitForOptions.defaults();
    Assert.assertEquals(WaitForOptions.DEFAULT_INTERVAL, options.getInterval());
    Assert.assertEquals(WaitForOptions.NEVER, options.getTimeoutMs());
  }

  /**
   * Tests getting and setting fields.
   */
  @Test
  public void fields() {
    Random random = new Random();
    int interval = random.nextInt();
    int timeout = random.nextInt();

    WaitForOptions options = WaitForOptions.defaults();
    options.setInterval(interval);
    options.setTimeoutMs(timeout);

    Assert.assertEquals(interval, options.getInterval());
    Assert.assertEquals(timeout, options.getTimeoutMs());
  }

  @Test
  public void equalsTest() throws Exception {
    CommonUtils.testEquals(WaitForOptions.class);
  }
}

/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.util;

import static org.junit.Assert.assertEquals;

import alluxio.test.util.CommonUtils;

import org.junit.Test;

import java.util.Random;

public final class WaitForOptionsTest {
  @Test
  public void defaults() {
    WaitForOptions options = WaitForOptions.defaults();
    assertEquals(WaitForOptions.DEFAULT_INTERVAL, options.getInterval());
    assertEquals(WaitForOptions.NEVER, options.getTimeoutMs());
  }

  /**
   * Tests getting and setting fields.
   */
  @Test
  public void fields() {
    Random random = new Random();
    int interval = random.nextInt();
    int timeout = random.nextInt();

    WaitForOptions options = WaitForOptions.defaults();
    options.setInterval(interval);
    options.setTimeoutMs(timeout);

    assertEquals(interval, options.getInterval());
    assertEquals(timeout, options.getTimeoutMs());
  }

  @Test
  public void equalsTest() throws Exception {
    CommonUtils.testEquals(WaitForOptions.class);
  }
}

[SMALLFIX] Use static imports for standard test utilities

Change

`import org.junit.Assert;`

to

`import static org.junit.Assert.assertEquals;`

AND

Update all

`Assert.{{ method }}*`

to

`{{ method }}*`

pr-link: Alluxio/alluxio#8697
change-id: cid-80367e58e882e7d64d77c0040a4faf3cf3f1d84d


/**
 * Copyright © 2011-2012 EMBL - European Bioinformatics Institute
 *
 * 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 uk.ac.ebi.phenotype.dao;

/**
 *
 * Ontology DB data access manager interface.
 *
 * @author Gautier Koscielny (EMBL-EBI) <koscieln@ebi.ac.uk>
 * @since February 2012
 */

import java.util.List;

public interface OntodbDAO {

	/**
	 * Get all cell terms
	 * @return all cell terms
	 */
	public List<String> getAllCellTerms();
}

/**
 * Copyright © 2011-2013 EMBL - European Bioinformatics Institute
 *
 * 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 uk.ac.ebi.phenotype.dao;

/**
 *
 * Ontology DB data access manager interface.
 *
 * @author Gautier Koscielny (EMBL-EBI) <koscieln@ebi.ac.uk>
 * @since February 2012
 */

import java.util.List;

public interface OntodbDAO {

	/**
	 * Get all cell terms
	 * @return all cell terms
	 */
	public List<String> getAllCellTerms();
}

Change copyright in Apache 2 license to 2013


/**
================================================================================

   Project: Procter and Gamble - Skelmersdale.

   $HeadURL$

   $Author$

   $Revision$

   $Date$

$Log$

============================== (c) Swisslog(UK) Ltd, 2005 ======================
*/
package io.cloudracer;

import static org.junit.Assert.assertNull;

import java.util.concurrent.TimeUnit;

import org.apache.logging.log4j.core.Appender;

public abstract class AbstractTestTools {
    /**
     * Asserts that the "TEST" {@link Appender log4j Appender} did not log any messages.
     *
     * Adjust the log4j.xml Appenders to match on only the messages that should cause this method to raise {@link AssertionError}.
     */
    public final void checkForUnexpectedLogMessages() {
        try {
            final int delayDuration = 1;
            // Pause to allow messages to be flushed to the disk (and, hence, through the appenders).
            TimeUnit.SECONDS.sleep(delayDuration);
        } catch (InterruptedException e) {
            // Do nothing
        }
        assertNull(String.format("An unexpected message was logged to the file \"%s\".", LogMonitor.getFileName()), LogMonitor.getLastEventLogged());
    }
}

/**
================================================================================

   Project: Procter and Gamble - Skelmersdale.

   $HeadURL$

   $Author$

   $Revision$

   $Date$

$Log$

============================== (c) Swisslog(UK) Ltd, 2005 ======================
*/
package io.cloudracer;

import static org.junit.Assert.assertNull;

import java.util.concurrent.TimeUnit;

import org.apache.logging.log4j.core.Appender;

public abstract class AbstractTestTools {
    /**
     * Asserts that the "TEST" {@link Appender log4j Appender} did not log any messages.
     *
     * Adjust the log4j.xml Appenders to match on only the messages that should cause this method to raise {@link AssertionError}.
     */
    protected final void checkLogMonitorForUnexpectedMessages() {
        try {
            final int delayDuration = 1;
            // Pause to allow messages to be flushed to the disk (and, hence, through the appenders).
            TimeUnit.SECONDS.sleep(delayDuration);
        } catch (InterruptedException e) {
            // Do nothing
        }
        assertNull(String.format("An unexpected message was logged to the file \"%s\".", LogMonitor.getFileName()), LogMonitor.getLastEventLogged());
    }

    protected void resetLogMonitor() {
        LogMonitor.setLastEventLogged(null);
    }
}

Add method to reset the LogMonitor i.e. forget any previously logged messages.


package com.clxcommunications.xms.api;

import java.util.Map;

import javax.annotation.Nullable;

import org.immutables.value.Value;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Value.Immutable
@ValueStylePackage
@JsonDeserialize(using = JacksonUtils.ParameterValuesDeserializer.class)
@JsonSerialize(using = JacksonUtils.ParameterValuesSerializer.class)
public abstract class ParameterValues {

	public static class Builder extends ParameterValuesImpl.Builder {

	}

	public abstract Map<String, String> substitutions();

	@Nullable
	public abstract String defaultValue();

}

package com.clxcommunications.xms.api;

import java.util.Map;

import javax.annotation.Nullable;

import org.immutables.value.Value;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Value.Immutable
@ValueStylePackage
@JsonDeserialize(using = JacksonUtils.ParameterValuesDeserializer.class)
@JsonSerialize(using = JacksonUtils.ParameterValuesSerializer.class)
public interface ParameterValues {

	public static class Builder extends ParameterValuesImpl.Builder {

	}

	Map<String, String> substitutions();

	@Nullable
	String defaultValue();

}

Change parameter values class to an interface


/*
* 	Copyright 2012 Robert Burrell Donkin robertburrelldonkin.name
*
*   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 name.robertburrelldonkin.template4couchdb;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App
{
    public static void main( String[] args )
    {
    	ApplicationContext context = load();
    	CouchDBTemplate template = context.getBean(CouchDBTemplate.class);
    	System.out.println(template.version(new StringDocumentMapper()));
    }

    public static  ApplicationContext load() {
    	return new ClassPathXmlApplicationContext("couchdb-context.xml");
    }
}

/*
* 	Copyright 2012 Robert Burrell Donkin robertburrelldonkin.name
*
*   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 name.robertburrelldonkin.template4couchdb;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App
{
    public static void main( String[] args )
    {
    	ApplicationContext context = load();
    	@SuppressWarnings("unchecked")
		CouchDBTemplate<String> template = context.getBean(CouchDBTemplate.class);
    	System.out.println(template.version(new StringDocumentMapper()));
    }

    public static  ApplicationContext load() {
    	return new ClassPathXmlApplicationContext("couchdb-context.xml");
    }
}

Improve wiring in sample app

Improve wiring in sample app


package reversi.GUI;

/*
 * Possibly use "GridLayout" class.
 * Not sure of the limits, still checking.
 */

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

public class guiBoard extends JFrame {

	DisplayGui();

}

/*
 * Variable will allow switching between menu display and game board display
 */
private void variableGameState( int state) {
	switch (gameState)
		case 0:
			//TODO: Display everything
		case 1:
			//TODO: Display menu
		case 2:
			//TODO: Display board
			//TODO: Display game
			//TODO: Display pieces (sprites)
}

/*
 * Paint method based on variable state
 */
public void DisplayGUI(Graphics2D gfx) {
	int gameState;

	if(gameState = 0)
		/*
		 * Draw/redraw: variableGameState(0);
		 */

	else if(gameState = 1)
		/*
		 * Draw/redraw: varaibleGameState(1);
		 */

	else if(gameState = 2)
		/*
		 * Draw/redraw: variableGameState(2);
		 */

	//GridLayout reversiLayout = newGridLayout(8, 8);
	//addComponentsToPane(getContentPane());

	//setSize(800, 800);
	setVisible(true);
}

private void addComponentsToPane( Container contentPane) {

}

package reversi.GUI;

/*
 * Possibly use "GridLayout" class.
 * Not sure of the limits, still checking.
 */

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

/*
public class guiBoard extends JFrame {

	//DisplayGui();

}*/

/*
 * Variable will allow switching between menu display and game board display
 */
/*private void variableGameState( int state) {
	switch (gameState)
		case 0:
			//TODO: Display everything
		case 1:
			//TODO: Display menu
		case 2:
			//TODO: Display board
			//TODO: Display game
			//TODO: Display pieces (sprites)
}*/

/*
 * Paint method based on variable state
 */
//public void DisplayGUI(Graphics2D gfx) {
	//int gameState;

	//if(gameState = 0)
		/*
		 * Draw/redraw: variableGameState(0);
		 */

	//else if(gameState = 1)
		/*
		 * Draw/redraw: varaibleGameState(1);
		 */

	//else if(gameState = 2)
		/*
		 * Draw/redraw: variableGameState(2);
		 */

	//GridLayout reversiLayout = newGridLayout(8, 8);
	//addComponentsToPane(getContentPane());

	//setSize(800, 800);
	//setVisible(true);
//}

//private void addComponentsToPane( Container contentPane) {

//}

Comment out GUI - maintain compilable submission


public class Logic {
    public final static String STICK = "0";
    public final static String MESSAGE_CODE = "M";

    public String parseToCustomer(String commandFromDrinkMaker) {
        String[] commands = commandFromDrinkMaker.split(":");

        if(commands.length == 2 && MESSAGE_CODE.equals(commands[0])) {
            return commands[1];
        }

        return "";
    }

    public String parseToDrinkMakerProtocol(Drink drink, int nbOfSugars) {
        return drink.getCode()
                + ":" + sugarCode(nbOfSugars)
                + ":" + stickCode(nbOfSugars);
    }

    private String sugarCode(int nbOfSugars) {
        return hasSugars(nbOfSugars)? String.valueOf(nbOfSugars) : "";
    }

    private String stickCode(int nbOfSugars) {
        return hasSugars(nbOfSugars)? STICK : "";
    }

    private boolean hasSugars(int nbOfSugars) {
        return nbOfSugars > 0;
    }

    public String makeDrink(Drink drink, int nbOfSugars, double amountOfMoneyGiven) {
        if(amountOfMoneyGiven >= drink.getPrice()) {
            return parseToDrinkMakerProtocol(drink, nbOfSugars);
        }

        return "Need " + String.valueOf(drink.getPrice() - amountOfMoneyGiven);
    }
}

public class Logic {
    public final static String STICK = "0";
    public final static String MESSAGE_CODE = "M";

    public String makeDrink(Drink drink, int nbOfSugars, double amount) {
        if(amount >= drink.getPrice()) {
            return parseToDrinkMakerProtocol(drink, nbOfSugars);
        }

        return "Need " + String.valueOf(drink.getPrice() - amount);
    }

    public String parseToCustomer(String commandFromDrinkMaker) {
        String[] commands = commandFromDrinkMaker.split(":");

        if(commands.length == 2 && MESSAGE_CODE.equals(commands[0])) {
            return commands[1];
        }

        return "";
    }

    public String parseToDrinkMakerProtocol(Drink drink, int nbOfSugars) {
        return drink.getCode()
                + ":" + sugarCode(nbOfSugars)
                + ":" + stickCode(nbOfSugars);
    }

    private String sugarCode(int nbOfSugars) {
        return hasSugars(nbOfSugars)? String.valueOf(nbOfSugars) : "";
    }

    private String stickCode(int nbOfSugars) {
        return hasSugars(nbOfSugars)? STICK : "";
    }

    private boolean hasSugars(int nbOfSugars) {
        return nbOfSugars > 0;
    }
}

Refactor: Change order of 'makeDrinks' function in order to have a better readability


package peergos.shared.user.fs;

/** A Fragment is a part of an EncryptedChunk which is stored directly in IPFS in raw format
 *
 */
public class Fragment {
    public static final int MAX_LENGTH = 1024*128;

    public final byte[] data;

    public Fragment(byte[] data) {
        if (MAX_LENGTH < data.length)
            throw new IllegalStateException("fragment size "+ data.length +" greater than max "+ MAX_LENGTH);
        this.data = data;
    }
}

package peergos.shared.user.fs;

/** A Fragment is a part of an EncryptedChunk which is stored directly in IPFS in a raw format block
 *
 */
public class Fragment {
    public static final int MAX_LENGTH = 512*1024; // max size allowed by bitswap protocol is 1 MiB

    public final byte[] data;

    public Fragment(byte[] data) {
        if (MAX_LENGTH < data.length)
            throw new IllegalStateException("fragment size "+ data.length +" greater than max "+ MAX_LENGTH);
        this.data = data;
    }
}

Increase max fragment size from 128 KiB to 512 KiB.

This is still allowed in bitswap (which allows up to 1 MiB) and
it should make uploads and downloads much faster (less latency sensitive).

The original motivation for 128 KiB was to play well with erasure encoding
(5 MiB -> 40 * 128 KiB ==erasure encode=> 60 * 128 KiB),
but we no longer do that and it should be done at a lower level regardless.

This will reduce the number of network requests to retrieve a block by 4X
and thus greatly improve bandwidth for latency sensitive instances.

It also reduces the pressure on the blockstore by having ~ 4x fewer blocks.
Some blockstores like S3 can impose limits on the total number of blocks
and also on the number of requests per second.


package com.datasift.client.pylon;

import com.fasterxml.jackson.annotation.JsonProperty;

public class PylonQueryParameters {
    @JsonProperty("analysis_type")
    protected String analysisType;
    @JsonProperty
    protected PylonParametersData parameters;

    public PylonQueryParameters() {
    }

    public PylonQueryParameters(String analysisType, PylonParametersData parameters) {
        this.analysisType = analysisType;
        this.parameters = parameters;
    }

    public String getAnalysisType() {
        return this.analysisType;
    }

    public PylonParametersData getParameters() {
        return this.parameters;
    }

    public void setAnalysisType(String analysisType) {
        this.analysisType = analysisType;
    }

    public void setParameters(PylonParametersData parameters) {
        this.parameters = parameters;
    }
}

package com.datasift.client.pylon;

import com.fasterxml.jackson.annotation.JsonProperty;

public class PylonQueryParameters {
    @JsonProperty("analysis_type")
    protected String analysisType;
    @JsonProperty
    protected PylonParametersData parameters;
    @JsonProperty("child")
    protected PylonQueryParameters childAnalysis;

    public PylonQueryParameters() {
    }

    public PylonQueryParameters(String analysisType, PylonParametersData parameters, PylonQueryParameters child) {
        this.analysisType = analysisType;
        this.parameters = parameters;
        this.childAnalysis = child;
    }

    public String getAnalysisType() {
        return this.analysisType;
    }

    public PylonParametersData getParameters() {
        return this.parameters;
    }

    public PylonQueryParameters getChildAnalysis() { return this.childAnalysis; }

    public void setAnalysisType(String analysisType) {
        this.analysisType = analysisType;
    }

    public void setParameters(PylonParametersData parameters) {
        this.parameters = parameters;
    }

    public void setChildAnalysis(PylonQueryParameters childAnalysis) { this.childAnalysis = childAnalysis; }
}

Add initial query parameters child member


/*
 * Copyright (C) 2017 Dennis Neufeld
 *
 * This program 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.
 *
 * 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/>.
 */

package space.npstr.wolfia.game.definitions;

/**
 * Created by napster on 02.06.17.
 */
public enum Alignments {
    VILLAGE,
    WOLF
}

/*
 * Copyright (C) 2017 Dennis Neufeld
 *
 * This program 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.
 *
 * 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/>.
 */

package space.npstr.wolfia.game.definitions;

/**
 * Created by napster on 02.06.17.
 */
public enum Alignments {
    VILLAGE("Village"),
    WOLF("Wolves");

    public final String textRep;

    Alignments(final String textRepresentation) {
        this.textRep = textRepresentation;
    }
}

Add text representation to alignments

Add text representation to alignments


package ol;

/**
 *
 * @author Tino Desjardins
 *
 */
public class GwtOL3BaseTestCase extends BaseTestCase {

    public GwtOL3BaseTestCase() {
        super("http://openlayers.org/en/v3.12.1/build/ol.js", "GwtOL3Test", 10000);
    }

}

package ol;

/**
 *
 * @author Tino Desjardins
 *
 */
public class GwtOL3BaseTestCase extends BaseTestCase {

    public GwtOL3BaseTestCase() {
        super("http://openlayers.org/en/v3.13.0/build/ol.js", "GwtOL3Test", 10000);
    }

}

Switch from OL v3.12.1 to OL v3.13.0

Switch from OL v3.12.1 to OL v3.13.0


package org.endeavourhealth.messagingapi.endpoints;

import org.endeavourhealth.common.security.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.*;
import java.util.UUID;

@Path("/")
public class Audit {

	@POST
	@Consumes(MediaType.TEXT_PLAIN)
	@Produces(MediaType.TEXT_PLAIN)
	@Path("/Audit")
	public Response postMessage(@Context SecurityContext sc, @Context HttpHeaders headers, String body) {
		String application = headers.getHeaderString("application");
		String level = headers.getHeaderString("level");
		Logger logger = LoggerFactory.getLogger(application);
		UUID userUuid = SecurityUtils.getCurrentUserId(sc);

		switch (level.toUpperCase()) {
			case "DEBUG":
				logger.debug(body);
				break;
			case "ERROR":
				logger.error(body);
				break;
			case "INFO":
				logger.info(body);
				break;
			case "TRACE":
				logger.trace(body);
				break;
			case "WARN":
				logger.warn(body);
				break;
			default:
				logger.debug(body);
		}

		return Response.ok().build();
	}
}

package org.endeavourhealth.messagingapi.endpoints;

import org.endeavourhealth.common.security.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.*;
import java.util.UUID;

@Path("/")
public class Audit {

	@POST
	@Consumes(MediaType.TEXT_PLAIN)
	@Produces(MediaType.TEXT_PLAIN)
	@Path("/Audit")
	public Response postMessage(@Context SecurityContext sc, @Context HttpHeaders headers, String body) {
		String application = headers.getHeaderString("application");
		String level = headers.getHeaderString("level");
		Logger logger = LoggerFactory.getLogger(application);
		UUID userUuid = SecurityUtils.getCurrentUserId(sc);

		switch (level.toUpperCase()) {
			case "DEBUG":
				logger.debug(body, userUuid);
				break;
			case "ERROR":
				logger.error(body, userUuid);
				break;
			case "INFO":
				logger.info(body, userUuid);
				break;
			case "TRACE":
				logger.trace(body, userUuid);
				break;
			case "WARN":
				logger.warn(body, userUuid);
				break;
			default:
				logger.debug(body, userUuid);
		}

		return Response.ok().build();
	}
}

Include calling (keycloak) user uuid

Include calling (keycloak) user uuid


package com.sixsq.slipstream.statemachine;

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

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

public enum States {
    Inactive,
    Initializing,
    Running,
    SendingFinalReport,
    Disconnected,
    Finalizing,
    Terminal,
    Unknown,
    Done,
    Cancelled,
    Aborting,
    Aborted,
    Failing,
    Failed;

    public static List<States> completed() {
    	return Arrays.asList(States.Cancelled,
    						 States.Terminal,
    						 States.Aborted,
    						 States.Done);
    }
}

package com.sixsq.slipstream.statemachine;

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

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

public enum States {
    Inactive,
    Initializing,
    Running,
    SendingFinalReport,
    Disconnected,
    Finalizing,
    Terminal,
    Unknown,
    Done,
    Cancelled,
    Aborting,
    Aborted,
    Failing,
    Failed;

    public static List<States> completed() {
    	return Arrays.asList(States.Cancelled,
    						 States.Terminal,
    						 States.Aborted,
    						 States.Unknown,
    						 States.Done);
    }
}

Add Unknown to ‘completed’ list

Add Unknown to ‘completed’ list


package org.joverseer.support;

import java.io.File;
import java.io.FileFilter;
import java.util.regex.Pattern;
/**
 * Filter files matching the specified game
 * @author Dave
 *
 */
public class XmlAndPdfFileFilter implements FileFilter {
	String gameNoAsString;
	public XmlAndPdfFileFilter(int gameNo) {
		this.gameNoAsString = String.format("g%03d", gameNo);
	}
	@Override
	public boolean accept(File file) {
		String name = file.getName();
		return (!file.isDirectory()) && name.contains(this.gameNoAsString) &&
				((name.endsWith(".pdf") ||
				(Pattern.matches("g\\d{3}n\\d{2}t\\d{3}.xml", name) )));
	}
}

package org.joverseer.support;

import java.io.File;
import java.io.FileFilter;
import java.util.regex.Pattern;
/**
 * Filter files matching the specified game
 * @author Dave
 *
 */
public class XmlAndPdfFileFilter implements FileFilter {
	String gameNoAsString;
	public XmlAndPdfFileFilter(int gameNo) {
		this.gameNoAsString = String.format("g%d", gameNo);
	}
	@Override
	public boolean accept(File file) {
		String name = file.getName();
		return (!file.isDirectory()) && name.contains(this.gameNoAsString) &&
				((name.endsWith(".pdf") ||
				(Pattern.matches("g\\d{2,}n\\d{2,}t\\d{2,}.xml", name) )));
	}
}

Allow 4 digit game numbers

fix: Allow 4 digit game numbers

tweak the filename format for game xml and pdf files.


package com.bastienleonard.tomate.models;

import android.support.annotation.Nullable;
import android.support.v4.util.SimpleArrayMap;

import java.util.List;

public final class TasksCache {
    private SimpleArrayMap<String, Task> mTasks;

    public TasksCache() {
    }

    // FIXME: directly parse the tasks JSON as a map if we never never need them as a list
    public void setTasks(List<Task> tasks) {
        if (mTasks == null) {
            mTasks = new SimpleArrayMap<>(tasks.size());
        }

        for (Task task: tasks) {
            mTasks.put(task.getCardId(), task);
        }
    }

    @Nullable
    public Task get(String cardId) {
        return mTasks.get(cardId);
    }
}

package com.bastienleonard.tomate.models;

import android.support.annotation.Nullable;
import android.support.v4.util.SimpleArrayMap;

import java.util.List;

public final class TasksCache {
    private SimpleArrayMap<String, Task> mTasks;

    public TasksCache() {
    }

    // FIXME: directly parse the tasks JSON as a map if we never never need them as a list
    public void setTasks(List<Task> tasks) {
        if (mTasks == null) {
            mTasks = new SimpleArrayMap<>(tasks.size());
        }

        for (Task task: tasks) {
            mTasks.put(task.getCardId(), task);
        }
    }

    @Nullable
    public Task get(String cardId) {
        if (mTasks == null) {
            return null;
        }

        return mTasks.get(cardId);
    }
}

Add null check in TaskCache

Add null check in TaskCache


package dr.inference.model;

import dr.xml.*;
import sun.awt.X11.XLayerProtocol;

/**
 * @author Joseph Heled
 *         Date: 4/09/2009
 */
public class ValuesPoolParser extends dr.xml.AbstractXMLObjectParser {
    public static String VALUES_POOL = "valuesPool";
    public static String VALUES = "values";
     public static String SELECTOR = "selector";

    public Object parseXMLObject(XMLObject xo) throws XMLParseException {
        final Variable pool = (Variable)xo.getElementFirstChild(VALUES);
        final Variable selector = (Variable)xo.getElementFirstChild(SELECTOR);

        if( pool.getSize() != selector.getSize() ) {
            throw new XMLParseException("variable Pool and selector must have equal length.");
        }
        return new ValuesPool(pool, selector);
    }

    public XMLSyntaxRule[] getSyntaxRules() {
          return new XMLSyntaxRule[] {
                  new ElementRule(VALUES, new XMLSyntaxRule[]{
                        new ElementRule(Variable.class,1,1) }),
                   new ElementRule(SELECTOR, new XMLSyntaxRule[]{
                        new ElementRule(Variable.class,1,1) })

          };
      }

    public String getParserDescription() {
        return "";
    }

    public Class getReturnType() {
        return ValuesPool.class;
    }

    public String getParserName() {
        return VALUES_POOL;
    }
}

package dr.inference.model;

import dr.xml.*;
//import sun.awt.X11.XLayerProtocol;

/**
 * @author Joseph Heled
 *         Date: 4/09/2009
 */
public class ValuesPoolParser extends dr.xml.AbstractXMLObjectParser {
    public static String VALUES_POOL = "valuesPool";
    public static String VALUES = "values";
     public static String SELECTOR = "selector";

    public Object parseXMLObject(XMLObject xo) throws XMLParseException {
        final Variable pool = (Variable)xo.getElementFirstChild(VALUES);
        final Variable selector = (Variable)xo.getElementFirstChild(SELECTOR);

        if( pool.getSize() != selector.getSize() ) {
            throw new XMLParseException("variable Pool and selector must have equal length.");
        }
        return new ValuesPool(pool, selector);
    }

    public XMLSyntaxRule[] getSyntaxRules() {
          return new XMLSyntaxRule[] {
                  new ElementRule(VALUES, new XMLSyntaxRule[]{
                        new ElementRule(Variable.class,1,1) }),
                   new ElementRule(SELECTOR, new XMLSyntaxRule[]{
                        new ElementRule(Variable.class,1,1) })

          };
      }

    public String getParserDescription() {
        return "";
    }

    public Class getReturnType() {
        return ValuesPool.class;
    }

    public String getParserName() {
        return VALUES_POOL;
    }
}

Fix broken code, comment out sun.awt.X11.XLayerProtocol


import converters.JsonConverter;
import datamodel.Request;
import httpserver.RequestSender;
import httpserver.WebServer;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

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

    public void runCommand(ActionEvent actionEvent) {
        results.setText("");
        response.setText("");
        ws.setResults(results);
        Thread th = new Thread() {
            @Override
            public void run() {
                String commandString = command.getText();

                Request request = new Request();
                request.setClientId("13");
                request.setCommand(commandString);
                request.setResponseAddress("http://localhost:8008/jobFinished");
                request.setProcessors(new String[] {"processors.XmlToJsonConverter","processors.TlsFilter"});
                request.setAdapter("adapters.EventHubAdapter");

                String requestJsonString = JsonConverter.objectToJsonString(request);

                String requestResponse = RequestSender.sendRequest("http://localhost:8000/job", request);
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        response.setText(requestResponse);
                    }
                });
            }
        };
        th.start();
    }

}

import converters.JsonConverter;
import datamodel.Request;
import httpserver.RequestSender;
import httpserver.WebServer;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

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

    @FXML
    public void initialize(){
        ws.setResults(results);
    }

    public void runCommand(ActionEvent actionEvent) {
        results.setText("");
        response.setText("");
        Thread th = new Thread() {
            @Override
            public void run() {
                String commandString = command.getText();

                Request request = new Request();
                request.setClientId("13");
                request.setCommand(commandString);
                request.setResponseAddress("http://localhost:8008/jobFinished");
                request.setProcessors(new String[] {"processors.XmlToJsonConverter","processors.TlsFilter"});
                request.setAdapter("adapters.EventHubAdapter");

                String requestJsonString = JsonConverter.objectToJsonString(request);

                String requestResponse = RequestSender.sendRequest("http://localhost:8000/job", request);
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        response.setText(requestResponse);
                    }
                });
            }
        };
        th.start();
    }

}

Initialize set results before button action. The UI client can be used for receiving messages only.


/**
 * This package is for testing DynamoInitializer so that, during testing,
 * only DynamoDB tables defined in this package are initialized.
 */
package org.sagebionetworks.bridge.dynamodb.test;

Insert a new line at the end.

Insert a new line at the end.


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

import org.junit.Assert;
import org.junit.Test;
import org.traccar.ProtocolTest;
import org.traccar.model.Command;

public class TotemProtocolEncoderTest extends ProtocolTest {
    @Test
    public void testEncode() throws Exception {

        TotemProtocolEncoder encoder = new TotemProtocolEncoder();

        Command command = new Command();
        command.setDeviceId(2);
        command.setType(Command.TYPE_ENGINE_STOP);
        command.set(Command.KEY_DEVICE_PASSWORD, "000000");

        Assert.assertEquals("*000000,025,C,1#", encoder.encodeCommand(command));

    }
}

Remove copyright from test case

Remove copyright from test case


package net.glowstone.scheduler;

import net.glowstone.block.GlowBlock;
import net.glowstone.block.ItemTable;
import net.glowstone.block.blocktype.BlockType;

public class PulseTask extends GlowTask {
    public PulseTask(GlowBlock block) {
        super(null, () -> {
            ItemTable table = ItemTable.instance();
            BlockType type = table.getBlock(block.getType());
            type.receivePulse(block);
        }, true, 1, 1);
    }
}

package net.glowstone.scheduler;

import net.glowstone.block.GlowBlock;
import net.glowstone.block.ItemTable;
import net.glowstone.block.blocktype.BlockType;

public class PulseTask extends GlowTask {
    public PulseTask(GlowBlock block) {
        super(null, () -> {
            ItemTable table = ItemTable.instance();
            BlockType type = table.getBlock(block.getType());
            if (type != null) {
                type.receivePulse(block);
            }
        }, true, 1, 1);
    }
}

Check if type is null before pulsing

Check if type is null before pulsing


import java.io.Serializable;
import java.awt.event.KeyEvent;

public class MazewarPacket implements Serializable {

	/* define packet formats */
	public static final int MW_NULL        = 0;
	public static final int MW_JOIN        = 100;
	public static final int MW_REQUEST     = 200;
	public static final int MW_REPLY       = 300;
	public static final int MW_BYE         = 400;

	/* the packet payload */

	/* initialized to be a null packet */
	public int type = MW_NULL;

	// Client name
	public String Player;

	// Key event
	public KeyEvent event = null;

	// Client's starting position & orientation
	public Point StartPoint = null;
	public Direction dir = null;
};

import java.io.Serializable;
import java.awt.event.KeyEvent;

public class MazewarPacket implements Serializable {

	/* define packet formats */
	public static final int MW_NULL        = 0;
	public static final int MW_JOIN        = 100;
	public static final int MW_REQUEST     = 200;
	public static final int MW_REPLY       = 300;
	public static final int MW_BYE         = 400;
	public static final int MW_START       = 500;

	/* the packet payload */

	/* initialized to be a null packet */
	public int type = MW_NULL;

	// Client name
	public String Player;

	// Key event
	public KeyEvent event = null;

	// Client's starting position & orientation
	public Point StartPoint = null;
	public Direction dir = null;
};

Add another packet format MW_START

Add another packet format MW_START

MW_START will be sent by the server to tell the local clients to stop adding in more RemoteClients and play the game.


package mil.nga.giat.mage.newsfeed;

import mil.nga.giat.mage.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class NewsFeedFragment extends Fragment {

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_news_feed, container, false);

		TextView dummyTextView = (TextView) rootView.findViewById(R.id.section_label);
		dummyTextView.setText("News Feed");

		return rootView;
	}
}

package mil.nga.giat.mage.newsfeed;

import mil.nga.giat.mage.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class NewsFeedFragment extends Fragment {

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_news_feed, container, false);

		//TextView dummyTextView = (TextView) rootView.findViewById(R.id.);
		//dummyTextView.setText("News Feed");

		return rootView;
	}
}

Use the correct names on the edit observation screen


package net.beaconcontroller.web;

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

import net.beaconcontroller.web.view.BeaconJsonView;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.View;

/**
 *
 * @author Kyle Forster (kyle.forster@bigswitch.com)
 * @author David Erickson (daviderickson@cs.stanford.edu)
 */

@Controller
public class WebManageableController {
    protected static Logger log = LoggerFactory.getLogger(WebManageableController.class);

    protected List<IWebManageable> webManageables = new ArrayList<IWebManageable>();

    @RequestMapping(value = "wm")
    public View overview(Map<String, Object> model) {
        BeaconJsonView view = new BeaconJsonView();
        view.setDisableCaching(true);
        model.put(BeaconJsonView.ROOT_OBJECT_KEY, webManageables);
        return view;
    }

    /**
     * @param webManageables the webManageables to set
     */
    @Autowired
    public void setWebManageables(List<IWebManageable> webManageables) {
        this.webManageables = webManageables;
    }
}

package net.beaconcontroller.web;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;

import net.beaconcontroller.web.view.BeaconJsonView;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.View;

/**
 *
 * @author Kyle Forster (kyle.forster@bigswitch.com)
 * @author David Erickson (daviderickson@cs.stanford.edu)
 */

@Controller
public class WebManageableController {
    protected static Logger log = LoggerFactory.getLogger(WebManageableController.class);

    protected List<IWebManageable> webManageables;

    @RequestMapping(value = "wm")
    public View overview(Map<String, Object> model) {
        BeaconJsonView view = new BeaconJsonView();
        view.setDisableCaching(true);
        model.put(BeaconJsonView.ROOT_OBJECT_KEY, webManageables);
        return view;
    }

    /**
     * @param webManageables the webManageables to set
     */
    @Autowired
    public void setWebManageables(List<IWebManageable> webManageables) {
        this.webManageables = webManageables;
        // sort the list
        Collections.sort(webManageables, new Comparator<IWebManageable>() {
            @Override
            public int compare(IWebManageable o1, IWebManageable o2) {
                return o1.getName().compareTo(o2.getName());
            }
        });
    }
}

Sort the webmanageables before display in accordion


package com.leonty.etmweb.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class GeneralController {

	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String about_test(Model model) {

		return "home";
	}

	@RequestMapping(value = "/about", method = RequestMethod.GET)
	public String about(Model model) {

		return "about";
	}

	@RequestMapping(value = "/contact", method = RequestMethod.GET)
	public String contact(Model model) {

		return "contact";
	}
}

package com.leonty.etmweb.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/")
public class GeneralController {

	@RequestMapping(value = {"/", ""}, method = RequestMethod.GET)
	public String about_test(Model model) {

		return "home";
	}

	@RequestMapping(value = "/about", method = RequestMethod.GET)
	public String about(Model model) {

		return "about";
	}

	@RequestMapping(value = "/contact", method = RequestMethod.GET)
	public String contact(Model model) {

		return "contact";
	}
}

Clarify mappings for general controller

Clarify mappings for general controller


package com.alanrusnak.api2048.engine;

import com.alanrusnak.api2048.engine.model.Tile;
import org.junit.Assert;
import org.junit.Test;

public class MoveExecutorTest {

    MoveExecutor moveExecutor = new MoveExecutor();

    @Test
    public void testSlideTile0Spaces(){
        Tile[] row = row(0,0,0,2);
        moveExecutor.slideRight(row);
        Assert.assertEquals(2, row[3].getValue());
    }

    @Test
    public void testSlideTile1Spaces(){
        Tile[] row = row(0,0,2,0);
        moveExecutor.slideRight(row);
        Assert.assertEquals(2, row[3].getValue());
    }

    @Test
    public void testSlideTile2Spaces(){
        Tile[] row = row(0,2,0,0);
        moveExecutor.slideRight(row);
        Assert.assertEquals(2, row[3].getValue());
    }

    @Test
    public void testSlideTile3Spaces(){
        Tile[] row = row(2,0,0,0);
        moveExecutor.slideRight(row);
        Assert.assertEquals(2, row[3].getValue());
    }

    private Tile[] row(int t1, int t2, int t3, int t4){
        return new Tile[]{new Tile(t1), new Tile(t2), new Tile(t3), new Tile(t4)};
    }
}

package com.alanrusnak.api2048.engine;

import com.alanrusnak.api2048.engine.model.Tile;
import org.junit.Assert;
import org.junit.Test;

public class MoveExecutorTest {

    MoveExecutor moveExecutor = new MoveExecutor();

    @Test
    public void testSlideTile0Spaces(){
        Tile[] row = row(0,0,0,2);
        moveExecutor.slideRight(row);
        Assert.assertEquals(2, row[3].getValue());
    }

    @Test
    public void testSlideTile1Spaces(){
        Tile[] row = row(0,0,2,0);
        moveExecutor.slideRight(row);
        Assert.assertEquals(2, row[3].getValue());
    }

    @Test
    public void testSlideTile2Spaces(){
        Tile[] row = row(0,2,0,0);
        moveExecutor.slideRight(row);
        Assert.assertEquals(2, row[3].getValue());
    }

    @Test
    public void testSlideTile3Spaces(){
        Tile[] row = row(2,0,0,0);
        moveExecutor.slideRight(row);
        Assert.assertEquals(2, row[3].getValue());
    }

    @Test
    public void testSlideTileWithSpaceTaken(){
        Tile[] row = row(2,0,0,4);
        moveExecutor.slideRight(row);
        Assert.assertEquals(2, row[2].getValue());
    }

    @Test
    public void testMergeTwoTiles(){
        Tile[] row = row(2,0,0,2);
        moveExecutor.slideRight(row);
        Assert.assertEquals(4, row[3].getValue());
    }

    private Tile[] row(int t1, int t2, int t3, int t4){
        return new Tile[]{new Tile(t1), new Tile(t2), new Tile(t3), new Tile(t4)};
    }
}

Add a new non passing test case for merging


package org.jbpm.migration;

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

import org.apache.log4j.Logger;

/** Convenience class for making the error handling within the parsing and validation processes a little more verbose. */
abstract class ErrorCollector<T extends Exception> {
    private final List<T> warningList = new ArrayList<T>();
    private final List<T> errorList = new ArrayList<T>();
    private final List<T> fatalList = new ArrayList<T>();

    public void warning(final T ex) {
        warningList.add(ex);
    }

    public void error(final T ex) {
        errorList.add(ex);
    }

    public void fatalError(final T ex) {
        fatalList.add(ex);
    }

    public boolean didErrorOccur() {
        // checking warnings might be too restrictive
        return !warningList.isEmpty() || !errorList.isEmpty() ||!fatalList.isEmpty();
    }

    public List<T> getWarningList() {
        return warningList;
    }

    public List<T> getErrorList() {
        return errorList;
    }

    public List<T> getFatalList() {
        return fatalList;
    }

    public void logErrors(final Logger logger) {
        for (final T ex : warningList) {
            logger.warn("==>", ex);
        }
        for (final T ex : errorList) {
            logger.error("==>", ex);
        }
        for (final T ex : fatalList) {
            logger.fatal("==>", ex);
        }
    }
}

package org.jbpm.migration;

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

import org.apache.log4j.Logger;

/** Convenience class for making the error handling within the parsing and validation processes a little more verbose. */
abstract class ErrorCollector<T extends Exception> {
    private final List<T> warningList = new ArrayList<T>();
    private final List<T> errorList = new ArrayList<T>();
    private final List<T> fatalList = new ArrayList<T>();

    public void warning(final T ex) {
        warningList.add(ex);
    }

    public void error(final T ex) {
        errorList.add(ex);
    }

    public void fatalError(final T ex) {
        fatalList.add(ex);
    }

    public boolean didErrorOccur() {
        // checking warnings might be too restrictive
        return !warningList.isEmpty() || !errorList.isEmpty() || !fatalList.isEmpty();
    }

    public List<T> getWarningList() {
        return warningList;
    }

    public List<T> getErrorList() {
        return errorList;
    }

    public List<T> getFatalList() {
        return fatalList;
    }

    public void logErrors(final Logger logger) {
        for (final T ex : warningList) {
            logger.warn("==>", ex);
        }
        for (final T ex : errorList) {
            logger.error("==>", ex);
        }
        for (final T ex : fatalList) {
            logger.fatal("==>", ex);
        }
    }
}

Fix for ignoring BPMN validation - JBPM-4000 - corrected formatting


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

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * @author hakonhall
 */
public interface ClusterControllerJaxRsApi {
    @POST
    @Path("/cluster/v2/{clusterName}/storage/{storageNodeIndex}")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    ClusterControllerStateResponse setNodeState(
            @PathParam("clusterName") String clusterName,
            @PathParam("storageNodeIndex") int storageNodeIndex,
            ClusterControllerStateRequest request);

    @POST
    @Path("/cluster/v2/{clusterName}/storage")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    ClusterControllerStateResponse setClusterState(
            @PathParam("clusterName") String clusterName,
            ClusterControllerStateRequest request);
}

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

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * @author hakonhall
 */
public interface ClusterControllerJaxRsApi {
    @POST
    @Path("/cluster/v2/{clusterName}/storage/{storageNodeIndex}")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    ClusterControllerStateResponse setNodeState(
            @PathParam("clusterName") String clusterName,
            @PathParam("storageNodeIndex") int storageNodeIndex,
            ClusterControllerStateRequest request);

    @POST
    @Path("/cluster/v2/{clusterName}")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    ClusterControllerStateResponse setClusterState(
            @PathParam("clusterName") String clusterName,
            ClusterControllerStateRequest request);
}

Fix path for clustercontroller set state api for applications.


/*******************************************************************************
 * Copyright (c) 2016-2017 Pivotal, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Pivotal, Inc. - initial API and implementation
 *******************************************************************************/
package org.springframework.ide.vscode.bosh;

import java.io.IOException;

import org.springframework.ide.vscode.commons.languageserver.LaunguageServerApp;

public class Main {
	public static void main(String[] args) throws IOException, InterruptedException {
		LaunguageServerApp.start(() -> new BoshLanguageServer(
				(dc) -> null, //TODO: temporarily disabled.. reenable: new BoshCommandCloudConfigProvider(),
				(dc) -> null //TODO: real model provider here!
		));
	}
}

/*******************************************************************************
 * Copyright (c) 2016-2017 Pivotal, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Pivotal, Inc. - initial API and implementation
 *******************************************************************************/
package org.springframework.ide.vscode.bosh;

import java.io.IOException;

import org.springframework.ide.vscode.bosh.models.BoshCommandCloudConfigProvider;
import org.springframework.ide.vscode.commons.languageserver.LaunguageServerApp;

public class Main {
	public static void main(String[] args) throws IOException, InterruptedException {
		LaunguageServerApp.start(() -> new BoshLanguageServer(
				new BoshCommandCloudConfigProvider(),
				(dc) -> null //TODO: real model provider here!
		));
	}
}

Revert "Temporarily disable dynamic cloud-config features in bosh editor"

This reverts commit ebcd3f41cbb75a4e78bac00442390848631aeadc.


package foundation.omni.rest.omniwallet.json;

/**
 *
 */
public class OmniwalletAddressBalance {
}

package foundation.omni.rest.omniwallet.json;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

/**
 * Jackson POJO wrapper for raw Omniwallet address balance
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class OmniwalletAddressBalance {
    private final List<OmniwalletAddressPropertyBalance> balance;

    public OmniwalletAddressBalance(@JsonProperty("balance") List<OmniwalletAddressPropertyBalance> balance) {
        this.balance = balance;
    }

    public List<OmniwalletAddressPropertyBalance> getBalance() {
        return balance;
    }
}

Add missing code from previous commit

Add missing code from previous commit


package com.herocc.bukkit.core.commands;

import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import com.herocc.bukkit.core.Core;

import net.md_5.bungee.api.ChatColor;

public class CommandFakeblock implements CommandExecutor {
	private final Core plugin = Core.getPlugin();

	@SuppressWarnings("deprecation")
	@Override
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] arg) {
		if (cmd.getName().equalsIgnoreCase("fakeblock")) {
	        if (sender.hasPermission("core.head.get")) {
	        	Player player = (Player) sender;
	        	player.sendBlockChange(player.getLocation(), Material.WOOL, (byte) 0);
	        	sender.sendMessage("The block has changed!");
	        } else {
	        	sender.sendMessage(ChatColor.RED + "Sorry, You do not have permission to use this command!");
	        }
		}
		return false;
	}

}

package com.herocc.bukkit.core.commands;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import com.herocc.bukkit.core.Core;

public class CommandFakeblock implements CommandExecutor {
	private final Core plugin = Core.getPlugin();

	@SuppressWarnings("deprecation")
	@Override
	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] arg) {
		if (cmd.getName().equalsIgnoreCase("fakeblock")) {
	        if (sender.hasPermission("core.head.get")) {
	        	Player player = (Player) sender;
	        	player.sendBlockChange(player.getLocation(), Material.WOOL, (byte) 0);
	        	sender.sendMessage("The block has changed!");
	        } else {
	        	sender.sendMessage(ChatColor.RED + "Sorry, You do not have permission to use this command!");
	        }
		}
		return false;
	}

}

Use the ChatColor from Bukkit instead of BungeeCord.