package org.spoofax.jsglr2.actions;

import org.spoofax.jsglr2.characters.ICharacters;
import org.spoofax.jsglr2.parsetable.IProduction;
import org.spoofax.jsglr2.parsetable.ProductionType;

public class Reduce extends Action implements IReduce {

    private final IProduction production;
    private final ProductionType productionType;
    private final int arity;

    public Reduce(ICharacters characters, IProduction production, ProductionType productionType, int arity) {
        super(characters);

        this.production = production;
        this.productionType = productionType;
        this.arity = arity;

        /*
         * NOTE: according to Eduardo, the type of the action and of the production should match for types REJECT /
         * PREFER / AVOID at least. There seems to be a bug in the parse table generator.
         */
        assert !(productionType == ProductionType.REJECT || productionType == ProductionType.PREFER
            || productionType == ProductionType.AVOID) || productionType == production.productionType();

        assert !(production.productionType() == ProductionType.REJECT
            || production.productionType() == ProductionType.PREFER
            || production.productionType() == ProductionType.AVOID) || production.productionType() == productionType;
    }

    public IProduction production() {
        return production;
    }

    public ProductionType productionType() {
        return productionType;
    }

    public int arity() {
        return arity;
    }

}

package org.spoofax.jsglr2.actions;

import org.spoofax.jsglr2.characters.ICharacters;
import org.spoofax.jsglr2.parsetable.IProduction;
import org.spoofax.jsglr2.parsetable.ProductionType;

public class Reduce extends Action implements IReduce {

    private final IProduction production;
    private final ProductionType productionType;
    private final int arity;

    public Reduce(ICharacters characters, IProduction production, ProductionType productionType, int arity) {
        super(characters);

        this.production = production;
        this.productionType = productionType;
        this.arity = arity;

        /*
         * NOTE: according to Eduardo, the type of the action and of the production should match for types REJECT /
         * PREFER / AVOID at least. There seems to be a bug in the parse table generator. If this bug is fixed the
         * asserts below should succeed (they are failing now).
         *
         * assert !(productionType == ProductionType.REJECT || productionType == ProductionType.PREFER || productionType
         * == ProductionType.AVOID) || productionType == production.productionType();
         *
         * assert !(production.productionType() == ProductionType.REJECT || production.productionType() ==
         * ProductionType.PREFER || production.productionType() == ProductionType.AVOID) || production.productionType()
         * == productionType;
         */
    }

    public IProduction production() {
        return production;
    }

    public ProductionType productionType() {
        return productionType;
    }

    public int arity() {
        return arity;
    }

}

Disable failing asserts due to parser generator bug


package org.verapdf.model.tools;

import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSObject;

/**
 * Created by Evgeniy Muravitskiy on 4/27/15.
 *

 * This class specified for creating ID`s for every object from model.
 */
public final class IDGenerator {

    private IDGenerator(){}

    /**
     * Generate ID for pdf box object. Current method generate a string of the form 'N M' for
     * {@link org.apache.pdfbox.cos.COSObject}, where 'N' and 'M' are numbers, and null
     * for other pdf box objects
     * @param pdfBoxObject object of pdf box library
     * @return string representation of ID
     */
    public static String generateID(COSBase pdfBoxObject) {
        if (pdfBoxObject instanceof COSObject) {
            return ((COSObject) pdfBoxObject).getObjectNumber() + " " + ((COSObject) pdfBoxObject).getGenerationNumber();
        }
        return null;
    }
}

package org.verapdf.model.tools;

import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSObject;

/**
 * Created by Evgeniy Muravitskiy on 4/27/15.
 *

 * This class specified for creating ID`s for every object from model.
 */
public final class IDGenerator {

    private IDGenerator(){}

    /**
     * Generate ID for pdf box object. Current method generate a string of the form 'N M' for
     * {@link org.apache.pdfbox.cos.COSObject}, where 'N' and 'M' are numbers, and null
     * for other pdf box objects
     * @param pdfBoxObject object of pdf box library
     * @return string representation of ID
     */
    public static String generateID(COSBase pdfBoxObject) {
        if (pdfBoxObject instanceof COSObject) {
            return ((COSObject) pdfBoxObject).getObjectNumber() + " " + ((COSObject) pdfBoxObject).getGenerationNumber();
        } else {
            return null;
        }
    }
}

Change working principle of id generating


/*
 * Copyright 2013 MovingBlocks
 *
 * 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.terasology.utilities.gson;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import org.terasology.input.Input;
import org.terasology.input.InputType;

import java.lang.reflect.Type;

/**
 * @author Immortius
 */
public class InputHandler implements JsonSerializer<Input>, JsonDeserializer<Input> {

    @Override
    public Input deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        return InputType.parse(json.getAsString());
    }

    @Override
    public JsonElement serialize(Input src, Type typeOfSrc, JsonSerializationContext context) {
        return new JsonPrimitive(src.toString());
    }
}

/*
 * Copyright 2013 MovingBlocks
 *
 * 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.terasology.utilities.gson;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import org.terasology.input.Input;
import org.terasology.input.InputType;

import java.lang.reflect.Type;

/**
 * @author Immortius
 */
public class InputHandler implements JsonSerializer<Input>, JsonDeserializer<Input> {

    @Override
    public Input deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        return InputType.parse(json.getAsString().replace(" ", "_"));
    }

    @Override
    public JsonElement serialize(Input src, Type typeOfSrc, JsonSerializationContext context) {
        return new JsonPrimitive(src.toString());
    }
}

Fix to input handler to support space -> underscore conversion.


/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software License
 * version 1.1, a copy of which has been included with this distribution in
 * the LICENSE file.
 */
package org.apache.james.services;

import java.util.Iterator;

import org.apache.avalon.phoenix.Service;

/**
 * Interface for Phoenix blocks to access a store of Users. A UserStore
 * contains one or more UserRepositories. Multiple UserRepositories may or may
 * not have overlapping membership.
 *
 * @version 1.0.0, 24/04/1999
 * @author  Federico Barbieri <scoobie@pop.systemy.it>
 * @author Charles Benett
 */
public interface UsersStore
    extends Service {

    String ROLE = "org.apache.james.services.UsersStore";

    UsersRepository getRepository( String name );

    Iterator getRepositoryNames();
}

/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software License
 * version 1.1, a copy of which has been included with this distribution in
 * the LICENSE file.
 */
package org.apache.james.services;

import java.util.Iterator;

/**
 * Interface for Phoenix blocks to access a store of Users. A UserStore
 * contains one or more UserRepositories. Multiple UserRepositories may or may
 * not have overlapping membership.
 *
 * @version 1.0.0, 24/04/1999
 * @author  Federico Barbieri <scoobie@pop.systemy.it>
 * @author Charles Benett
 */
public interface UsersStore {

    String ROLE = UsersStore.class.getName();

    UsersRepository getRepository( String name );

    Iterator getRepositoryNames();
}

Remove reference to long deprecated Service interface.


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

import io.netty.util.internal.PlatformDependent;
import org.junit.Test;

import java.lang.reflect.Method;

public class ShadingIT {

    @Test
    public void testShadingNativeTransport() throws Exception {
        testShading0(PlatformDependent.isOsx() ? "io.netty.channel.kqueue.KQueue" : "io.netty.channel.epoll.Epoll");
    }

    @Test
    public void testShadingTcnative() throws Exception {
        testShading0("io.netty.handler.ssl.OpenSsl");
    }

    private static void testShading0(String classname) throws Exception {
        String shadingPrefix = System.getProperty("shadingPrefix");
        final Class<?> clazz = Class.forName(shadingPrefix + '.' + classname);
        Method method = clazz.getMethod("ensureAvailability");
        method.invoke(null);
    }
}

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

import io.netty.util.internal.PlatformDependent;
import org.junit.Ignore;
import org.junit.Test;

import java.lang.reflect.Method;

public class ShadingIT {

    @Test
    public void testShadingNativeTransport() throws Exception {
        testShading0(PlatformDependent.isOsx() ? "io.netty.channel.kqueue.KQueue" : "io.netty.channel.epoll.Epoll");
    }

    @Ignore("Figure out why this sometimes fail on the CI")
    @Test
    public void testShadingTcnative() throws Exception {
        testShading0("io.netty.handler.ssl.OpenSsl");
    }

    private static void testShading0(String classname) throws Exception {
        String shadingPrefix = System.getProperty("shadingPrefix");
        final Class<?> clazz = Class.forName(shadingPrefix + '.' + classname);
        Method method = clazz.getMethod("ensureAvailability");
        method.invoke(null);
    }
}

Disable test as it sometimes fails on the CI


package com.paritytrading.parity.client.command;

import com.paritytrading.parity.client.TerminalClient;
import java.util.Scanner;

class HelpCommand implements Command {

    @Override
    public void execute(TerminalClient client, Scanner arguments) throws CommandException {
        if (arguments.hasNext()) {
            Command command = Commands.find(arguments.next());

            if (arguments.hasNext())
                throw new CommandException();

            if (command != null)
                displayCommandHelp(client, command);
            else
                displayGeneralHelp(client);
        } else {
            displayGeneralHelp(client);
        }
    }

    private void displayGeneralHelp(TerminalClient client) {
        client.printf("Commands:\n");

        int maxCommandNameLength = calculateMaxCommandNameLength();

        for (Command command : Commands.all())
            client.printf("  %-" + maxCommandNameLength + "s  %s\n", command.getName(), command.getDescription());

        client.printf("\nType 'help <command>' for command specific help.\n");
    }

    private void displayCommandHelp(TerminalClient client, Command command) {
        client.printf("Usage: %s\n\n  %s\n\n", command.getUsage(), command.getDescription());
    }

    private int calculateMaxCommandNameLength() {
        return Commands.all().collectInt(c -> c.getName().length()).max();
    }

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

    @Override
    public String getDescription() {
        return "Display the help";
    }

    @Override
    public String getUsage() {
        return "help [command]";
    }

}

package com.paritytrading.parity.client.command;

import com.paritytrading.parity.client.TerminalClient;
import java.util.Scanner;

class HelpCommand implements Command {

    @Override
    public void execute(TerminalClient client, Scanner arguments) throws CommandException {
        if (arguments.hasNext()) {
            Command command = Commands.find(arguments.next());

            if (arguments.hasNext())
                throw new CommandException();

            if (command != null)
                displayCommandHelp(client, command);
            else
                displayGeneralHelp(client);
        } else {
            displayGeneralHelp(client);
        }
    }

    private void displayGeneralHelp(TerminalClient client) {
        client.printf("Commands:\n");

        int maxCommandNameLength = calculateMaxCommandNameLength();

        for (Command command : Commands.all())
            client.printf("  %-" + maxCommandNameLength + "s  %s\n", command.getName(), command.getDescription());

        client.printf("\nType 'help <command>' for command specific help.\n");
    }

    private void displayCommandHelp(TerminalClient client, Command command) {
        client.printf("Usage: %s\n\n  %s\n\n", command.getUsage(), command.getDescription());
    }

    private int calculateMaxCommandNameLength() {
        return Commands.names().collectInt(String::length).max();
    }

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

    @Override
    public String getDescription() {
        return "Display the help";
    }

    @Override
    public String getUsage() {
        return "help [command]";
    }

}

Simplify command name length calculation


// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.security;

import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.KeyStoreException;

/**
 * @author bjorncs
 */
public enum KeyStoreType {
    JKS {
        KeyStore createKeystore() throws KeyStoreException {
            return KeyStore.getInstance("JKS");
        }
    },
    PKCS12 {
        KeyStore createKeystore() throws KeyStoreException {
            return KeyStore.getInstance("PKCS12", BouncyCastleProviderHolder.getInstance());
        }
    };
    abstract KeyStore createKeystore() throws GeneralSecurityException;
}

// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.security;

import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.KeyStoreException;

/**
 * @author bjorncs
 */
public enum KeyStoreType {
    JKS {
        KeyStore createKeystore() throws KeyStoreException {
            return KeyStore.getInstance("BKS", BouncyCastleProviderHolder.getInstance());
        }
    },
    PKCS12 {
        KeyStore createKeystore() throws KeyStoreException {
            return KeyStore.getInstance("PKCS12", BouncyCastleProviderHolder.getInstance());
        }
    };
    abstract KeyStore createKeystore() throws GeneralSecurityException;
}

Use BouncyCastle as provider for JKS keystore


package com.codemagic.powerhour;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

public class Dashboard extends Activity {

    Preferences myPrefs;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dashboard);
        myPrefs = new Preferences(this);
    }

    // method to start playing random songs -- maybe add timer info here
    public void startPlaying(View v) {
        Toast.makeText(v.getContext(), "Clicked!", Toast.LENGTH_SHORT).show();

    }

    public void saveOpts(View v) {

    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.dashboard, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

package com.codemagic.powerhour;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

public class Dashboard extends Activity {

    Preferences myPrefs;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dashboard);
        myPrefs = new Preferences(this);
    }

    // method to start playing random songs -- maybe add timer info here
    public void startPlaying(View v) {
        Toast.makeText(v.getContext(), "Clicked!", Toast.LENGTH_SHORT).show();

    }

    // will save to the preferences or send directly to timer class
    public void saveOpts(View v) {

    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.dashboard, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

Comment for info of save btn


package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.Source;

import java.util.List;

public class SourceDao extends StudyCalendarMutableDomainObjectDao<Source> {
    public Class<Source> domainClass() {
        return Source.class;
    }

    public List<Source> getAll()  {
        return getHibernateTemplate().find("from Source order by name");
    }

    public Source getByName(String name) {
        List<Source> sources = getHibernateTemplate().find("from Source where name = ?", name);
        if (!sources.isEmpty()) {
            return sources.get(0);
        }
        return null;
    }
}

package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.Source;

import java.util.List;

public class SourceDao extends StudyCalendarMutableDomainObjectDao<Source> {
    public Class<Source> domainClass() {
        return Source.class;
    }

    /**
     * Finds all the activity sources available
     *
     * @return      a list of all the available activity sources
     */
    public List<Source> getAll()  {
        return getHibernateTemplate().find("from Source order by name");
    }

    /**
     * Finds all the actiivty sources for the given activity source name
     *
     * @param  name the name of the activity source to search for
     * @return      the source that was found for the given activity source name
     */
    public Source getByName(String name) {
        List<Source> sources = getHibernateTemplate().find("from Source where name = ?", name);
        if (!sources.isEmpty()) {
            return sources.get(0);
        }
        return null;
    }
}

Add javadoc to source dao.


package com.redhat.chrometwo.api.services;

import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Context;

import com.redhat.chrometwo.api.persistence.dao.AccountDao;
import com.redhat.chrometwo.api.security.SecurityInterceptor;

@Path("/accounts")
@Stateless
@LocalBean
public class AccountWS {

    @EJB
    private AccountDao accountDao;

    @GET
    @Path("/{accountId}")
    public String getAccount(@PathParam("accountId") String accountId,
    						  @Context HttpServletRequest request) throws Exception {
    	// Lookey test code remove me:
    	System.out.println(accountDao.doSomeBackendFunction());
    	System.out.println(request.getAttribute(SecurityInterceptor.ACCOUNT_ID));
    	System.out.println(request.getAttribute(SecurityInterceptor.USER_ID));
    	System.out.println(request.getAttribute(SecurityInterceptor.IS_INTERNAL));

        return "woot88: account: " + request.getAttribute(SecurityInterceptor.ACCOUNT_ID)
            + " id: " + request.getAttribute(SecurityInterceptor.USER_ID)
            + " internal: " + request.getAttribute(SecurityInterceptor.IS_INTERNAL);
    }
}

package com.redhat.chrometwo.api.services;

import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Context;

import com.redhat.chrometwo.api.persistence.dao.AccountDao;
import com.redhat.chrometwo.api.security.SecurityInterceptor;

@Path("/accounts")
@Stateless
@LocalBean
public class AccountWS {

    @EJB
    private AccountDao accountDao;

    @GET
    @Path("/{accountId}")
    public String getAccount(@PathParam("accountId") String accountId,
    						  @Context HttpServletRequest request) throws Exception {
    	// Lookey test code remove me:
    	System.out.println(accountDao.doSomeBackendFunction());
    	System.out.println(request.getAttribute(SecurityInterceptor.ACCOUNT_ID));
    	System.out.println(request.getAttribute(SecurityInterceptor.USER_ID));
    	System.out.println(request.getAttribute(SecurityInterceptor.IS_INTERNAL));

        return "woot 88";
    }
}

Revert "work around EJB's not working"


package org.asg.report;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

public class CleanJob implements Job {

	public void execute(JobExecutionContext context)
			throws JobExecutionException {
		App.statuses.clear();
	}

}

package org.asg.report;

import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

public class CleanJob implements Job {

	private final static Logger LOGGER = Logger.getLogger(CleanJob.class);

	public void execute(JobExecutionContext context)
			throws JobExecutionException {
		App.statuses.clear();
		LOGGER.info("Status Queue was just cleared");
	}

}

Add logging to status queue clearing


package kr.ac.kaist.se.tardis.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.http.HttpStatus;

public class ExceptionHandlingController implements ErrorController {

	@ResponseStatus(code=HttpStatus.NOT_FOUND)
	public String notFound(){
		return "errorpage";
	}

	@ResponseStatus(code=HttpStatus.FORBIDDEN)
	@RequestMapping("error")
	public String forbidden(){
		return "errorpage";
	}

	@Override
	public String getErrorPath() {
		return "/error";
	}
}

package kr.ac.kaist.se.tardis.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.http.HttpStatus;

@Controller
public class ExceptionHandlingController implements ErrorController {

	@ResponseStatus(code=HttpStatus.NOT_FOUND)
	public String notFound(){
		return "errorpage";
	}

	@ResponseStatus(code=HttpStatus.FORBIDDEN)
	@RequestMapping("error")
	public String forbidden(){
		return "errorpage";
	}

	@Override
	public String getErrorPath() {
		return "/error";
	}
}

Fix controller annotation on Error


package cgeo.geocaching.test;

import cgeo.geocaching.geopoint.GeopointParser;
import junit.framework.Assert;
import android.test.AndroidTestCase;

public class GeoPointParserTest extends AndroidTestCase {

    public void testParseLatitude() throws Throwable {

    	Assert.assertEquals(49.0 + 56.031 / 60.0, GeopointParser.parseLatitude("N 49° 56.031"));
    }

    public void testParseLongitude() throws Throwable {

    	Assert.assertEquals(8.0 + 38.564 / 60.0, GeopointParser.parseLongitude("E 8° 38.564"));
    }
}

package cgeo.geocaching.test;

import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.geopoint.GeopointParser;
import junit.framework.Assert;
import android.test.AndroidTestCase;

public class GeoPointParserTest extends AndroidTestCase {

	private static final double refLongitude = 8.0 + 38.564 / 60.0;
	private static final double refLatitude = 49.0 + 56.031 / 60.0;

	public void testParseLatitude() throws Throwable {

		Assert.assertEquals(refLatitude, GeopointParser.parseLatitude("N 49° 56.031"), 1e-8);
	}

	public void testParseLongitude() throws Throwable {

		Assert.assertEquals(refLongitude, GeopointParser.parseLongitude("E 8° 38.564"), 1e-8);
	}

	public void testFullCoordinates() throws Throwable {
		final Geopoint goal = new Geopoint(refLatitude, refLongitude);
		Assert.assertTrue(goal.isEqualTo(GeopointParser.parse("N 49° 56.031 | E 8° 38.564"), 1e-6));
	}

	public void testSouth() throws Throwable {
		Assert.assertEquals(-refLatitude, GeopointParser.parseLatitude("S 49° 56.031"), 1e-8);
	}

	public void testWest() throws Throwable {
		Assert.assertEquals(-refLongitude, GeopointParser.parseLongitude("W 8° 38.564"), 1e-8);
	}

	public void testLowerCase() throws Throwable {
		Assert.assertEquals(refLongitude, GeopointParser.parseLongitude("e 8° 38.564"), 1e-8);
	}
}

Add more tests for GeopointParser


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

import org.jetbrains.annotations.NotNull;

public class RollDetails {
    private final long cycle;
    private final long epoch;

    public RollDetails(long cycle, long epoch) {
        this.cycle = cycle;
        this.epoch = epoch;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof RollDetails)) return false;
        @NotNull RollDetails rollDetails = (RollDetails) o;
        return cycle == rollDetails.cycle && epoch == rollDetails.epoch;
    }

    @Override
    public int hashCode() {
        int result = (int) (cycle ^ (cycle >>> 32));
        result = 31 * result + (int) (epoch ^ (epoch >>> 32));
        return result;
    }
}

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

import net.openhft.chronicle.wire.AbstractMarshallable;

public class RollDetails extends AbstractMarshallable {
    final long cycle;
    final long epoch;

    public RollDetails(long cycle, long epoch) {
        this.cycle = cycle;
        this.epoch = epoch;
    }
}

Use extends AbstractMarshallable in more places.


package eu.netide.lib.netip;

import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.projectfloodlight.openflow.protocol.OFMessage;

/**
 * Class representing a message of type OPENFLOW.
 * Note that this only serves as a convenience class - if the MessageType is manipulated, the class will not recognize that.
 */
public class OpenFlowMessage extends Message {
    private OFMessage ofMessage;

    /**
     * Instantiates a new Open flow message.
     */
    public OpenFlowMessage() {
        super(new MessageHeader(), new byte[0]);
        header.setMessageType(MessageType.OPENFLOW);
    }

    /**
     * Gets of message.
     *
     * @return the of message
     */
    public OFMessage getOfMessage() {
        return ofMessage;
    }

    /**
     * Sets of message.
     *
     * @param ofMessage the of message
     */
    public void setOfMessage(OFMessage ofMessage) {
        this.ofMessage = ofMessage;
    }

    @Override
    public byte[] getPayload() {
        ChannelBuffer dcb = ChannelBuffers.dynamicBuffer();
        ofMessage.writeTo(dcb);
        this.payload = dcb.array();
        return this.payload;
    }

    @Override
    public String toString() {
        return "OpenFlowMessage [Header=" + header.toString() + ",Type=" + ofMessage.getType().toString() + ",OFMessage=" + ofMessage.toString() + "]";
    }
}

package eu.netide.lib.netip;

import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.projectfloodlight.openflow.protocol.OFMessage;

/**
 * Class representing a message of type OPENFLOW.
 * Note that this only serves as a convenience class - if the MessageType is manipulated, the class will not recognize that.
 */
public class OpenFlowMessage extends Message {
    private OFMessage ofMessage;

    /**
     * Instantiates a new Open flow message.
     */
    public OpenFlowMessage() {
        super(new MessageHeader(), new byte[0]);
        header.setMessageType(MessageType.OPENFLOW);
    }

    /**
     * Gets of message.
     *
     * @return the of message
     */
    public OFMessage getOfMessage() {
        return ofMessage;
    }

    /**
     * Sets of message.
     *
     * @param ofMessage the of message
     */
    public void setOfMessage(OFMessage ofMessage) {
        this.ofMessage = ofMessage;
    }

    @Override
    public byte[] getPayload() {
        ChannelBuffer dcb = ChannelBuffers.dynamicBuffer();
        ofMessage.writeTo(dcb);
        this.payload = new byte[dcb.readableBytes()];
        dcb.readBytes(this.payload, 0, this.payload.length);
        return this.payload;
    }

    @Override
    public String toString() {
        return "OpenFlowMessage [Header=" + header.toString() + ",Type=" + ofMessage.getType().toString() + ",OFMessage=" + ofMessage.toString() + "]";
    }
}

Fix OpenFlow packets getting stuffed with \0 bytes.


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

package io.reactivex.internal.util;

import static org.junit.Assert.*;
import org.junit.Test;

public class OpenHashSetTest {

    static class Value {

        @Override
        public int hashCode() {
            return 1;
        }

    }

    @Test
    public void addRemoveCollision() {
        Value v1 = new Value();
        Value v2 = new Value();

        OpenHashSet<Value> set = new OpenHashSet<Value>();

        assertTrue(set.add(v1));

        assertFalse(set.add(v1));

        assertFalse(set.remove(v2));

        assertTrue(set.add(v2));

        assertFalse(set.add(v2));

        assertTrue(set.remove(v2));

        assertFalse(set.remove(v2));
    }
}

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

package io.reactivex.internal.util;

import static org.junit.Assert.*;
import org.junit.Test;

public class OpenHashSetTest {

    static class Value {

        @Override
        public int hashCode() {
            return 1;
        }

        @Override
        public boolean equals(Object o) {
            return this == o;
        }
    }

    @Test
    public void addRemoveCollision() {
        Value v1 = new Value();
        Value v2 = new Value();

        OpenHashSet<Value> set = new OpenHashSet<Value>();

        assertTrue(set.add(v1));

        assertFalse(set.add(v1));

        assertFalse(set.remove(v2));

        assertTrue(set.add(v2));

        assertFalse(set.add(v2));

        assertTrue(set.remove(v2));

        assertFalse(set.remove(v2));
    }
}

Add equals() to the unit test to satisfy checkstyle


package com.adaptc.mws.plugins;

/**
 * Represents the current state of a plugin.
 * @author bsaville
 */
public enum PluginState {
	/**
	 * The plugin is created and ready for use, but is not
	 * currently receiving any events
	 */
	STOPPED("Stopped"),
	/**
	 * The plugin is currently receiving events and is working
	 * correctly.
	 */
	STARTED("Started"),
	/**
	 * The plugin is currently not receiving any events but is
	 * also not stopped.
	 *

	 * This should be used when polling or other events should
	 * stop only temporarily without firing the stop events.
	 */
	PAUSED("Paused"),
	/**
	 * MWS has detected an error with the plugin and has automatically
	 * stopped it.  Errors could be due to the following reasons:

	 *

	 *
An invalid configuration was detected when running the
	 * {@link AbstractPlugin#configure} method.
	 *
An unexpected exception was thrown during an event, such
	 * as during polling.
	 *

	 */
	ERRORED("Errored");

	private String str;
	private PluginState(String str) {
		this.str = str;
	}

	/**
	 * Returns a human-readable string of the state, such as "Paused" for {@link #PAUSED}.
	 * @return A human-readable string
	 */
	@Override
	public String toString() {
		return str;
	}
}

Fix documentation for plugin state


package fi.nls.oskari.control.users;

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

import fi.nls.oskari.log.LogFactory;
import fi.nls.oskari.log.Logger;

/**
 * Handles user's password reseting
 */
@Controller
public class UserController {

    private final static Logger log = LogFactory.getLogger(UserController.class);

    public UserController() {

    }

    @RequestMapping("/resetPassword/{uuid}")
    public String getMap(Model model, @ModelAttribute String uuid) {
         System.out.println("Test2");
         return null;
    }

}

package fi.nls.oskari.control.users;

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

import fi.nls.oskari.log.LogFactory;
import fi.nls.oskari.log.Logger;

/**
 * Handles user's password reseting
 */
@Controller
public class UserController {

    private final static Logger log = LogFactory.getLogger(UserController.class);

    public UserController() {

    }

    /**
     * "passwordReset" jsp view should ALWAYS be used by user to reset password
     * @param model
     * @param uuid
     * @return
     */
    @RequestMapping("/resetPassword/{uuid}")
    public String resetPassword(
    		Model model,
    		@ModelAttribute String uuid) {

         return "passwordReset";
    }

}

Return view is set to 'resetPassword'.


package io.github.vcuswimlab.stackintheflow.controller;

import io.github.vcuswimlab.stackintheflow.model.JerseyGet;
import io.github.vcuswimlab.stackintheflow.model.JerseyResponse;
import io.github.vcuswimlab.stackintheflow.model.Query;

/**
 * Created by Chase on 1/5/2017.
 */
public class QueryExecutor {

    private final static String filter = "!-MOiNm40F1U019gR)UUjNV-IQScciBJZ0";

    public static JerseyResponse executeQuery(String q) {
        return executeQuery(new Query("stackoverflow")
                .set(Query.Component.Q, q)
                .set(Query.Component.FILTER, filter)
                .set(Query.Component.SORT, JerseyGet.SortType.RELEVANCE.toString()));
    }

    public static JerseyResponse executeQuery(String q, JerseyGet.SortType sortType) {
        return executeQuery(new Query("stackoverflow")
                .set(Query.Component.Q, q)
                .set(Query.Component.FILTER, filter)
                .set(Query.Component.SORT, sortType.toString()));
    }

    public static JerseyResponse executeQuery(Query q) {
        return executeQuery(q, JerseyGet.SearchType.ADVANCED);
    }

    public static JerseyResponse executeQuery(Query q, JerseyGet.SearchType searchType) {
        return JerseyGet.getInstance().executeQuery(q, searchType);
    }
}

package io.github.vcuswimlab.stackintheflow.controller;

import io.github.vcuswimlab.stackintheflow.model.JerseyGet;
import io.github.vcuswimlab.stackintheflow.model.JerseyResponse;
import io.github.vcuswimlab.stackintheflow.model.Query;

/**
 * Created by Chase on 1/5/2017.
 */
public class QueryExecutor {

    private final static String filter = "!-MOiNm40F1U019gR)UUjNV-IQScciBJZ0";

    public static JerseyResponse executeQuery(String q) {
        return executeQuery(q, JerseyGet.SortType.RELEVANCE);
    }

    public static JerseyResponse executeQuery(String q, JerseyGet.SortType sortType) {
        return executeQuery(new Query("stackoverflow")
                .set(Query.Component.Q, q)
                .set(Query.Component.FILTER, filter)
                .set(Query.Component.SORT, sortType.toString()));
    }

    public static JerseyResponse executeQuery(Query q) {
        return executeQuery(q, JerseyGet.SearchType.ADVANCED);
    }

    public static JerseyResponse executeQuery(Query q, JerseyGet.SearchType searchType) {
        return JerseyGet.getInstance().executeQuery(q, searchType);
    }
}

Clean up execute query methods.


package absyn;

import env.Env;
import javaslang.collection.Tree;
import parse.Loc;
import semantic.SemanticHelper;
import types.Type;

public class DecVar extends Dec {

   public final String name;
   public final String typeName;
   public final Exp init;

   public DecVar(Loc loc, String name, String typeName, Exp init) {
      super(loc);
      this.name = name;
      this.typeName = typeName;
      this.init = init;
   }

   @Override
   public Tree.Node<String> toTree() {
      return Tree.of("DecVar",
                     Tree.of(name),
                     Tree.of(typeName),
                     init.toTree());
   }

   @Override
   public void semantic(Env env) {
      Type t_init = init.semantic(env);
      Type t_var = t_init;
      if (typeName != null) {
         Type t_typeName = env.tenv.get(typeName);
         if (t_typeName == null)
            throw SemanticHelper.undefined(loc, "type", typeName);
         if (!t_init.is(t_typeName))
            throw SemanticHelper.typeMismatch(init.loc, t_init, t_typeName);
         t_var = t_typeName;
      }
      env.venv.put(name, t_var);
   }
}

package absyn;

import env.Env;
import javaslang.collection.List;
import javaslang.collection.Tree;
import parse.Loc;
import semantic.SemanticHelper;
import types.Type;

public class DecVar extends Dec {

   public final String name;
   public final String typeName;
   public final Exp init;

   public DecVar(Loc loc, String name, String typeName, Exp init) {
      super(loc);
      this.name = name;
      this.typeName = typeName;
      this.init = init;
   }

   @Override
   public Tree.Node<String> toTree() {
      List<Tree.Node<String>> children = List.of(Tree.of(name));
      if (typeName != null)
         children = children.append(Tree.of(typeName));
      children = children.append(init.toTree());
      return Tree.of("DecVar", children);
   }

   @Override
   public void semantic(Env env) {
      Type t_init = init.semantic(env);
      Type t_var = t_init;
      if (typeName != null) {
         Type t_typeName = env.tenv.get(typeName);
         if (t_typeName == null)
            throw SemanticHelper.undefined(loc, "type", typeName);
         if (!t_init.is(t_typeName))
            throw SemanticHelper.typeMismatch(init.loc, t_init, t_typeName);
         t_var = t_typeName;
      }
      env.venv.put(name, t_var);
   }
}

Fix toTree method for variable declarations


package org.wildfly.apigen.test.model;

import org.jboss.dmr.ModelNode;
import org.junit.Assert;
import org.junit.Test;
import org.wildfly.apigen.test.AbstractTestCase;
import org.wildfly.apigen.model.AddressTemplate;
import org.wildfly.apigen.model.DefaultStatementContext;
import org.wildfly.apigen.model.ResourceDescription;
import org.wildfly.apigen.operations.ReadDescription;

/**
 * Verifies the Model API helper classes and it usage
 *
 * @author Heiko Braun
 * @since 29/07/15
 */
public class ModelAPITestCase extends AbstractTestCase {

    @Test
    public void testResourceDescriptionParsing() throws Exception {
        AddressTemplate address = AddressTemplate.of("/subsystem=datasources/data-source=*");
        ReadDescription op = new ReadDescription(address);

        ModelNode response = client.execute(op.resolve(new DefaultStatementContext()));
        ResourceDescription description = ResourceDescription.from(response);

        Assert.assertNotNull(description.getText());
        Assert.assertEquals(57, description.getAttributes().size());
    }
}

package org.wildfly.apigen.test.model;

import org.jboss.dmr.ModelNode;
import org.junit.Assert;
import org.junit.Test;
import org.wildfly.apigen.test.AbstractTestCase;
import org.wildfly.apigen.model.AddressTemplate;
import org.wildfly.apigen.model.DefaultStatementContext;
import org.wildfly.apigen.model.ResourceDescription;
import org.wildfly.apigen.operations.ReadDescription;

/**
 * Verifies the Model API helper classes and it usage
 *
 * @author Heiko Braun
 * @since 29/07/15
 */
public class ModelAPITestCase extends AbstractTestCase {

    @Test
    public void testResourceDescriptionParsing() throws Exception {
        AddressTemplate address = AddressTemplate.of("/subsystem=datasources/data-source=*");
        ReadDescription op = new ReadDescription(address);

        ModelNode response = client.execute(op.resolve(new DefaultStatementContext()));
        ResourceDescription description = ResourceDescription.from(response);

        Assert.assertNotNull(description.getText());
        Assert.assertEquals(59, description.getAttributes().size());
    }
}

Update expected number of attributes in datasource test for WF10


package com.thaiopensource.resolver;

import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.io.IOException;

/**
 *
 */
public class BasicResolver implements Resolver {
  static private final BasicResolver theInstance = new BasicResolver();

  protected BasicResolver() {
  }

  public static BasicResolver getInstance() {
    return theInstance;
  }

  public void resolve(Identifier id, Input input) throws IOException, ResolverException {
    if (!input.isResolved())
      input.setUri(resolveUri(id));
  }

  public void open(Input input) throws IOException, ResolverException {
    if (!input.isUriDefinitive())
      return;
    URI uri;
    try {
      uri = new URI(input.getUri());
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
    if (!uri.isAbsolute())
      throw new ResolverException("cannot open relative URI: " + uri);
    URL url = new URL(uri.toASCIIString());
    // XXX should set the encoding properly
    input.setByteStream(url.openStream());
  }

  public static String resolveUri(Identifier id) throws ResolverException {
    try {
      URI uri = new URI(id.getUriReference());
      String base = id.getBase();
      if (base != null)
        uri = new URI(base).resolve(uri);
      return uri.toString();
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
  }
}

package com.thaiopensource.resolver;

import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.io.IOException;

/**
 *
 */
public class BasicResolver implements Resolver {
  static private final BasicResolver theInstance = new BasicResolver();

  protected BasicResolver() {
  }

  public static BasicResolver getInstance() {
    return theInstance;
  }

  public void resolve(Identifier id, Input input) throws IOException, ResolverException {
    if (!input.isResolved())
      input.setUri(resolveUri(id));
  }

  public void open(Input input) throws IOException, ResolverException {
    if (!input.isUriDefinitive())
      return;
    URI uri;
    try {
      uri = new URI(input.getUri());
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
    if (!uri.isAbsolute())
      throw new ResolverException("cannot open relative URI: " + uri);
    URL url = new URL(uri.toASCIIString());
    // XXX should set the encoding properly
    // XXX if this is HTTP and we've been redirected, should do input.setURI with the new URI
    input.setByteStream(url.openStream());
  }

  public static String resolveUri(Identifier id) throws ResolverException {
    try {
      URI uri = new URI(id.getUriReference());
      String base = id.getBase();
      if (base != null)
        uri = new URI(base).resolve(uri);
      return uri.toString();
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
  }
}

Add note that we need to handle HTTP redirection


package org.endeavourhealth.hl7receiver;

import org.endeavourhealth.core.data.config.ConfigManagerException;
import org.endeavourhealth.hl7receiver.hl7.HL7Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Main {

	private static final String PROGRAM_DISPLAY_NAME = "EDS HL7 receiver";
	private static final Logger LOG = LoggerFactory.getLogger(Main.class);

	public static void main(String[] args) {
		try {
            Configuration configuration = Configuration.getInstance();

		    LOG.info("--------------------------------------------------");
            LOG.info(PROGRAM_DISPLAY_NAME);
            LOG.info("--------------------------------------------------");

			HL7Service serviceManager = new HL7Service(configuration);
            serviceManager.start();

            LOG.info("Press any key to exit...");

            System.in.read();

            LOG.info("Shutting down...");
            serviceManager.stop();

            LOG.info("Shutdown");
            System.exit(0);

        } catch (ConfigManagerException cme) {
            System.err.println("Fatal exception occurred initializing ConfigManager [" + cme.getClass().getName() + "] " + cme.getMessage());
		    LOG.error("Fatal exception occurred initializing ConfigManager", cme);
            System.exit(-2);
        }
        catch (Exception e) {
			LOG.error("Fatal exception occurred", e);
			System.exit(-1);
		}
	}
}

package org.endeavourhealth.hl7receiver;

import org.endeavourhealth.core.data.config.ConfigManagerException;
import org.endeavourhealth.hl7receiver.hl7.HL7Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Main {

	private static final String PROGRAM_DISPLAY_NAME = "EDS HL7 receiver";
	private static final Logger LOG = LoggerFactory.getLogger(Main.class);

	private static HL7Service serviceManager;

	public static void main(String[] args) {
		try {
            Configuration configuration = Configuration.getInstance();

		    LOG.info("--------------------------------------------------");
            LOG.info(PROGRAM_DISPLAY_NAME);
            LOG.info("--------------------------------------------------");

			HL7Service serviceManager = new HL7Service(configuration);
            serviceManager.start();

            LOG.info("Started succesfully...");

            Runtime.getRuntime().addShutdownHook(new Thread(() -> shutdown()));

        } catch (ConfigManagerException cme) {
            printToErrorConsole("Fatal exception occurred initializing ConfigManager", cme);
		    LOG.error("Fatal exception occurred initializing ConfigManager", cme);
            System.exit(-2);
        }
        catch (Exception e) {
			LOG.error("Fatal exception occurred", e);
			System.exit(-1);
		}
	}

	private static void shutdown() {
	    try {
            LOG.info("Shutting down...");

            if (serviceManager != null)
                serviceManager.stop();

	    } catch (Exception e) {
            printToErrorConsole("Exception occurred during shutdown", e);
	        LOG.error("Exception occurred during shutdown", e);
        }
    }

    private static void printToErrorConsole(String message, Exception e) {
        System.err.println(message + " [" + e.getClass().getName() + "] " + e.getMessage());
    }
}

Change main thread to support upstart


package com.github.jmchilton.blend4j.galaxy.beans;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown=true)
public class HistoryDetails extends History {
  private String state;

  public String getState() {
    return state;
  }

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

}

package com.github.jmchilton.blend4j.galaxy.beans;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown=true)
public class HistoryDetails extends History {
  private String state;
  private Map<String, List<String>> stateIds = new HashMap<String, List<String>>();

  public String getState() {
    return state;
  }

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

  @JsonProperty("state_ids")
  public void setStateIds(final Map<String, List<String>> stateIds) {
    this.stateIds = stateIds;
  }

  public Map<String, List<String>> getStateIds() {
    return stateIds;
  }

}

Add property to get state map from histories, figure out which HDAs are in what state - ok, failed, etc....


package org.realityforge.replicant.example.server.service.tyrell.replicate;

import java.util.List;
import javax.annotation.Nonnull;
import org.realityforge.replicant.server.EntityMessage;
import org.realityforge.replicant.server.json.JsonEncoder;

public final class Packet
{
  private final int _sequence;
  @Nonnull
  private final List<EntityMessage> _changes;

  public Packet( final int sequence, @Nonnull final List<EntityMessage> changes )
  {
    _sequence = sequence;
    _changes = changes;
  }

  public int getSequence()
  {
    return _sequence;
  }

  @Nonnull
  public List<EntityMessage> getChanges()
  {
    return _changes;
  }

  public String toJson()
  {
    return JsonEncoder.encodeChangeSetFromEntityMessages( getSequence(), _changes );
  }
}

package org.realityforge.replicant.example.server.service.tyrell.replicate;

import java.util.List;
import javax.annotation.Nonnull;
import org.realityforge.replicant.server.EntityMessage;
import org.realityforge.replicant.server.json.JsonEncoder;

public final class Packet
{
  private final int _sequence;
  @Nonnull
  private final List<EntityMessage> _changes;

  public Packet( final int sequence, @Nonnull final List<EntityMessage> changes )
  {
    _sequence = sequence;
    _changes = changes;
  }

  public int getSequence()
  {
    return _sequence;
  }

  @Nonnull
  public List<EntityMessage> getChanges()
  {
    return _changes;
  }

  public String toJson()
  {
    return JsonEncoder.encodeChangeSetFromEntityMessages( getSequence(), getChanges() );
  }
}

Use accessor to do encoding


package study.hard.javalib.nativelib;

public class GetClassTest {

	public static void main(String[] args) {
		GetClassTest tester = new GetClassTest();
		ExtendedClassA extendedA = tester.new ExtendedClassA();
		extendedA.printClass(); // class study.hard.javalib.nativelib.GetClassTest$ExtendedClassA

		Class<? extends ClassA> clazz = extendedA.getClass();
		System.out.println(clazz.getName());
	}

	public class ClassA {
		public void printThisClass() {
			System.out.println(getClass());
		}
	}

	public class ExtendedClassA extends ClassA {
		public void printClass() {
			printThisClass();
		}
	}

}

package study.hard.javalib.nativelib;

public class GetClassTest {

	public static void main(String[] args) {
		GetClassTest tester = new GetClassTest();
		ExtendedClassA extendedA = tester.new ExtendedClassA();
		extendedA.printClass(); // class study.hard.javalib.nativelib.GetClassTest$ExtendedClassA

		Class<? extends ClassA> clazz1 = extendedA.getClass();
		System.out.println(clazz1.getName());

		Class<? extends ClassA> clazz2 = ExtendedClassA.class;
		System.out.println(clazz2.getName());

		System.out.println(clazz1 == clazz2);
	}

	public class ClassA {
		public void printThisClass() {
			System.out.println(getClass());
		}
	}

	public class ExtendedClassA extends ClassA {
		public void printClass() {
			printThisClass();
		}
	}

}

Add a test case to check identity of result of getClass() and classname.class.


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

import ch.rasc.embeddedtc.EmbeddedTomcat;

public class RunDemoOnTomcat {

	public static void main(String[] args) {
		EmbeddedTomcat.create().addDependencyAsResourceJar("resources", "sencha-touch-gpl").startAndWait();
	}
}

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

import ch.rasc.embeddedtc.EmbeddedTomcat;

public class RunDemoOnTomcat {

	public static void main(String[] args) {
		EmbeddedTomcat.create().startAndWait();
	}
}

Remove resource jar handling. Works now out of the box with latest Tomcat


/*
 * Copyright 2016 LINE Corporation
 *
 * LINE Corporation 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 com.linecorp.armeria.client.http;

import com.linecorp.armeria.common.util.Version;

import io.netty.util.AsciiString;

final class HttpHeaderUtil {

    private static final String CLIENT_ARTIFACT_ID = "armeria";

    static final AsciiString USER_AGENT = AsciiString.of(createUserAgentName());

    static String hostHeader(String host, int port, int defaultPort) {
        if (port == defaultPort) {
            return host;
        }

        return new StringBuilder(host.length() + 6).append(host).append(':').append(port).toString();
    }

    private static String createUserAgentName() {
        Version version = Version.identify().get(CLIENT_ARTIFACT_ID);
        return CLIENT_ARTIFACT_ID + '/' + (version != null ? version.artifactId() : "unknown");
    }

    private HttpHeaderUtil() {}
}

/*
 * Copyright 2016 LINE Corporation
 *
 * LINE Corporation 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 com.linecorp.armeria.client.http;

import com.linecorp.armeria.common.util.Version;

import io.netty.util.AsciiString;

final class HttpHeaderUtil {

    private static final String CLIENT_ARTIFACT_ID = "armeria";

    static final AsciiString USER_AGENT = AsciiString.of(createUserAgentName());

    static String hostHeader(String host, int port, int defaultPort) {
        if (port == defaultPort) {
            return host;
        }

        return new StringBuilder(host.length() + 6).append(host).append(':').append(port).toString();
    }

    private static String createUserAgentName() {
        final Version version = Version.identify(HttpHeaderUtil.class.getClassLoader())
                                       .get(CLIENT_ARTIFACT_ID);

        return CLIENT_ARTIFACT_ID + '/' + (version != null ? version.artifactVersion() : "unknown");
    }

    private HttpHeaderUtil() {}
}

Fix missing version information in user-agent header


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

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

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import java.io.IOException;

public class MMXOAuthCallbackHandler implements CallbackHandler {
  private static Logger LOGGER = LoggerFactory.getLogger(BFOAuthTokenValidatorImpl.class);

  @Override
  public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
    LOGGER.trace("No op callback handler used");
  }
}

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

import java.io.IOException;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;

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

public class MMXOAuthCallbackHandler implements CallbackHandler {
  private static Logger LOGGER = LoggerFactory.getLogger(MMXOAuthCallbackHandler.class);

  @Override
  public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
    LOGGER.trace("No op callback handler used");
  }
}

Correct a misleading class name for the logger.


package org.frawa.elmtest.run;

import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.ConfigurationType;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

public class ElmTestConfigurationFactory extends ConfigurationFactory {

    private static final String FACTORY_NAME = "Elm Test configuration factory";

    static final Icon RUN_ICON = IconLoader.getIcon("/icons/elm-colorful-original.svg");

    ElmTestConfigurationFactory(ConfigurationType type) {
        super(type);
    }

    @NotNull
    @Override
    public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
        return new ElmTestRunConfiguration(project, this, "Elm Test");
    }

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

    @Nullable
    @Override
    public Icon getIcon() {
        return RUN_ICON;
    }

}

package org.frawa.elmtest.run;

import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.ConfigurationType;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.openapi.project.Project;
import org.elm.ide.icons.ElmIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

public class ElmTestConfigurationFactory extends ConfigurationFactory {

    private static final String FACTORY_NAME = "Elm Test configuration factory";

    static final Icon RUN_ICON = ElmIcons.INSTANCE.getCOLORFUL();

    ElmTestConfigurationFactory(ConfigurationType type) {
        super(type);
    }

    @NotNull
    @Override
    public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
        return new ElmTestRunConfiguration(project, this, "Elm Test");
    }

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

    @Nullable
    @Override
    public Icon getIcon() {
        return RUN_ICON;
    }

}

Fix icon (SVG was being rendered HUGE in WebStorm)


package edu.northwestern.bioinformatics.studycalendar.testing;

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

import org.springframework.context.ApplicationContext;

import javax.sql.DataSource;

/**
 * @author Rhett Sutphin
 */
public class DaoTestCase extends DbTestCase {
    private static ApplicationContext applicationContext = null;

    protected DataSource getDataSource() {
        return (DataSource) getApplicationContext().getBean("dataSource");
    }

    public ApplicationContext getApplicationContext() {
        synchronized (DaoTestCase.class) {
            if (applicationContext == null) {
                applicationContext = ContextTools.createDeployedApplicationContext();
            }
            return applicationContext;
        }
    }
}

package edu.northwestern.bioinformatics.studycalendar.testing;

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

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor;

import javax.sql.DataSource;

/**
 * @author Rhett Sutphin
 */
public class DaoTestCase extends DbTestCase {
    private static ApplicationContext applicationContext = null;
    protected final Log log = LogFactory.getLog(getClass());

    protected MockHttpServletRequest request = new MockHttpServletRequest();
    protected MockHttpServletResponse response = new MockHttpServletResponse();
    private boolean shouldFlush = true;

    protected void setUp() throws Exception {
        super.setUp();
        beginSession();
    }

    protected void tearDown() throws Exception {
        endSession();
        findOpenSessionInViewInterceptor().setFlushModeName("FLUSH_NEVER");
        super.tearDown();
    }

    public void runBare() throws Throwable {
        setUp();
        try {
            runTest();
        } catch (Throwable throwable) {
            shouldFlush = false;
            throw throwable;
        } finally {
            tearDown();
        }
    }

    private void beginSession() {
        log.info("-- beginning DaoTestCase interceptor session --");
        findOpenSessionInViewInterceptor().preHandle(request, response, null);
    }

    private void endSession() {
        log.info("--    ending DaoTestCase interceptor session --");
        OpenSessionInViewInterceptor interceptor = findOpenSessionInViewInterceptor();
        if (shouldFlush) {
            interceptor.postHandle(request, response, null, null);
        }
        interceptor.afterCompletion(request, response, null, null);
    }

    protected void interruptSession() {
        endSession();
        log.info("-- interrupted DaoTestCase session --");
        beginSession();
    }

    private OpenSessionInViewInterceptor findOpenSessionInViewInterceptor() {
        return (OpenSessionInViewInterceptor) getApplicationContext().getBean("openSessionInViewInterceptor");
    }

    protected DataSource getDataSource() {
        return (DataSource) getApplicationContext().getBean("dataSource");
    }

    public ApplicationContext getApplicationContext() {
        synchronized (DaoTestCase.class) {
            if (applicationContext == null) {
                applicationContext = ContextTools.createDeployedApplicationContext();
            }
            return applicationContext;
        }
    }
}

Add open session in view filter support to tests


package kernitus.plugin.OldCombatMechanics.module;

import kernitus.plugin.OldCombatMechanics.OCMMain;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.projectiles.ProjectileSource;

public class ModuleDisableProjectileRandomness extends Module {

    public ModuleDisableProjectileRandomness(OCMMain plugin){
        super(plugin, "disable-projectile-randomness");
    }

    @EventHandler
    public void onProjectileLaunch(ProjectileLaunchEvent e){
        Projectile projectile = e.getEntity(); //Getting the projectile
        ProjectileSource shooter = projectile.getShooter(); //Getting the shooter
        if(shooter instanceof Player){ //If the shooter was a player
            Player player = (Player) shooter;
            if(!isEnabled(player.getWorld())) return; //If this module is enabled in this world
            debug("Making projectile go straight", player);
            //Here we get a unit vector of the direction the player is looking in and multiply it by the projectile's vector's magnitude
            //We then assign this to the projectile as its new velocity
            projectile.setVelocity(player.getLocation().getDirection().normalize().multiply(projectile.getVelocity().length()));
        }
    }
}

package kernitus.plugin.OldCombatMechanics.module;

import kernitus.plugin.OldCombatMechanics.OCMMain;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.Vector;

/**
 * Prevents the noise introduced when shooting with a bow to make arrows go straight.
 */
public class ModuleDisableProjectileRandomness extends Module {

    public ModuleDisableProjectileRandomness(OCMMain plugin){
        super(plugin, "disable-projectile-randomness");
    }

    @EventHandler
    public void onProjectileLaunch(ProjectileLaunchEvent e){
        Projectile projectile = e.getEntity();
        ProjectileSource shooter = projectile.getShooter();

        if(shooter instanceof Player){
            Player player = (Player) shooter;
            if(!isEnabled(player.getWorld())) return;
            debug("Making projectile go straight", player);

            Vector playerDirection = player.getLocation().getDirection().normalize();
            // keep original speed
            Vector arrowVelocity = playerDirection.multiply(projectile.getVelocity().length());

            projectile.setVelocity(arrowVelocity);
        }
    }
}

Remove unnecessary comments and add javadoc


package com.cjm721.overloaded;

import com.cjm721.overloaded.block.ModBlocks;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;

public class OverloadedItemGroups {

  public static final ItemGroup TECH =
      new ItemGroup("Overloaded_Tech") {
        @Override
        public ItemStack createIcon() {
          return new ItemStack(ModBlocks.creativeGenerator);
        }
      };
}

package com.cjm721.overloaded;

import com.cjm721.overloaded.block.ModBlocks;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;

import java.util.Comparator;

public class OverloadedItemGroups {

  public static final ItemGroup TECH =
      new ItemGroup("Overloaded_Tech") {
        @Override
        public ItemStack createIcon() {
          return new ItemStack(ModBlocks.creativeGenerator);
        }

        @Override
        public void fill(NonNullList<ItemStack> items) {
          super.fill(items);

          items.sort(Comparator.<ItemStack, String>comparing(is -> is.getDisplayName().toString()));
        }
      };
}

Sort item group so easier to find things


package com.modesteam.urutau.service;

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

import javax.inject.Inject;

import com.modesteam.urutau.dao.LayerDAO;
import com.modesteam.urutau.model.system.Layer;

public class KanbanService {

	private static final Long FIRST_DEFAULT_LAYER_ID = 1L;

	private static final Long LAST_DEFAULT_LAYER_ID = 4L;

	private final LayerDAO layerDAO;

	public KanbanService() {
		this(null);
	}

	@Inject
	public KanbanService(LayerDAO layerDAO) {
		this.layerDAO = layerDAO;
	}

	/**
	 * Get Default layers of all project:
	 * Backlog, In Progress, Do, Done.
	 *
	 * @return {@link List} of default layers above
	 */
	public List<Layer> getDefaultLayers() {
		List<Layer> defaultLayers = new ArrayList<Layer>();

		for(Long id = FIRST_DEFAULT_LAYER_ID; id <= LAST_DEFAULT_LAYER_ID; id++) {
			Layer found = layerDAO.find(id);
			defaultLayers.add(found);
		}

		return defaultLayers;
	}

	/**
	 * Returns first layer, that is backlog
	 */
	public Layer getBackLogLayer() {
		return layerDAO.find(FIRST_DEFAULT_LAYER_ID);
	}

}

package com.modesteam.urutau.service;

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

import javax.inject.Inject;

import com.modesteam.urutau.dao.LayerDAO;
import com.modesteam.urutau.exception.SystemBreakException;
import com.modesteam.urutau.model.system.Layer;

public class KanbanService {

	private static final Long FIRST_DEFAULT_LAYER_ID = 1L;

	private static final Long LAST_DEFAULT_LAYER_ID = 4L;

	private final LayerDAO layerDAO;

	public KanbanService() {
		this(null);
	}

	@Inject
	public KanbanService(LayerDAO layerDAO) {
		this.layerDAO = layerDAO;
	}

	/**
	 * Get Default layers of all project:
	 * Backlog, In Progress, Do, Done.
	 *
	 * @return {@link List} of default layers above
	 */
	public List<Layer> getDefaultLayers() {
		List<Layer> defaultLayers = new ArrayList<Layer>();

		for(Long id = FIRST_DEFAULT_LAYER_ID; id <= LAST_DEFAULT_LAYER_ID; id++) {
			Layer found = layerDAO.find(id);
			defaultLayers.add(found);
		}

		return defaultLayers;
	}

	/**
	 * Returns first layer, that is backlog
	 */
	public Layer getBackLogLayer() {
		Layer backLogLayer = layerDAO.find(FIRST_DEFAULT_LAYER_ID);;

		if(backLogLayer == null) {
			throw new SystemBreakException("The backlog layer is invalid");
		}

		return backLogLayer;
	}

}

Throw exception if backlog layer are null


package com.github.aureliano.edocs.app.gui.menu;

import javax.swing.JMenuBar;

public class MenuBar extends JMenuBar {

	private static final long serialVersionUID = 5179328504511930019L;

	private FileMenu fileMenu;
	private DocumentMenu documentMenu;

	public MenuBar() {
		this.addMenus();
	}

	private void addMenus() {
		this.fileMenu = new FileMenu();
		this.documentMenu = new DocumentMenu();

		super.add(this.fileMenu);
		super.add(this.documentMenu);
	}
}

package com.github.aureliano.edocs.app.gui.menu;

import javax.swing.JMenuBar;

public class MenuBar extends JMenuBar {

	private static final long serialVersionUID = 5179328504511930019L;

	private FileMenu fileMenu;
	private DocumentMenu documentMenu;
	private HelpMenu helpMenu;

	public MenuBar() {
		this.addMenus();
	}

	private void addMenus() {
		this.fileMenu = new FileMenu();
		this.documentMenu = new DocumentMenu();
		this.helpMenu = new HelpMenu();

		super.add(this.fileMenu);
		super.add(this.documentMenu);
		super.add(this.helpMenu);
	}
}

Add help menu to menu bar.


package com.ushahidi.android;

/**
 * Provides config common to all available test
 *
 * @author Henry Addo
 */
public class DefaultConfig {

    // The api level that Roboelectric will use to run the unit tests
    public static final int EMULATE_SDK = 21;

    private DefaultConfig() {
        // No instance
    }

}

package com.ushahidi.android;

/**
 * Provides config common to all available test
 *
 * @author Henry Addo
 */
public final class DefaultConfig {

    /**
     * The api level that Roboelectric will use to run the unit tests
     */
    public static final int EMULATE_SDK = 21;

    private DefaultConfig() {
        // No instance
    }

}

Make defaul config final so it can't be instantiated


package org.ihtsdo.otf.mapping.rf2.jpa;

import org.hibernate.search.annotations.ContainedIn;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlIDREF;

import org.hibernate.envers.Audited;
import org.ihtsdo.otf.mapping.rf2.Description;
import org.ihtsdo.otf.mapping.rf2.DescriptionRefSetMember;

/**
 * Abstract implementation of {@link DescriptionRefSetMember}.
 */
@MappedSuperclass
@Audited
public abstract class AbstractDescriptionRefSetMember extends
		AbstractRefSetMember implements DescriptionRefSetMember {

	@ManyToOne(targetEntity=DescriptionJpa.class)
/*	*//** The Description associated with this element *//*
	@ManyToOne(cascade = {
			   CascadeType.PERSIST, CascadeType.MERGE
			 }, targetEntity=DescriptionJpa.class)*/
	@JsonBackReference
	@ContainedIn
	private Description description;

	/**
     * {@inheritDoc}
     */
	@Override
	@XmlIDREF
	@XmlAttribute
	public DescriptionJpa getDescription() {
		return (DescriptionJpa)this.description;
	}

	/**
     * {@inheritDoc}
     */
	@Override
	public void setDescription(Description description) {
		this.description = description;

	}
}

package org.ihtsdo.otf.mapping.rf2.jpa;

import org.hibernate.search.annotations.ContainedIn;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlIDREF;

import org.hibernate.envers.Audited;
import org.ihtsdo.otf.mapping.rf2.Description;
import org.ihtsdo.otf.mapping.rf2.DescriptionRefSetMember;

/**
 * Abstract implementation of {@link DescriptionRefSetMember}.
 */
@MappedSuperclass
@Audited
public abstract class AbstractDescriptionRefSetMember extends
		AbstractRefSetMember implements DescriptionRefSetMember {

	@ManyToOne(targetEntity=DescriptionJpa.class, optional=false)
/*	*//** The Description associated with this element *//*
	@ManyToOne(cascade = {
			   CascadeType.PERSIST, CascadeType.MERGE
			 }, targetEntity=DescriptionJpa.class)*/
	@JsonBackReference
	@ContainedIn
	private Description description;

	/**
     * {@inheritDoc}
     */
	@Override
	@XmlIDREF
	@XmlAttribute
	public DescriptionJpa getDescription() {
		return (DescriptionJpa)this.description;
	}

	/**
     * {@inheritDoc}
     */
	@Override
	public void setDescription(Description description) {
		this.description = description;

	}
}

Add another optional=false for the description refset member.


package br.odb.menu;

import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TextView;

import br.odb.knights.R;

public class ShowOutcomeActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.outcome_layout);

        boolean outcomeIsGood = KnightsOfAlentejoSplashActivity.GameOutcome.valueOf( getIntent().getStringExtra( KnightsOfAlentejoSplashActivity.MAPKEY_SUCCESSFUL_LEVEL_OUTCOME) ) == KnightsOfAlentejoSplashActivity.GameOutcome.VICTORY;
        ((TextView) findViewById(R.id.tvOutcome)).setText( getString( outcomeIsGood ? R.string.outcome_good : R.string.outcome_bad ) );
        ((TextView) findViewById(R.id.tvOutcome)).setTextColor(outcomeIsGood ? 0xFF00FF00 : 0xFFFF0000);
        Typeface font = Typeface.createFromAsset(getAssets(), "fonts/MedievalSharp.ttf");
        ( (TextView)findViewById(R.id.tvOutcome) ).setTypeface( font );
    }
}

package br.odb.menu;

import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TextView;

import br.odb.knights.R;

public class ShowOutcomeActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.outcome_layout);

        boolean outcomeIsGood = KnightsOfAlentejoSplashActivity.GameOutcome.valueOf( getIntent().getStringExtra( KnightsOfAlentejoSplashActivity.MAPKEY_SUCCESSFUL_LEVEL_OUTCOME) ) == KnightsOfAlentejoSplashActivity.GameOutcome.VICTORY;
        String text = getString( outcomeIsGood ? R.string.outcome_good : R.string.outcome_bad );
        setTitle( text );
        ((TextView) findViewById(R.id.tvOutcome)).setText( text );
        ((TextView) findViewById(R.id.tvOutcome)).setTextColor(outcomeIsGood ? 0xFF00FF00 : 0xFFFF0000);
        Typeface font = Typeface.createFromAsset(getAssets(), "fonts/MedievalSharp.ttf");
        ( (TextView)findViewById(R.id.tvOutcome) ).setTypeface( font );

    }
}

Use outcome for activity title in said activity


package com.tozny.sdk.realm.methods.link_challenge;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.tozny.sdk.ToznyApiRequest;

import javax.annotation.Nullable;

/**
 * Constructs a Request for invoking the "realm.link_challenge" method.
 */
@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE)
public class LinkChallengeRequest implements ToznyApiRequest {
    @JsonProperty(required=true) private String method = "realm.link_challenge";
    @JsonProperty(required=true) private String destination;
    @JsonProperty private String context;
    @JsonProperty private String callback;
    @JsonProperty private String hostname;
    @JsonProperty private String send;

    public LinkChallengeRequest(String destination, @Nullable String context, @Nullable String callback, @Nullable String hostname, @Nullable Boolean send) {
        this.destination = destination;
        this.context = context;
        this.callback = callback;
        this.hostname = hostname;

        if (send == null) {
            this.send = "yes";
        } else {
            this.send = "no";
        }
    }

    public String getMethod() {
        return method;
    }

    public String getDestination() {
        return destination;
    }

    @Nullable
    public String getContext() {
        return context;
    }

    @Nullable
    public String getCallback() {
        return callback;
    }

    @Nullable
    public String getHostname() {
        return hostname;
    }

    @Nullable
    public Boolean getSend() {
        return send.equals("yes");
    }
}

package com.tozny.sdk.realm.methods.link_challenge;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.tozny.sdk.ToznyApiRequest;

import javax.annotation.Nullable;

/**
 * Constructs a Request for invoking the "realm.link_challenge" method.
 */
@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE)
public class LinkChallengeRequest implements ToznyApiRequest {
    @JsonProperty(required=true) private String method = "realm.link_challenge";
    @JsonProperty(required=true) private String destination;
    @JsonProperty private String context;
    @JsonProperty private String callback;
    @JsonProperty private String hostname;
    @JsonProperty private String send;

    public LinkChallengeRequest(String destination, @Nullable String context, @Nullable String callback, @Nullable String hostname, @Nullable Boolean send) {
        this.destination = destination;
        this.context = context;
        this.callback = callback;
        this.hostname = hostname;

        if (send == null || send ) {
            this.send = "yes";
        } else {
            this.send = "no";
        }
    }

    public String getMethod() {
        return method;
    }

    public String getDestination() {
        return destination;
    }

    @Nullable
    public String getContext() {
        return context;
    }

    @Nullable
    public String getCallback() {
        return callback;
    }

    @Nullable
    public String getHostname() {
        return hostname;
    }

    @Nullable
    public Boolean getSend() {
        return send.equals("yes");
    }
}

Check the value of the Boolean as well. Props @m4dc4p


package com.box.androidsdk.content.requests;

import com.box.androidsdk.content.BoxException;
import com.box.androidsdk.content.BoxFutureTask;
import com.box.androidsdk.content.models.BoxIteratorRecentItems;
import com.box.androidsdk.content.models.BoxSession;

/**
 * BoxRequest to perform operations on the global recents endpoint
 */
public class BoxRequestRecentItems {

    /**
     * Request to get the Recent Items
     */
    public static class GetRecentItems extends BoxRequestList<BoxIteratorRecentItems, BoxRequestRecentItems.GetRecentItems> implements BoxCacheableRequest<BoxIteratorRecentItems> {
        private static final long serialVersionUID = 8123965031279971506L;

        /**
         * Creates a get recent items request
         *
         * @param recentItemsUrl    URL of the recents items endpoint.
         * @param session   the authenticated session that will be used to make the request with.
         */
        public GetRecentItems(String recentItemsUrl, BoxSession session) {
            super(BoxIteratorRecentItems.class, null, recentItemsUrl, session);
        }

        @Override
        public BoxIteratorRecentItems sendForCachedResult() throws BoxException {
            return super.handleSendForCachedResult();
        }

        @Override
        public BoxFutureTask<BoxIteratorRecentItems> toTaskForCachedResult() throws BoxException {
            return super.handleToTaskForCachedResult();
        }
    }
}

package com.box.androidsdk.content.requests;

import com.box.androidsdk.content.BoxException;
import com.box.androidsdk.content.BoxFutureTask;
import com.box.androidsdk.content.models.BoxIteratorRecentItems;
import com.box.androidsdk.content.models.BoxSession;

/**
 * BoxRequest to perform operations on the global recents endpoint
 */
public class BoxRequestRecentItems {

    /**
     * Request to get the Recent Items
     */
    public static class GetRecentItems extends BoxRequestList<BoxIteratorRecentItems, BoxRequestRecentItems.GetRecentItems> implements BoxCacheableRequest<BoxIteratorRecentItems> {
        private static final long serialVersionUID = 8123965031279971506L;
        private static final String LIMIT = "limit";
        private static final String DEFAULT_LIMIT = "100";

        /**
         * Creates a get recent items request
         *
         * @param recentItemsUrl    URL of the recents items endpoint.
         * @param session   the authenticated session that will be used to make the request with.
         */
        public GetRecentItems(String recentItemsUrl, BoxSession session) {
            super(BoxIteratorRecentItems.class, null, recentItemsUrl, session);
            mQueryMap.put(LIMIT, DEFAULT_LIMIT);
        }

        @Override
        public BoxIteratorRecentItems sendForCachedResult() throws BoxException {
            return super.handleSendForCachedResult();
        }

        @Override
        public BoxFutureTask<BoxIteratorRecentItems> toTaskForCachedResult() throws BoxException {
            return super.handleToTaskForCachedResult();
        }
    }
}

Set limit for GET request for recents endpoint


/*
 * 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.lucene.facet.range;

/*
 * 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.
 */

/**
 * Provides range faceting capabilities.
 */
package org.apache.lucene.facet.range;

Fix javadocs by reverting to previous state (script failure possibly)


package com.bookbase.bookbase.fragments.behaviour;

import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;

public class FABScrollBehaviour extends FloatingActionButton.Behavior{

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

    @Override
    public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout,
                                       FloatingActionButton child,
                                       View directTargetChild,
                                       View target,
                                       int nestedScrollAxes){
        return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL ||
                super.onStartNestedScroll(coordinatorLayout,
                        child, directTargetChild, target, nestedScrollAxes);
    }

    @Override
    public void onNestedScroll(CoordinatorLayout coordinatorLayout,
                                    FloatingActionButton child,
                                    View target,
                                    int dxConsumed,
                                    int dyConsumed,
                                    int dxUnconsumed,
                                    int dyUnconsumed){
        super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);

        if(dyConsumed > 0 && child.getVisibility() == View.VISIBLE){
            child.hide();
        } else if(dyConsumed > 0 && child.getVisibility() == View.VISIBLE){
            child.show();
        }
    }

}

package com.bookbase.bookbase.fragments.behaviour;

import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;

public class FABScrollBehaviour extends FloatingActionButton.Behavior{

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

    @Override
    public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout,
                                       FloatingActionButton child,
                                       View directTargetChild,
                                       View target,
                                       int nestedScrollAxes){
        return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL ||
                super.onStartNestedScroll(coordinatorLayout,
                        child, directTargetChild, target, nestedScrollAxes);
    }

    @Override
    public void onNestedScroll(CoordinatorLayout coordinatorLayout,
                                    FloatingActionButton child,
                                    View target,
                                    int dxConsumed,
                                    int dyConsumed,
                                    int dxUnconsumed,
                                    int dyUnconsumed){
        super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);

        if(dyConsumed > 0 && child.getVisibility() == View.VISIBLE){
            child.hide();
        } else if(dyConsumed < 0 && child.getVisibility() != View.VISIBLE){
            child.show();
        }
    }

}

Fix logical error in FAB scroll behaviour


package io.github.izzyleung.zhihudailypurify.task;

import io.github.izzyleung.zhihudailypurify.ZhihuDailyPurifyApplication;
import io.github.izzyleung.zhihudailypurify.bean.DailyNews;

import java.util.List;

public abstract class BaseGetNewsTask extends BaseDownloadTask<Void, Void, List<DailyNews>> {
    protected boolean isRefreshSuccess = true;
    protected boolean isContentSame = false;
    protected String date;

    private OnTaskFinishedCallback mCallback;

    public BaseGetNewsTask(String date, OnTaskFinishedCallback callback) {
        this.date = date;
        this.mCallback = callback;
    }

    @Override
    protected void onPreExecute() {
        mCallback.beforeTaskStart();
    }

    @Override
    protected void onPostExecute(List<DailyNews> resultNewsList) {
        mCallback.afterTaskFinished(resultNewsList, isRefreshSuccess, isContentSame);
    }

    protected boolean checkIsNewsListEquals(List<DailyNews> newsListFromWeb) {
        return newsListFromWeb.equals(ZhihuDailyPurifyApplication.getInstance().getDataSource().newsOfTheDay(date));
    }

    public interface OnTaskFinishedCallback {
        public void beforeTaskStart();

        public void afterTaskFinished(List<DailyNews> resultList, boolean isRefreshSuccess, boolean isContentSame);
    }
}

package io.github.izzyleung.zhihudailypurify.task;

import io.github.izzyleung.zhihudailypurify.ZhihuDailyPurifyApplication;
import io.github.izzyleung.zhihudailypurify.bean.DailyNews;

import java.util.List;

public abstract class BaseGetNewsTask extends BaseDownloadTask<Void, Void, List<DailyNews>> {
    protected boolean isRefreshSuccess = true;
    protected boolean isContentSame = false;
    protected String date;

    private OnTaskFinishedCallback mCallback;

    public BaseGetNewsTask(String date, OnTaskFinishedCallback callback) {
        this.date = date;
        this.mCallback = callback;
    }

    @Override
    protected void onPreExecute() {
        mCallback.beforeTaskStart();
    }

    @Override
    protected void onPostExecute(List<DailyNews> resultNewsList) {
        mCallback.afterTaskFinished(resultNewsList, isRefreshSuccess, isContentSame);
        mCallback = null;
    }

    protected boolean checkIsNewsListEquals(List<DailyNews> newsListFromWeb) {
        return newsListFromWeb.equals(ZhihuDailyPurifyApplication.getInstance().getDataSource().newsOfTheDay(date));
    }

    public interface OnTaskFinishedCallback {
        public void beforeTaskStart();

        public void afterTaskFinished(List<DailyNews> resultList, boolean isRefreshSuccess, boolean isContentSame);
    }
}

Remove callback when the job is done


package at.fhtw.mcs;

import java.util.Scanner;

import at.fhtw.mcs.model.Track;
import at.fhtw.mcs.model.TrackFactory;

class Main {

	public static void main(String[] args) throws InterruptedException {
		String filename = args[0];
		System.out.println("Loading " + filename);
		Track track = TrackFactory.loadTrack(filename);
		track.play();

		try (Scanner scanner = new Scanner(System.in)) {
			while (true) {
				switch (scanner.nextLine()) {
					case "p":
						track.togglePlayPause();
						break;
					case "s":
						track.stop();
						break;
					case "q":
						return;
				}
			}
		}
	}
}

package at.fhtw.mcs;

import java.util.Scanner;

import at.fhtw.mcs.model.Track;
import at.fhtw.mcs.model.TrackFactory;

class Main {

	public static void main(String[] args) throws InterruptedException {
		if (args.length != 1) {
			System.err.println("Usage: ./mcs AUDIO_FILE");
		}

		String filename = args[0];
		System.out.println("Loading " + filename);
		Track track = TrackFactory.loadTrack(filename);
		track.play();

		try (Scanner scanner = new Scanner(System.in)) {
			while (true) {
				switch (scanner.nextLine()) {
					case "p":
						track.togglePlayPause();
						break;
					case "s":
						track.stop();
						break;
					case "q":
						return;
				}
			}
		}
	}
}

Print usage if argument count != 1