// Copyright 2011 Google Inc. All Rights Reserved.

package com.google.android.apps.mytracks;

import com.google.android.apps.mytracks.content.TrackDataHub;

import android.app.Application;

/**
 * MyTracksApplication for keeping global state.
 *
 * @author jshih@google.com (Jimmy Shih)
 *
 */
public class MyTracksApplication extends Application {
  private TrackDataHub trackDataHub;

  /**
   * Gets the application's TrackDataHub.
   *
   */
  public TrackDataHub getTrackDataHub() {
    if (trackDataHub == null) {
      trackDataHub = TrackDataHub.newInstance(getApplicationContext());
    }
    return trackDataHub;
  }

  public void clearTrackDataHub() {
    trackDataHub = null;
  }
}

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

import com.google.android.apps.mytracks.content.TrackDataHub;

import android.app.Application;

/**
 * MyTracksApplication for keeping global state.
 *
 * @author jshih@google.com (Jimmy Shih)
 */
public class MyTracksApplication extends Application {

  private TrackDataHub trackDataHub;

  /**
   * Gets the application's TrackDataHub.
   *
   * Note: use synchronized to make sure only one instance is created per application.
   */
  public synchronized TrackDataHub getTrackDataHub() {
    if (trackDataHub == null) {
      trackDataHub = TrackDataHub.newInstance(getApplicationContext());
    }
    return trackDataHub;
  }

  public void clearTrackDataHub() {
    trackDataHub = null;
  }
}

Fix based on Sandor's comments


package org.cyclops.cyclopscore;

/**
 * Class that can hold basic static things that are better not hard-coded
 * like mod details, texture paths, ID's...
 * @author rubensworks
 */
public final class Reference {

    // Mod info
    public static final String MOD_ID = "cyclopscore";
    public static final String MOD_NAME = "Cyclops Core";
    public static final String MOD_VERSION = "@VERSION@";
    public static final String MOD_BUILD_NUMBER = "@BUILD_NUMBER@";
    public static final String MOD_MC_VERSION = "@MC_VERSION@";
    public static final String GA_TRACKING_ID = "UA-65307010-1";
    public static final String VERSION_URL = "https://raw.githubusercontent.com/CyclopsMC/Versions/master/1.8/CyclopsCore.txt";

    // Mod ID's
    public static final String MOD_VANILLA = "Minecraft";
    public static final String MOD_BAUBLES = "Baubles";
    public static final String MOD_VERSION_CHECKER = "VersionChecker";

    // Dependencies
    public static final String MOD_DEPENDENCIES =
              "required-after:Forge@[12.16.0.1767,);";

}

package org.cyclops.cyclopscore;

/**
 * Class that can hold basic static things that are better not hard-coded
 * like mod details, texture paths, ID's...
 * @author rubensworks
 */
public final class Reference {

    // Mod info
    public static final String MOD_ID = "cyclopscore";
    public static final String MOD_NAME = "Cyclops Core";
    public static final String MOD_VERSION = "@VERSION@";
    public static final String MOD_BUILD_NUMBER = "@BUILD_NUMBER@";
    public static final String MOD_MC_VERSION = "@MC_VERSION@";
    public static final String GA_TRACKING_ID = "UA-65307010-1";
    public static final String VERSION_URL = "https://raw.githubusercontent.com/CyclopsMC/Versions/master/1.9/CyclopsCore.txt";

    // Mod ID's
    public static final String MOD_VANILLA = "Minecraft";
    public static final String MOD_BAUBLES = "Baubles";
    public static final String MOD_VERSION_CHECKER = "VersionChecker";

    // Dependencies
    public static final String MOD_DEPENDENCIES =
              "required-after:Forge@[12.16.0.1767,);";

}

Use correct version checker url


/* This file is part of SableCC ( http://sablecc.org ).
 *
 * See the NOTICE file distributed with this work for copyright information.
 *
 * 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.sablecc.sablecc.launcher;

import org.sablecc.sablecc.exception.InternalException;

public class OptionArgument {

    private Option option;

    private String operand;

    public OptionArgument(
            Option option,
            String operand) {

        if (option == null) {
            throw new InternalException("option may not be null");
        }

        this.option = option;
        this.operand = operand;
    }

    public Option getOption() {

        return this.option;
    }

    public String getOperand() {

        return this.operand;
    }
}

/* This file is part of SableCC ( http://sablecc.org ).
 *
 * See the NOTICE file distributed with this work for copyright information.
 *
 * 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.sablecc.sablecc.launcher;

import org.sablecc.sablecc.exception.InternalException;

/**
 * An option argument is composed of the option and its operand.
 */
public class OptionArgument {

    /** The option for this option argument. */
    private Option option;

    /** The operand for this option argument. */
    private String operand;

    /**
     * Constructs an option argument with the provided option and operand.
     *
     * @param option
     *            the option.
     * @param operand
     *            the operand.
     * @throws InternalException
     *             if the provided option is null.
     */
    public OptionArgument(
            Option option,
            String operand) {

        if (option == null) {
            throw new InternalException("option may not be null");
        }

        this.option = option;
        this.operand = operand;
    }

    /**
     * Returns the option of this option argument.
     *
     * @return the option.
     */
    public Option getOption() {

        return this.option;
    }

    /**
     * Returns the operand of this option argument.
     *
     * @return the argument.
     */
    public String getOperand() {

        return this.operand;
    }
}

Add javadoc comments. See ticket:58.


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

import com.facebook.presto.spi.type.DecimalType;

import java.math.BigDecimal;

import static com.facebook.presto.spi.type.Decimals.rescale;
import static java.nio.charset.StandardCharsets.UTF_8;

public final class HiveDecimalParser
{
    private HiveDecimalParser() {}

    public static BigDecimal parseHiveDecimal(byte[] bytes, int start, int length, DecimalType columnType)
    {
        return rescale(new BigDecimal(new String(bytes, start, length, UTF_8)), columnType);
    }
}

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

import com.facebook.presto.spi.type.DecimalType;

import java.math.BigDecimal;

import static com.facebook.presto.spi.type.Decimals.rescale;
import static java.math.RoundingMode.HALF_UP;
import static java.nio.charset.StandardCharsets.UTF_8;

public final class HiveDecimalParser
{
    private HiveDecimalParser() {}

    public static BigDecimal parseHiveDecimal(byte[] bytes, int start, int length, DecimalType columnType)
    {
        BigDecimal parsed = new BigDecimal(new String(bytes, start, length, UTF_8));
        if (parsed.scale() > columnType.getScale()) {
            // Hive rounds HALF_UP too
            parsed = parsed.setScale(columnType.getScale(), HALF_UP);
        }
        return rescale(parsed, columnType);
    }
}

Apply same rounding as Hive does when converting text to decimal


package com.bnorm.auto.weave.internal.chain;

import com.bnorm.auto.weave.AfterThrowingJoinPoint;
import com.bnorm.auto.weave.internal.Pointcut;

public abstract class AfterThrowingChain extends WrapChain {

    public AfterThrowingChain(Chain wrapped, Pointcut pointcut) {
        super(wrapped, pointcut);
    }

    @Override
    public final Object call() {
        try {
            return super.call();
        } catch (Throwable error) {
            AfterThrowingJoinPoint afterThrowingJoinPoint = new AfterThrowingJoinPoint(pointcut, error);
            afterThrowing(afterThrowingJoinPoint);
            throw error;
        }
    }

    protected abstract void afterThrowing(AfterThrowingJoinPoint afterJoinPoint);
}

package com.bnorm.auto.weave.internal.chain;

import com.bnorm.auto.weave.AfterThrowingJoinPoint;
import com.bnorm.auto.weave.internal.Pointcut;

public abstract class AfterThrowingChain extends WrapChain {

    public AfterThrowingChain(Chain wrapped, Pointcut pointcut) {
        super(wrapped, pointcut);
    }

    @Override
    public final Object call() {
        try {
            return super.call();
        } catch (MethodException error) {
            AfterThrowingJoinPoint afterThrowingJoinPoint = new AfterThrowingJoinPoint(pointcut, error.getCause());
            afterThrowing(afterThrowingJoinPoint);
            throw error;
        }
    }

    protected abstract void afterThrowing(AfterThrowingJoinPoint afterJoinPoint);
}

Fix after throwing chain to catch the right exception


package net.acomputerdog.core.tree;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class Branch<T> {
    private final Branch<T> parent;
    private final Set<Branch<T>> branches = new HashSet<Branch<T>>();
    private final Set<Leaf<T>> leaves = new HashSet<Leaf<T>>();
    private final Tree<T> tree;

    public Branch(Tree<T> tree, Branch<T> parent) {
        this.parent = parent;
        this.tree = tree;
    }

    public boolean isRoot() {
        return parent == null;
    }

    public Branch getParent() {
        return parent;
    }

    public Set<Branch<T>> getBranches() {
        return Collections.unmodifiableSet(branches);
    }

    public Set<Leaf<T>> getLeaves() {
        return Collections.unmodifiableSet(leaves);
    }

    public int getNumBranches() {
        return branches.size();
    }

    public int getNumLeaves() {
        return leaves.size();
    }

    public void addBranch(Branch<T> branch) {
        branches.add(branch);
    }

    public void addLeaf(Leaf<T> leaf) {
        leaves.add(leaf);
    }

    public Tree<T> getTree() {
        return tree;
    }
}

package net.acomputerdog.core.tree;

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

public class Branch<T> {
    private final Branch<T> parent;
    private final List<Branch<T>> branches = new LinkedList<Branch<T>>();
    private final List<Leaf<T>> leaves = new LinkedList<Leaf<T>>();
    private final Tree<T> tree;

    public Branch(Tree<T> tree, Branch<T> parent) {
        this.parent = parent;
        this.tree = tree;
    }

    public boolean isRoot() {
        return parent == null;
    }

    public Branch getParent() {
        return parent;
    }

    public List<Branch<T>> getBranches() {
        return Collections.unmodifiableList(branches);
    }

    public List<Leaf<T>> getLeaves() {
        return Collections.unmodifiableList(leaves);
    }

    public int getNumBranches() {
        return branches.size();
    }

    public int getNumLeaves() {
        return leaves.size();
    }

    public void addBranch(Branch<T> branch) {
        branches.add(branch);
    }

    public void addLeaf(Leaf<T> leaf) {
        leaves.add(leaf);
    }

    public Tree<T> getTree() {
        return tree;
    }
}

Fix branches being mixed in Tree structure


/*
 * Axelor Business Solutions
 *
 * Copyright (C) 2005-2018 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.axelor.meta.schema.views;

import com.fasterxml.jackson.annotation.JsonTypeName;
import java.lang.invoke.MethodHandles;
import javax.xml.bind.annotation.XmlType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated
@XmlType
@JsonTypeName("include")
public class PanelInclude extends FormInclude {

  private static final Logger logger =
      LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

  public PanelInclude() {
    logger.warn("Usage of \"panel-include\" tag is deprecated. Use view extensions instead.");
  }
}

/*
 * Axelor Business Solutions
 *
 * Copyright (C) 2005-2018 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.axelor.meta.schema.views;

import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.xml.bind.annotation.XmlType;

@XmlType
@JsonTypeName("include")
public class PanelInclude extends FormInclude {}

Revert "Warn about deprecated "panel-include" tag"


package com.elmakers.mine.bukkit.api.wand;

import com.elmakers.mine.bukkit.api.magic.Mage;

import java.util.Collection;

public interface WandUpgradePath {
    public String getKey();
    public String getName();
    public boolean requiresSpell(String spellKey);
    public boolean hasSpell(String spellKey);
    public String getDescription();
    public boolean hasPath(String pathName);
    public boolean hasUpgrade();
    public boolean checkUpgradeRequirements(Wand wand, Mage mage);
    public WandUpgradePath getUpgrade();
    public void upgrade(Wand wand, Mage mage);
    public Collection<String> getSpells();
    public Collection<String> getRequiredSpells();
    public boolean canEnchant(Wand wand);
    public boolean earnsSP();
}

package com.elmakers.mine.bukkit.api.wand;

import com.elmakers.mine.bukkit.api.magic.Mage;

import java.util.Collection;

public interface WandUpgradePath {
    public String getKey();
    public String getName();
    public boolean requiresSpell(String spellKey);
    public boolean hasSpell(String spellKey);
    public String getDescription();
    public boolean hasPath(String pathName);
    public boolean hasUpgrade();
    public boolean checkUpgradeRequirements(Wand wand, Mage mage);
    public WandUpgradePath getUpgrade();
    public String translatePath(String path);
    public void upgrade(Wand wand, Mage mage);
    public Collection<String> getSpells();
    public Collection<String> getRequiredSpells();
    public boolean canEnchant(Wand wand);
    public boolean earnsSP();
}

Add path translation to fix parallel paths not upgrading spells


package org.biojava.examples;

import javax.vecmath.Point3d;

import org.apache.spark.api.java.JavaPairRDD;
import org.biojava.spark.data.StructureDataRDD;

/**
 * Example of mapping the PDB to chains of just C-alpha coords.
 * @author Anthony Bradley
 *
 */
public class MapChains {

	/**
	 * Example of mapping the PDB to chains of just C-alpha coords.
	 * @param args
	 */
	public static void main(String[] args) {

		JavaPairRDD<String, Point3d[]> calphaChains =
				new StructureDataRDD("/Users/anthony/full")
				.filterResolution(3.0)
				.filterRfree(0.3)
				.getCalphaPair();

	}
}

package org.biojava.examples;

import org.biojava.spark.data.StructureDataRDD;

/**
 * Example of mapping the PDB to chains of just C-alpha coords.
 * Calculate the mean C-alpha length in the PDB.
 * @author Anthony Bradley
 *
 */
public class MapChains {

	/**
	 * Example of mapping the PDB to chains of just C-alpha coords.
	 * Calculate the mean C-alpha length in the PDB.
	 * @param args
	 */
	public static void main(String[] args) {

		// Starter counter
		Long startTime = System.currentTimeMillis();

		Double meanCalphaLength =
				new StructureDataRDD("/Users/anthony/full")
				.filterResolution(3.0)
				.filterRfree(0.3)
				.getCalphaPair()
				.mapToDouble(t -> t._2.length)
				.mean();

		System.out.println(meanCalphaLength+" is the mean C-alpha length in the PDB");
		System.out.println("Found in "+(System.currentTimeMillis()-startTime)+" ms");
	}
}

Clean up the C-alpha example.


package nl.ekholabs.nlp.controller;

import java.io.IOException;

import nl.ekholabs.nlp.client.ElsieDeeSightFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;

@RestController
public class FaceClassifierController {

  private final ElsieDeeSightFeignClient elsieDeeSightFeignClient;

  @Autowired
  public FaceClassifierController(final ElsieDeeSightFeignClient elsieDeeSightFeignClient) {
    this.elsieDeeSightFeignClient = elsieDeeSightFeignClient;
  }

  @PostMapping(path = "/processImage", consumes = MULTIPART_FORM_DATA_VALUE)
  public ResponseEntity<byte[]> processImage(final @RequestParam(value = "image") MultipartFile image) throws IOException {
    return elsieDeeSightFeignClient.process(image);
  }
}

package nl.ekholabs.nlp.controller;

import java.io.IOException;

import nl.ekholabs.nlp.client.ElsieDeeSightFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;

@RestController
public class FaceClassifierController {

  private final ElsieDeeSightFeignClient elsieDeeSightFeignClient;

  @Autowired
  public FaceClassifierController(final ElsieDeeSightFeignClient elsieDeeSightFeignClient) {
    this.elsieDeeSightFeignClient = elsieDeeSightFeignClient;
  }

  @PostMapping(path = "/classifyImage", consumes = MULTIPART_FORM_DATA_VALUE)
  public ResponseEntity<byte[]> classifyImage(final @RequestParam(value = "image") MultipartFile image) throws IOException {
    return elsieDeeSightFeignClient.process(image);
  }
}

Rename Face Classifier controller method.


/**
 * Copyright (C) 2013 Alexander Szczuczko
 *
 * This file may be modified and distributed under the terms
 * of the MIT license. See the LICENSE file for details.
 */
package ca.szc.keratin.core.net.handlers;

import net.engio.mbassy.listener.Handler;

import org.pmw.tinylog.Logger;

import ca.szc.keratin.core.event.message.recieve.ReceivePing;

public class ServerPingHandler
{
    @Handler
    private void handlePingPong( ReceivePing event )
    {
        Logger.trace( "Handling PING by sending echo PONG" );
        event.pong();
    }
}

/**
 * Copyright (C) 2013 Alexander Szczuczko
 *
 * This file may be modified and distributed under the terms
 * of the MIT license. See the LICENSE file for details.
 */
package ca.szc.keratin.core.net.handlers;

import net.engio.mbassy.listener.Handler;

import org.pmw.tinylog.Logger;

import ca.szc.keratin.core.event.message.recieve.ReceivePing;
import ca.szc.keratin.core.event.message.recieve.ReceivePong;

public class ServerPingHandler
{
    @Handler
    private void handlePingPong( ReceivePing event )
    {
        Logger.trace( "Handling PING by sending echo PONG" );
        event.pong();
    }

    @Handler
    private void handleServerPong( ReceivePong event )
    {
        // Nothing
    }
}

Handle ReceivePong events, do nothing. Just to stop unhandled message flooding.


package au.gov.dto.dibp.appointments.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("redirect:/login");
    }
}

package au.gov.dto.dibp.appointments.config;

import org.springframework.boot.autoconfigure.mustache.web.MustacheViewResolver;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("redirect:/login");
    }

    @Override
    public void configureViewResolvers(ViewResolverRegistry registry) {
        registry.viewResolver(new MustacheViewResolver());
    }
}

Configure MustacheViewResolver as default view resolver


package info.u_team.u_team_core.intern.init;

import info.u_team.u_team_core.UCoreMain;
import info.u_team.u_team_core.intern.network.SyncedContainerMessage;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.network.NetworkRegistry;
import net.minecraftforge.fml.network.simple.SimpleChannel;

public class UCoreNetwork {

	public static final String PROTOCOL = "1.14.2-1";

	public static final SimpleChannel NETWORK = NetworkRegistry.newSimpleChannel(new ResourceLocation(UCoreMain.MODID, "network"), () -> PROTOCOL, PROTOCOL::equals, PROTOCOL::equals);

	public static void construct() {
		NETWORK.registerMessage(0, SyncedContainerMessage.class, SyncedContainerMessage::encode, SyncedContainerMessage::decode, SyncedContainerMessage.Handler::handle);
	}

}

package info.u_team.u_team_core.intern.init;

import info.u_team.u_team_core.UCoreMain;
import info.u_team.u_team_core.intern.network.SyncedContainerMessage;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.network.NetworkRegistry;
import net.minecraftforge.fml.network.simple.SimpleChannel;

public class UCoreNetwork {

	public static final String PROTOCOL = "1.14.4-1";

	public static final SimpleChannel NETWORK = NetworkRegistry.newSimpleChannel(new ResourceLocation(UCoreMain.MODID, "network"), () -> PROTOCOL, PROTOCOL::equals, PROTOCOL::equals);

	public static void construct() {
		NETWORK.registerMessage(0, SyncedContainerMessage.class, SyncedContainerMessage::encode, SyncedContainerMessage::decode, SyncedContainerMessage.Handler::handle);
	}

}

Update network protocol to 1.14.4


package totemic_commons.pokefenn.ceremony;

import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import totemic_commons.pokefenn.api.ceremony.Ceremony;
import totemic_commons.pokefenn.api.music.MusicInstrument;
import totemic_commons.pokefenn.entity.boss.EntityBaykok;

public class CeremonyBaykok extends Ceremony
{
    public CeremonyBaykok(String name, int musicNeeded, int maxStartupTime, MusicInstrument... instruments)
    {
        super(name, musicNeeded, maxStartupTime, instruments);
    }

    @Override
    public void effect(World world, BlockPos pos, int time)
    {
        if(world.isRemote || time != getEffectTime() - 1)
            return;

        world.playBroadcastSound(1013, pos, 0); //Wither spawn sound
        BlockPos spos = pos.offset(EnumFacing.getHorizontal(world.rand.nextInt(4)));
        EntityBaykok baykok = new EntityBaykok(world);
        baykok.setPosition(spos.getX() + 0.5, spos.getY(), spos.getZ() + 0.5);
        baykok.onInitialSpawn(world.getDifficultyForLocation(spos), null);
        world.spawnEntityInWorld(baykok);
    }

    @Override
    public int getEffectTime()
    {
        return 4 * 20;
    }
}

package totemic_commons.pokefenn.ceremony;

import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import totemic_commons.pokefenn.api.ceremony.Ceremony;
import totemic_commons.pokefenn.api.music.MusicInstrument;
import totemic_commons.pokefenn.entity.boss.EntityBaykok;

public class CeremonyBaykok extends Ceremony
{
    public CeremonyBaykok(String name, int musicNeeded, int maxStartupTime, MusicInstrument... instruments)
    {
        super(name, musicNeeded, maxStartupTime, instruments);
    }

    @Override
    public void effect(World world, BlockPos pos, int time)
    {
        if(world.isRemote || time != getEffectTime() - 1)
            return;

        world.playBroadcastSound(1023, pos, 0); //Wither spawn sound
        BlockPos spos = pos.offset(EnumFacing.getHorizontal(world.rand.nextInt(4)));
        EntityBaykok baykok = new EntityBaykok(world);
        baykok.setPosition(spos.getX() + 0.5, spos.getY(), spos.getZ() + 0.5);
        baykok.onInitialSpawn(world.getDifficultyForLocation(spos), null);
        world.spawnEntityInWorld(baykok);
    }

    @Override
    public int getEffectTime()
    {
        return 4 * 20;
    }
}

Fix broadcast sound on Baykok spawn


package org.jenkinsci.plugins.workflow.demo;

import org.apache.commons.io.IOUtils;
import org.junit.Assert;
import org.junit.Test;

import java.net.URL;

/**
 * Integration test for webapp.
 */
public class AppTest extends Assert {
    @Test
    public void testApp() throws Exception {
        URL app = getSUT();
        String contents = IOUtils.toString(app.openStream());
        assertTrue(contents.contains("Hello Jenkins!"));

        // this is supposed to be an integration test,
        // let's take some time. We want this to be longer than the build for sure.
        Thread.sleep(30*1000);
    }

    private URL getSUT() throws Exception {
        String url = System.getProperty("url");
        assertTrue("Subject under test should be passed in via -Durl=...", url!=null);
        return new URL(url);
    }
}

package org.jenkinsci.plugins.workflow.demo;

import org.apache.commons.io.IOUtils;
import org.junit.Assert;
import org.junit.Test;

import java.net.URL;

/**
 * Integration test for webapp.
 */
public class AppTest extends Assert {
    @Test
    public void testApp() throws Exception {
        URL app = getSUT();
        String contents = IOUtils.toString(app.openStream());
        assertTrue(contents.contains("Hello Jenkins!"));

        // this is supposed to be an integration test,
        // let's take some time. We want this to be longer than the build for sure.
        Thread.sleep(Integer.getInteger("duration", 30) * 1000);
    }

    private URL getSUT() throws Exception {
        String url = System.getProperty("url");
        assertTrue("Subject under test should be passed in via -Durl=...", url!=null);
        return new URL(url);
    }
}

Allow the duration to be overridden.


package seedu.jobs.logic;

import java.io.IOException;
import java.util.logging.Logger;

import javafx.collections.ObservableList;
import seedu.jobs.commons.core.ComponentManager;
import seedu.jobs.commons.core.LogsCenter;
import seedu.jobs.logic.calendar.CalendarManager;
import seedu.jobs.logic.commands.Command;
import seedu.jobs.logic.commands.CommandResult;
import seedu.jobs.logic.commands.exceptions.CommandException;
import seedu.jobs.logic.parser.Parser;
import seedu.jobs.model.Model;
import seedu.jobs.model.task.ReadOnlyTask;
import seedu.jobs.storage.Storage;

/**
 * The main LogicManager of the app.
 */
public class LogicManager extends ComponentManager implements Logic {
    private final Logger logger = LogsCenter.getLogger(LogicManager.class);

    private final Model model;
    private final Parser parser;
    private final CalendarManager calendar;

    public LogicManager(Model model, Storage storage, CalendarManager calendar) {
        this.model = model;
        this.parser = new Parser();
        this.calendar = calendar;
    }

    @Override
    public CommandResult execute(String commandText) throws CommandException, IOException {
        logger.info("----------------[USER COMMAND][" + commandText + "]");
        Command command = parser.parseCommand(commandText);
        command.setData(model);
        command.setCalendar(calendar);
        return command.execute();
    }

    @Override
    public ObservableList<ReadOnlyTask> getFilteredTaskList() {
        return model.getFilteredTaskList();
    }
}

package seedu.jobs.logic;

import java.io.IOException;
import java.util.logging.Logger;

import javafx.collections.ObservableList;
import seedu.jobs.commons.core.ComponentManager;
import seedu.jobs.commons.core.LogsCenter;
import seedu.jobs.logic.calendar.CalendarManager;
import seedu.jobs.logic.commands.Command;
import seedu.jobs.logic.commands.CommandResult;
import seedu.jobs.logic.commands.exceptions.CommandException;
import seedu.jobs.logic.parser.Parser;
import seedu.jobs.model.Model;
import seedu.jobs.model.task.ReadOnlyTask;
import seedu.jobs.storage.Storage;
import seedu.jobs.storage.StorageManager;

/**
 * The main LogicManager of the app.
 */
public class LogicManager extends ComponentManager implements Logic {
    private final Logger logger = LogsCenter.getLogger(LogicManager.class);

    private final Model model;
    private final Parser parser;
    private final CalendarManager calendar;

    public LogicManager(Model model, Storage storage, CalendarManager calendar) {
        this.model = model;
        this.parser = new Parser();
        this.calendar = calendar;
    }

    public LogicManager(Model model, StorageManager storageManager) {
        this.model = model;
        this.parser = new Parser();
    }

    @Override
    public CommandResult execute(String commandText) throws CommandException, IOException {
        logger.info("----------------[USER COMMAND][" + commandText + "]");
        Command command = parser.parseCommand(commandText);
        command.setData(model);
        command.setCalendar(calendar);
        return command.execute();
    }

    @Override
    public ObservableList<ReadOnlyTask> getFilteredTaskList() {
        return model.getFilteredTaskList();
    }
}

Add new constructor for logic manager


/**
 *
 */
package tars.logic.commands;

/**
 * @author Johnervan
 * Changes the directory of the Tars storage file, tars.xml
 */
public class CdCommand extends Command {

    public static final String COMMAND_WORD = "cd";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Changes the directory of the "
            + "TARS storage file, tars.xml";

    public static final String MESSAGE_SUCCESS = "Directory of tars.xml changed to: ";

    private final String filepath;

    public CdCommand(String filepath) {
        this.filepath = filepath;
    }

    @Override
    public CommandResult execute() {
        // TODO Auto-generated method stub
        return null;
    }

}

/**
 *
 */
package tars.logic.commands;

/**
 * @author Johnervan
 * Changes the directory of the Tars storage file, tars.xml
 */
public class CdCommand extends Command {

    public static final String COMMAND_WORD = "cd";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Changes the directory of the "
            + "TARS storage file, tars.xml";

    public final String MESSAGE_SUCCESS = "Directory of tars.xml changed to: " + this.toString();

    private final String filePath;

    public CdCommand(String filepath) {
        this.filePath = filepath;
    }

    @Override
    public String toString() {
        return this.filePath;
    }

    @Override
    public CommandResult execute() {
        // TODO Auto-generated method stub
        return new CommandResult(MESSAGE_SUCCESS);
    }

}

Change MESSAGE_SUCCESS string to be non-static


public class Program {
    public static void main(String[] args) {
        LinkedList head = new LinkedList(new int[] {1, 2, 3, 4}, LinkedList.Type.Singly);
        head = reverseSingly(head);
        head.assertEquals(new int[] {4, 3, 2, 1}, LinkedList.Type.Singly);

        head = new LinkedList(new int[] {1, 2, 3, 4}, LinkedList.Type.Doubly);
        head = reverseDoubly(head);
        head.assertEquals(new int[] {4, 3, 2, 1}, LinkedList.Type.Doubly);

        System.out.println("Tests passed");
    }

    public static LinkedList reverseSingly(LinkedList head) {
        if (head != null) {
            LinkedList prev = null;
            while (head.next != null) {
                LinkedList next = head.next;
                head.next = prev;
                prev = head;
                head = next;
            }
            head.next = prev;
        }
        return head;
    }

    public static LinkedList reverseDoubly(LinkedList head) {
        while (head != null) {
            LinkedList temp = head.next;
            head.next = head.prev;
            head.prev = temp;
            if (temp == null)
                return head;
            head = temp;
        }
        return head;
    }
}

public class Program {
    public static void main(String[] args) {
        LinkedList head = new LinkedList(new int[] {1, 2, 3, 4}, LinkedList.Type.Singly);
        head = reverseSingly(head);
        head.assertEquals(new int[] {4, 3, 2, 1}, LinkedList.Type.Singly);

        head = new LinkedList(new int[] {1, 2, 3, 4}, LinkedList.Type.Doubly);
        head = reverseDoubly(head);
        head.assertEquals(new int[] {4, 3, 2, 1}, LinkedList.Type.Doubly);

        System.out.println("Tests passed");
    }

    public static LinkedList reverseSingly(LinkedList head) {
        if (head != null) {
            LinkedList prev = null;
            while (head.next != null) {
                LinkedList next = head.next;
                head.next = prev;
                prev = head;
                head = next;
            }
            head.next = prev;
        }
        return head;
    }

    public static LinkedList reverseDoubly(LinkedList head) {
        while (head != null) {
            LinkedList temp = head.next;
            head.next = head.prev;
            head.prev = temp;
            if (temp == null)
                break;
            head = temp;
        }
        return head;
    }
}

Update reverse a linked list code


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

package dagger.android.support.functional;

import android.content.Intent;
import dagger.android.DaggerIntentService;
import java.util.Set;
import javax.inject.Inject;

public final class TestIntentService extends DaggerIntentService {
  @Inject Set<Class<?>> componentHierarchy;

  public TestIntentService(String name) {
    super(name);
  }

  @Override
  protected void onHandleIntent(Intent intent) {}
}

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

package dagger.android.support.functional;

import android.content.Intent;
import dagger.android.DaggerIntentService;
import java.util.Set;
import javax.inject.Inject;

public final class TestIntentService extends DaggerIntentService {
  @Inject Set<Class<?>> componentHierarchy;

  public TestIntentService() {
    super("TestIntentService");
  }

  @Override
  protected void onHandleIntent(Intent intent) {}
}

Use a zero-arg constructor for our test IntentService


package com.dglogik.mobile;

import android.app.ActivityManager;
import android.app.Service;
import android.app.*;
import android.graphics.*;
import android.graphics.drawable.*;
import android.content.Context;
import android.support.annotation.NonNull;

public class Utils {
    public static boolean isServiceRunning(@NonNull Context context, @NonNull Class<? extends Service> clazz) {
        ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

        for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
            if (service.service.getClassName().equals(clazz.getName())) {
                return true;
            }
        }

        return false;
    }

    @NonNull
    public static Thread startThread(Runnable action) {
        Thread thread = new Thread(action);
        thread.start();
        return thread;
    }

    public static void applyDGTheme(Activity activity) {
        ActionBar bar = activity.getActionBar();
        bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4dd0e1")));
    }
}

package com.dglogik.mobile;

import android.app.ActivityManager;
import android.app.Service;
import android.app.*;
import android.graphics.*;
import android.graphics.drawable.*;
import android.content.Context;
import android.support.annotation.NonNull;

public class Utils {
    public static boolean isServiceRunning(@NonNull Context context, @NonNull Class<? extends Service> clazz) {
        ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

        for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
            if (service.service.getClassName().equals(clazz.getName())) {
                return true;
            }
        }

        return false;
    }

    @NonNull
    public static Thread startThread(Runnable action) {
        Thread thread = new Thread(action);
        thread.start();
        return thread;
    }

    public static void applyDGTheme(Activity activity) {
        ActionBar bar = activity.getActionBar();
        if (bar != null) {
            bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4dd0e1")));
        }

    }
}

Handle ActionBar possibly not existing.


package com.github.jsonldjava.utils;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

import org.apache.http.client.cache.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class JarCacheResource implements Resource {

    private static final long serialVersionUID = -7101296464577357444L;

    private final Logger log = LoggerFactory.getLogger(getClass());

    private final URLConnection connection;

    public JarCacheResource(URL classpath) throws IOException {
        this.connection = classpath.openConnection();
    }

    @Override
    public long length() {
        // TODO should be getContentLengthLong() but this is not available in
        // Java 6.
        return connection.getContentLength();
    }

    @Override
    public InputStream getInputStream() throws IOException {
        return connection.getInputStream();
    }

    @Override
    public void dispose() {
        try {
            connection.getInputStream().close();
        } catch (final IOException e) {
            log.error("Can't close JarCacheResource input stream", e);
        }
    }
}

package com.github.jsonldjava.utils;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

import org.apache.http.client.cache.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class JarCacheResource implements Resource {

    private static final long serialVersionUID = -7101296464577357444L;

    private final Logger log = LoggerFactory.getLogger(getClass());

    private final URLConnection connection;

    public JarCacheResource(URL classpath) throws IOException {
        this.connection = classpath.openConnection();
    }

    @Override
    public long length() {
        return connection.getContentLengthLong();
    }

    @Override
    public InputStream getInputStream() throws IOException {
        return connection.getInputStream();
    }

    @Override
    public void dispose() {
        try {
            connection.getInputStream().close();
        } catch (final IOException e) {
            log.error("Can't close JarCacheResource input stream", e);
        }
    }
}

Use URLConnection.getContentLengthLong now that we don't support Java-6


package com.nincraft.modpackdownloader.container;

import org.json.simple.JSONObject;

public class ThirdPartyMod extends ModContainer {

	public ThirdPartyMod() {
	}

	public ThirdPartyMod(final JSONObject modJson) {
		super(modJson);
		setDownloadUrl((String) modJson.get("url"));
		setFileName(buildFileName());
	}

	private String buildFileName() {
		if (getDownloadUrl().endsWith(".jar")) {
			return getDownloadUrl().substring(getDownloadUrl().lastIndexOf("/") + 1,
					getDownloadUrl().lastIndexOf(".jar") + 4);
		}
		return getRename();
	}

	@Override
	public ThirdPartyMod clone() throws CloneNotSupportedException {
		return (ThirdPartyMod) super.clone();
	}
}

package com.nincraft.modpackdownloader.container;

import org.json.simple.JSONObject;

public class ThirdPartyMod extends ModContainer {

	public ThirdPartyMod() {
	}

	public ThirdPartyMod(final JSONObject modJson) {
		super(modJson);
		setDownloadUrl((String) modJson.get("url"));
		setFileName(buildFileName());
	}

	private String buildFileName() {
		if (getDownloadUrl().contains(".jar")) {
			return getDownloadUrl().substring(getDownloadUrl().lastIndexOf("/") + 1,
					getDownloadUrl().lastIndexOf(".jar") + 4);
		}
		return getRename();
	}

	@Override
	public ThirdPartyMod clone() throws CloneNotSupportedException {
		return (ThirdPartyMod) super.clone();
	}
}

Switch third party file name builder


package login;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class PasswordHelper
{
	public static String generatePasswordHash(String password)
	{
		//Create instances of digest and password char array
		MessageDigest passDigest;
		byte[] passArray;

		try
		{
			//Create instance of MessageDigest we can use to
			passDigest = MessageDigest.getInstance("MD5");

			//Convert password to byte array
			passArray = password.getBytes("UTF-8");
		}
		catch (NoSuchAlgorithmException e)
		{
			//Hardcoded algorithm type, this exception shouldn't be called
			e.printStackTrace();
			return "";
		}
		catch (UnsupportedEncodingException e)
		{
			//Hardcoded encoding type, this exception shouldn't be called
			e.printStackTrace();
			return "";
		}

		//Use digest to get an array of chars as a hash and return it as a string
		byte[] hashArray = passDigest.digest(passArray);
		return new String(hashArray);
	}

}

package login;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class PasswordHelper
{
	private static String hashAlgorithm = "MD5";
	private static String stringEncodingFormat = "UTF-8";

	public static String generatePasswordHash(String password)
	{
		//Create instances of digest and password char array
		MessageDigest passDigest;
		byte[] passArray;

		try
		{
			//Create instance of MessageDigest we can use to
			passDigest = MessageDigest.getInstance(hashAlgorithm);

			//Convert password to byte array
			passArray = password.getBytes(stringEncodingFormat);
		}
		catch (NoSuchAlgorithmException e)
		{
			e.printStackTrace();
			return "";
		}
		catch (UnsupportedEncodingException e)
		{
			e.printStackTrace();
			return "";
		}

		//Use digest to get an array of chars as a hash and return it as a string
		byte[] hashArray = passDigest.digest(passArray);
		return new String(hashArray);
	}

}

Move algorithm types to static strings on top


package fr.masciulli.drinks.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.MenuItem;

import fr.masciulli.drinks.R;
import fr.masciulli.drinks.fragment.DrinkDetailFragment;

public class DrinkDetailActivity extends FragmentActivity {

    private DrinkDetailFragment mDetailFragment;

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

        if (savedInstanceState == null) {
            mDetailFragment = new DrinkDetailFragment();
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.drink_detail_container, new DrinkDetailFragment())
                    .commit();
        }

        getActionBar().setDisplayHomeAsUpEnabled(true);
    }

    @Override
    public void finish() {
        super.finish();

        // override transitions to skip the standard window animations
        overridePendingTransition(0, 0);
    }

    @Override
    public void onBackPressed() {
        mDetailFragment.onBackPressed();
    }
}

package fr.masciulli.drinks.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.MenuItem;

import fr.masciulli.drinks.R;
import fr.masciulli.drinks.fragment.DrinkDetailFragment;

public class DrinkDetailActivity extends FragmentActivity {

    private DrinkDetailFragment mDetailFragment;

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

        if (savedInstanceState == null) {
            mDetailFragment = new DrinkDetailFragment();
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.drink_detail_container, mDetailFragment)
                    .commit();
        }

        getActionBar().setDisplayHomeAsUpEnabled(true);
    }

    @Override
    public void finish() {
        super.finish();

        // override transitions to skip the standard window animations
        overridePendingTransition(0, 0);
    }

    @Override
    public void onBackPressed() {
        mDetailFragment.onBackPressed();
    }
}

Fix bug at fragment creation


package fr.masciulli.drinks.fragment;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import fr.masciulli.drinks.R;

public class AboutDialogFragment extends DialogFragment {

    @InjectView(R.id.version_name)
    TextView mVersionNameView;

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        LayoutInflater inflater = getActivity().getLayoutInflater();

        View root = inflater.inflate(R.layout.dialog_about, null);
        ButterKnife.inject(this, root);

        try {
            PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
            mVersionNameView.setText(pInfo.versionName);
        } catch (PackageManager.NameNotFoundException e) {
            mVersionNameView.setText(getString(R.string.unknown_version));
        }

        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setView(root);

        return builder.create();
    }

    @OnClick(R.id.ok)
    void dismissDialog() {
        dismiss();
    }
}

package fr.masciulli.drinks.fragment;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import fr.masciulli.drinks.BuildConfig;
import fr.masciulli.drinks.R;

public class AboutDialogFragment extends DialogFragment {

    @InjectView(R.id.version_name)
    TextView mVersionNameView;

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        LayoutInflater inflater = getActivity().getLayoutInflater();

        View root = inflater.inflate(R.layout.dialog_about, null);
        ButterKnife.inject(this, root);

        try {
            PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
            String versionNameText = pInfo.versionName;
            if (BuildConfig.DEBUG)
            {
                versionNameText += ".dev";
            }
            mVersionNameView.setText(versionNameText);
        } catch (PackageManager.NameNotFoundException e) {
            mVersionNameView.setText(getString(R.string.unknown_version));
        }

        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setView(root);

        return builder.create();
    }

    @OnClick(R.id.ok)
    void dismissDialog() {
        dismiss();
    }
}

Add .dev to version name in about dialog


/**
 * Copyright (c) 2014-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

package com.facebook.react.fabric;

public interface FabricBinder<T extends FabricBinding> {

  void setBinding(T binding);

}

/**
 * Copyright (c) 2014-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

package com.facebook.react.fabric;

public interface FabricBinder {

  void setBinding(FabricBinding binding);

}

Revert D8794819: [fabric][android] Initialize FabricXX C++ code and register rootview


package fr.greweb.reactnativeviewshot;

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

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.bridge.JavaScriptModule;
public class RNViewShotPackage implements ReactPackage {
    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
      return Arrays.<NativeModule>asList(new RNViewShotModule(reactContext));
    }

    @Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
      return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
      return Collections.emptyList();
    }
}

package fr.greweb.reactnativeviewshot;

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

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.bridge.JavaScriptModule;
public class RNViewShotPackage implements ReactPackage {
    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
      return Arrays.<NativeModule>asList(new RNViewShotModule(reactContext));
    }

    // Deprecated RN 0.47
    // @Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
      return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
      return Collections.emptyList();
    }
}

Remove override of 'createJSModules' for RN 0.47


package org.code2bytes.samples.lambda;

import static org.junit.Assert.assertEquals;

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

import org.junit.Before;
import org.junit.Test;

public class PersonListTest {

	private List<Person> persons;

	@Before
	public void setUp() throws Exception {
		persons = new ArrayList<>();
		persons.add(new Person("Test Person 1", 20));
		persons.add(new Person("Test Person 2", 21));
		persons.add(new Person("Test Person 3", 22));
		persons.add(new Person("Test Person 4", 23));
	}

	@Test
	public void testArraySize() {
		assertEquals("Array should contain 4 elements", 4, persons.size());
	}

	@Test
	public void testForEach() {
		persons.forEach(p -> System.out.println(p.getAgeInYears()));
	}
}

package org.code2bytes.samples.lambda;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

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

import org.junit.Before;
import org.junit.Test;

public class PersonListTest {

	private List<Person> persons;

	@Before
	public void setUp() throws Exception {
		persons = new ArrayList<>();
		persons.add(new Person("Test Person 1", 20));
		persons.add(new Person("Test Person 2", 21));
		persons.add(new Person("Test Person 3", 22));
		persons.add(new Person("Test Person 4", 23));
	}

	@Test
	public void testArraySize() {
		assertThat("array contains 4 elements", 4, equalTo(4));
	}

	@Test
	public void testSum() {
		Integer total = persons.parallelStream().map(p -> p.getAgeInYears())
				.reduce((sum, p) -> sum + p).get();
		assertThat("sum should be 86", 86, equalTo(total));
	}
}

Add test for calculating sum of ages


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

import io.atomix.catalyst.serializer.SerializeWith;
import io.atomix.catalyst.util.ReferenceManager;

/**
 * No-op entry.
 *
 * @author Jordan Halterman
 */
@SerializeWith(id=223)
public class NoOpEntry extends TimestampedEntry<NoOpEntry> {

  public NoOpEntry() {
  }

  public NoOpEntry(ReferenceManager<Entry<?>> referenceManager) {
    super(referenceManager);
  }

  @Override
  public String toString() {
    return String.format("%s[index=%d, term=%d, timestamp=%s]", getClass().getSimpleName(), getIndex(), getTerm(), getTimestamp());
  }

}

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

import io.atomix.catalyst.serializer.SerializeWith;
import io.atomix.catalyst.util.ReferenceManager;

/**
 * No-op entry.
 *
 * @author Jordan Halterman
 */
@SerializeWith(id=223)
public class NoOpEntry extends TimestampedEntry<NoOpEntry> {

  public NoOpEntry() {
  }

  public NoOpEntry(ReferenceManager<Entry<?>> referenceManager) {
    super(referenceManager);
  }

  @Override
  public boolean isTombstone() {
    return true;
  }

  @Override
  public String toString() {
    return String.format("%s[index=%d, term=%d, timestamp=%s]", getClass().getSimpleName(), getIndex(), getTerm(), getTimestamp());
  }

}

Set no-op entries as tombstones.


package net.qldarch.service.rdf;

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

import java.util.regex.Pattern;

public class Validators {
    public static Logger logger = LoggerFactory.getLogger(Validators.class);

    public static final Pattern USERNAME_REGEX = Pattern.compile("[a-zA-Z0-9_]{3,}");

    public static String username(String username) {
        if (username == null) {
            return "";
        } else if (USERNAME_REGEX.matcher(username).matches()) {
            return username;
        } else {
            logger.warn("Invalid username provided: {}", username);
            throw new IllegalArgumentException("Invalid username");
        }
    }
}

package net.qldarch.service.rdf;

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

import java.util.regex.Pattern;

public class Validators {
    public static Logger logger = LoggerFactory.getLogger(Validators.class);

    public static final Pattern USERNAME_REGEX = Pattern.compile("[a-zA-Z0-9_.-]{3,}");

    public static String username(String username) {
        if (username == null) {
            return "";
        } else if (USERNAME_REGEX.matcher(username).matches()) {
            return username;
        } else {
            logger.warn("Invalid username provided: {}", username);
            throw new IllegalArgumentException("Invalid username");
        }
    }
}

Fix username validation to allow periods and hyphens


package tdl.examples;

import tdl.client.Client;

/**
 * Created by julianghionoiu on 11/06/2015.
 */
public class AddNumbers {

    public static void main(String[] args) throws Exception {
        Client client = new Client("localhost", 21616, "test");

        client.goLiveWith(params -> {
            Integer x = Integer.parseInt(params[0]);
            Integer y = Integer.parseInt(params[1]);
            return x + y;
        });
    }
}

package tdl.examples;

import tdl.client.Client;
import tdl.client.abstractions.UserImplementation;

/**
 * Created by julianghionoiu on 11/06/2015.
 */
public class AddNumbers {

    public static void main(String[] args) throws Exception {
        Client client = new Client("localhost", 21616, "test");

        client.goLiveWith(new UserImplementation() {
            @Override
            public Object process(String... params) {
                Integer x = Integer.parseInt(params[0]);
                Integer y = Integer.parseInt(params[1]);
                return x + y;
            }
        });
    }
}

Replace lambda in example with anonymous class to fix cobertura


package org.jenkinsci.plugins.dockerbuildstep.cmd;

import hudson.DescriptorExtensionList;
import hudson.ExtensionPoint;
import hudson.model.Describable;
import hudson.model.AbstractBuild;
import hudson.model.Descriptor;
import jenkins.model.Jenkins;

import org.jenkinsci.plugins.dockerbuildstep.DockerBuilder;
import org.jenkinsci.plugins.dockerbuildstep.log.ConsoleLogger;

import com.kpelykh.docker.client.DockerClient;
import com.kpelykh.docker.client.DockerException;

/**
 * Parent class of all Docker commands.
 *
 * @author vjuranek
 *
 */
public abstract class DockerCommand implements Describable<DockerCommand>, ExtensionPoint {

    public abstract void execute(@SuppressWarnings("rawtypes") AbstractBuild build, ConsoleLogger console)
            throws DockerException;

    protected static DockerClient getClient() {
        return ((DockerBuilder.DescriptorImpl) Jenkins.getInstance().getDescriptor(DockerBuilder.class))
                .getDockerClient();
    }

    public DockerCommandDescriptor getDescriptor() {
        return (DockerCommandDescriptor) Jenkins.getInstance().getDescriptor(getClass());
    }

    public static DescriptorExtensionList<DockerCommand, DockerCommandDescriptor> all() {
        return Jenkins.getInstance().<DockerCommand, DockerCommandDescriptor> getDescriptorList(DockerCommand.class);
    }

    public abstract static class DockerCommandDescriptor extends Descriptor<DockerCommand> {
        protected DockerCommandDescriptor(Class<? extends DockerCommand> clazz) {
            super(clazz);
        }

        protected DockerCommandDescriptor() {
        }
    }
}

package org.jenkinsci.plugins.dockerbuildstep.cmd;

import hudson.AbortException;
import hudson.DescriptorExtensionList;
import hudson.ExtensionPoint;
import hudson.model.Describable;
import hudson.model.AbstractBuild;
import hudson.model.Descriptor;
import jenkins.model.Jenkins;

import org.jenkinsci.plugins.dockerbuildstep.DockerBuilder;
import org.jenkinsci.plugins.dockerbuildstep.log.ConsoleLogger;

import com.kpelykh.docker.client.DockerClient;
import com.kpelykh.docker.client.DockerException;

/**
 * Parent class of all Docker commands.
 *
 * @author vjuranek
 *
 */
public abstract class DockerCommand implements Describable<DockerCommand>, ExtensionPoint {

    public abstract void execute(@SuppressWarnings("rawtypes") AbstractBuild build, ConsoleLogger console)
            throws DockerException, AbortException;

    protected static DockerClient getClient() {
        return ((DockerBuilder.DescriptorImpl) Jenkins.getInstance().getDescriptor(DockerBuilder.class))
                .getDockerClient();
    }

    public DockerCommandDescriptor getDescriptor() {
        return (DockerCommandDescriptor) Jenkins.getInstance().getDescriptor(getClass());
    }

    public static DescriptorExtensionList<DockerCommand, DockerCommandDescriptor> all() {
        return Jenkins.getInstance().<DockerCommand, DockerCommandDescriptor> getDescriptorList(DockerCommand.class);
    }

    public abstract static class DockerCommandDescriptor extends Descriptor<DockerCommand> {
        protected DockerCommandDescriptor(Class<? extends DockerCommand> clazz) {
            super(clazz);
        }

        protected DockerCommandDescriptor() {
        }
    }
}

Allow commands to throw AbortException to fail the build


package de.innoaccel.wamp.server.converter;

import de.innoaccel.wamp.server.Websocket;
import de.innoaccel.wamp.server.message.Message;
import org.junit.Test;

import java.io.IOException;

abstract public class GeneralMessageTests<T extends Message>
{
    protected JsonParsingConverter<T> converter;

    @Test(expected = MessageParseException.class)
    public void deserializeThrowsMessageParseExceptionWhenMessageIsNoArray(final Websocket socket)
        throws IOException, MessageParseException, InvalidMessageCodeException
    {
        this.converter.deserialize("message", socket);
    }

    @Test(expected = MessageParseException.class)
    public void deserializeThrowsMessageParseExceptionWhenThereIsNoFirstField(final Websocket socket)
        throws IOException, MessageParseException, InvalidMessageCodeException
    {
        this.converter.deserialize("[]", socket);
    }

    @Test(expected = MessageParseException.class)
    public void deserializeThrowsMessageParseExceptionWhenFirstFieldIsNoNumber(final Websocket socket)
        throws IOException, MessageParseException, InvalidMessageCodeException
    {
        this.converter.deserialize("[null]", socket);
    }

    @Test(expected = MessageParseException.class)
    public void deserializeThrowsMessageParseExceptionWhenFirstFieldIsNoInteger(final Websocket socket)
        throws IOException, MessageParseException, InvalidMessageCodeException
    {
        this.converter.deserialize("[0.5f]", socket);
    }

    @Test(expected = InvalidMessageCodeException.class)
    public void deserializeThrowsInvalidMessageCodeExceptionWhenWrongMessageCode(final Websocket socket)
        throws IOException, MessageParseException, InvalidMessageCodeException
    {
        this.converter.deserialize("[" + Message.INVALID + "]", socket);
    }
}

package de.innoaccel.wamp.server.converter;

import de.innoaccel.wamp.server.Websocket;
import de.innoaccel.wamp.server.message.Message;
import org.junit.Test;

import java.io.IOException;

abstract public class GeneralMessageTests<T extends Message>
{
    protected JsonParsingConverter<T> converter;

    @Test(expected = MessageParseException.class)
    public void deserializeThrowsMessageParseExceptionWhenMessageIsNoArray(final Websocket socket)
        throws IOException, MessageParseException, InvalidMessageCodeException
    {
        this.converter.deserialize("message", socket);
    }

    @Test(expected = MessageParseException.class)
    public void deserializeThrowsMessageParseExceptionWhenThereIsNoMessageCodeField(final Websocket socket)
        throws IOException, MessageParseException, InvalidMessageCodeException
    {
        this.converter.deserialize("[]", socket);
    }

    @Test(expected = MessageParseException.class)
    public void deserializeThrowsMessageParseExceptionWhenMessageCodeIsNoNumber(final Websocket socket)
        throws IOException, MessageParseException, InvalidMessageCodeException
    {
        this.converter.deserialize("[null]", socket);
    }

    @Test(expected = MessageParseException.class)
    public void deserializeThrowsMessageParseExceptionWhenMessageCodeIsNoInteger(final Websocket socket)
        throws IOException, MessageParseException, InvalidMessageCodeException
    {
        this.converter.deserialize("[0.5f]", socket);
    }

    @Test(expected = InvalidMessageCodeException.class)
    public void deserializeThrowsInvalidMessageCodeExceptionWhenWrongMessageCode(final Websocket socket)
        throws IOException, MessageParseException, InvalidMessageCodeException
    {
        this.converter.deserialize("[" + Message.INVALID + "]", socket);
    }
}

Rename tests to better reflect field meaning


package me.eddiep.minecraft.ubotpatcher;

import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.nio.file.CopyOption;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;

public class UbotPatcher extends JavaPlugin {

    @Override
    public void onEnable() {
        getLogger().info("Searching for jar files...");

        File[] jars = getDataFolder().listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.getName().endsWith("jar");
            }
        });

        if (jars == null) {
            getLogger().info("No jar files found!");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        getLogger().info(jars.length + " jar files found!");

        for (File f : jars) {
            getLogger().info("Moving " + f.getName() + "...");
            File target = new File(getDataFolder().getParentFile(), f.getName());

            try {
                Files.move(f.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        getLogger().info("Patching complete!");
        getServer().getPluginManager().disablePlugin(this);
    }
}

package me.eddiep.minecraft.ubotpatcher;

import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;

public class UbotPatcher extends JavaPlugin {
    @Override
    public void onEnable() {
        getLogger().info("Searching for jar files...");

        File[] jars = getDataFolder().listFiles(pathname -> pathname.getName().endsWith("jar"));

        if (jars == null) {
            getLogger().info("No jar files found!");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        getLogger().info(jars.length + " jar files found!");

        for (File f : jars) {
            getLogger().info("Moving " + f.getName() + "...");
            File target = new File(getDataFolder().getParentFile(), f.getName());
            try {
                Files.move(f.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        getLogger().info("Patching complete!");
        getServer().getPluginManager().disablePlugin(this);
    }
}

Update do using lambda expression


/**
 * @file IncomeCalculator.java
 * @author Valery Samovich
 * @version 1.0.0
 * @date 12/16/2014
 *
 * Using the Easymock and JUnit
 */

package com.valerysamovich.java.advanced.easymock;

public class IncomeCalculator {

    // Private fields
    private ICalculatorMethod calculatorMethod;
    private Position position;

    // Setter for I CalculatorMethod
    public void setCalculatorMethod(ICalculatorMethod calculatorMethod) {
        this.calculatorMethod = calculatorMethod;
    }
}

/**
 * @file IncomeCalculator.java
 * @author Valery Samovich
 * @version 1.0.0
 * @date 12/16/2014
 *
 * Using the Easymock and JUnit
 */

package com.valerysamovich.java.advanced.easymock;

public class IncomeCalculator {

    // Private fields
    private ICalculatorMethod calculatorMethod;
    private Position position;

    // Setter for private ICalculatorMethod field (object).
    public void setCalculatorMethod(ICalculatorMethod calculatorMethod) {
        this.calculatorMethod = calculatorMethod;
    }

    // Setter for private Position filed (object).
    public void setPosition(Position position) {
        this.position = position;
    }
    /*
     * Calculate method.
     */
    public double calculate() {

        if(calculatorMethod == null) {
            throw new RuntimeException("CalculatorMethod not yet maintained.");
        }

        if(position == null) {
            throw new RuntimeException("Position not yet maintained.");
        }

        return calculatorMethod.calculator(position);

    }
}

Add setters for private fields and calculate method.


package controllers;

import models.Panic;
import play.mvc.Controller;
import play.mvc.results.RenderJson;

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

public class Application extends Controller {

    public static List<Panic> panics = new ArrayList<>();

    public static void index() {
        render();
    }

    public static void getData() {
        throw new RenderJson(panics.size());
    }

    public static void submit() {
        String sessionHash = Panic.getPanicHash(session);
        long sessionTime = Panic.getPanicTime();

        for (Panic panic : panics) {
            if (panic.getId().equals(sessionHash)) {
                panic.setTime(sessionTime);
                index();
                return;
            }
        }

        panics.add(new Panic(sessionHash, sessionTime));
        index();
    }
}

package controllers;

import models.Panic;
import play.mvc.Controller;
import play.mvc.results.RenderJson;

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

public class Application extends Controller {

    public static List<Panic> panics = new ArrayList<Panic>();

    public static void index() {
        render();
    }

    public static void getData() {
        throw new RenderJson(panics.size());
    }

    public static void submit() {
        String sessionHash = Panic.getPanicHash(session);
        long sessionTime = Panic.getPanicTime();

        for (Panic panic : panics) {
            if (panic.getId().equals(sessionHash)) {
                panic.setTime(sessionTime);
                index();
                return;
            }
        }

        panics.add(new Panic(sessionHash, sessionTime));
        index();
    }
}

Add java 6 compatible generic declaration


package org.gbif.nameparser.utils;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Modified Executors DefaultThreadFactory to allow custom named thread pools.
 * Otherwise, this factory yields the same semantics as the thread factory returned by
 * {@link Executors#defaultThreadFactory()}.
 *
 * Optionally a priority or daemon flag can be provided.
 */
public class NamedThreadFactory implements ThreadFactory {
  private final ThreadGroup group;
  private final AtomicInteger threadNumber = new AtomicInteger(1);
  private final String namePrefix;
  private final int priority;
  private final boolean daemon;

  /**
   * Creates a new named user thread factory using a normal priority.
   * @param poolName the name prefix of the thread pool which will be appended -number for the individual thread
   */
  public NamedThreadFactory(String poolName) {
    this(poolName, Thread.NORM_PRIORITY, false);
  }

  /**
   * Creates a new named thread factory using explicit priority and daemon settings.
   */
  public NamedThreadFactory(String poolName, int priority, boolean daemon) {
    SecurityManager s = System.getSecurityManager();
    group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
    namePrefix = poolName + "-";
    this.priority = priority;
    this.daemon = daemon;
  }

  public Thread newThread(Runnable r) {
    Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
    t.setPriority(priority);
    t.setDaemon(daemon);
    return t;
  }
}

package org.gbif.nameparser.utils;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Modified Executors DefaultThreadFactory to allow custom named thread pools.
 * Otherwise, this factory yields the same semantics as the thread factory returned by
 * {@link Executors#defaultThreadFactory()}.
 *
 * Optionally a priority or daemon flag can be provided.
 */
public class NamedThreadFactory implements ThreadFactory {
  private final ThreadGroup group;
  private final AtomicInteger threadNumber = new AtomicInteger(1);
  private final String namePrefix;
  private final int priority;
  private final boolean daemon;

  /**
   * Creates a new named user thread factory using a normal priority.
   * @param poolName the name prefix of the thread pool which will be appended -number for the individual thread
   */
  public NamedThreadFactory(String poolName) {
    this(poolName, Thread.NORM_PRIORITY, false);
  }

  /**
   * Creates a new named thread factory using explicit priority and daemon settings.
   */
  public NamedThreadFactory(String poolName, int priority, boolean daemon) {
    SecurityManager s = System.getSecurityManager();
    group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
    namePrefix = poolName + "-";
    this.priority = priority;
    this.daemon = daemon;
  }

  @Override
  public Thread newThread(Runnable r) {
    Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
    t.setPriority(priority);
    t.setDaemon(daemon);
    return t;
  }
}

Fix a few more lint issues


package com.nincraft.ninbot.components.ac;

import lombok.Getter;

import java.util.Random;

@Getter
public enum TurnipPattern {
    DECREASING, BIG_SPIKE(3, 100, 400, 1.5), SMALL_SPIKE(4, 65, 175, 5), RANDOM(150, 50);

    private int spikeUpperBound;
    private int spikeBase;
    private int spikeCount;
    private int upperBound = 100;
    private int base = 50;
    private double divisor;

    TurnipPattern() {
    }

    TurnipPattern(int upperBound, int base) {
        this.upperBound = upperBound;
        this.base = base;
    }

    TurnipPattern(int spikeCount, int spikeBase, int spikeUpperBound, double divisor) {
        this.spikeCount = spikeCount;
        this.spikeBase = spikeBase;
        this.spikeUpperBound = spikeUpperBound;
        this.divisor = divisor;
    }

    public static TurnipPattern getRandomTurnipPattern(long seed) {
        Random random = new Random(seed);
        return values()[random.nextInt(values().length)];
    }
}

package com.nincraft.ninbot.components.ac;

import lombok.Getter;

import java.util.Random;

@Getter
public enum TurnipPattern {
    DECREASING, BIG_SPIKE(3, 100, 400, 1.5), SMALL_SPIKE(4, 65, 175, 5), RANDOM(150, 50);

    private int spikeUpperBound;
    private int spikeBase;
    private int spikeCount;
    private int upperBound = 49;
    private int base = 50;
    private double divisor;

    TurnipPattern() {
    }

    TurnipPattern(int upperBound, int base) {
        this.upperBound = upperBound;
        this.base = base;
    }

    TurnipPattern(int spikeCount, int spikeBase, int spikeUpperBound, double divisor) {
        this.spikeCount = spikeCount;
        this.spikeBase = spikeBase;
        this.spikeUpperBound = spikeUpperBound;
        this.divisor = divisor;
    }

    public static TurnipPattern getRandomTurnipPattern(long seed) {
        Random random = new Random(seed);
        return values()[random.nextInt(values().length)];
    }
}

Change decreasing price start range


/**
 * Copyright © 2013 tuxed <write@imaginarycode.com>
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
 */
package com.imaginarycode.minecraft.redisbungee.util;

import com.google.common.io.ByteStreams;
import com.google.gson.reflect.TypeToken;
import com.imaginarycode.minecraft.redisbungee.RedisBungee;

import java.io.IOException;
import java.lang.reflect.Type;
import java.net.URL;
import java.net.URLConnection;
import java.util.*;

public class NameFetcher {
    public static List<String> nameHistoryFromUuid(UUID uuid) throws IOException {
        URLConnection connection = new URL("https://api.mojang.com/user/profiles/" + uuid.toString().replace("-", "").toLowerCase() + "/names").openConnection();
        String text = new String(ByteStreams.toByteArray(connection.getInputStream()));
        Type listType = new TypeToken<List<String>>() {}.getType();
        return RedisBungee.getGson().fromJson(text, listType);
    }
}

/**
 * Copyright © 2013 tuxed <write@imaginarycode.com>
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
 */
package com.imaginarycode.minecraft.redisbungee.util;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.UUID;

public class NameFetcher {
    private static JsonParser parser = new JsonParser();

    public static List<String> nameHistoryFromUuid(UUID uuid) {
        URLConnection connection;
        try {
            connection = new URL("https://api.mojang.com/user/profiles/"
                    + uuid.toString().replace("-", "").toLowerCase() + "/names"
            ).openConnection();
            String text = new Scanner(connection.getInputStream()).useDelimiter("\\Z").next();
            JsonArray list = (JsonArray) parser.parse(text);
            List<String> names = new ArrayList<>();
            for (int i = 0; i < list.size(); i++) {
                names.add(((JsonObject) list.get(i)).get("name").getAsString());
            }
            return names;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Use new-new method with a better ratelimit


package com.jraska.github.client.dagger;

import javax.inject.Scope;
import java.lang.annotation.Retention;

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

@Scope @Retention(SOURCE) public @interface PerApp {
}

package com.jraska.github.client.dagger;

import javax.inject.Scope;
import java.lang.annotation.Retention;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

// RUNTIME RetentionPolicy has to be set,
// otherwise Dagger cannot process properly graphs between modules
@Scope @Retention(RUNTIME) public @interface PerApp {
}

Use Runtime retention policy because of multi module project


// Copyright 2007 The Apache Software Foundation
//
// 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.apache.tapestry.ioc.annotations;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

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

import org.apache.tapestry.ioc.services.ChainBuilder;

import apple.awt.StrategyBufferImage;

/**
 * Marker annotation used to denote a service that is the primary instance of some common interface.
 * This is often used when a service is a {@linkplain ChainBuilder chain of command} or
 * {@linkplain StrategyBufferImage strategy-based} and, therefore, many services will implement the
 * same interface.
 */
@Target(
{ PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
public @interface Primary
{

}

// Copyright 2007 The Apache Software Foundation
//
// 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.apache.tapestry.ioc.annotations;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

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

import org.apache.tapestry.ioc.services.ChainBuilder;
import org.apache.tapestry.ioc.services.StrategyBuilder;

/**
 * Marker annotation used to denote a service that is the primary instance of some common interface.
 * This is often used when a service is a {@linkplain ChainBuilder chain of command} or
 * {@linkplain StrategyBuilder strategy-based} and, therefore, many services will implement the same
 * interface.
 */
@Target(
{ PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
public @interface Primary
{

}

Convert uses of @InjectService to be @Inject plus a marker annotation


package study.hard.javalib.file;

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

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class FileTest {

	FileHandler fileHandler;
	File tempFile;

	@Before
	public void setUp() {
		fileHandler = new FileHandler();
	}

	@Test
	public void testCreateTempFile() throws IOException {
		tempFile = fileHandler.getTempFile("TEST_TEMP_FILE.txt");
		System.out.println("Absolute path of temporary file: " + tempFile.getAbsolutePath());
	}

	@Test
	public void testGetTempDirectoryPath() {
		File tempDirectory = new File(System.getProperty("java.io.tmpdir"));
		System.out.println(tempDirectory);
	}

	@After
	public void clean() {
		if (tempFile != null) {
			tempFile.delete();
		}
	}
}

package study.hard.javalib.file;

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

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class FileTest {

	FileHandler fileHandler;
	File tempFile;

	@Before
	public void setUp() {
		fileHandler = new FileHandler();
	}

	@Test
	public void testCreateTempFile() throws IOException {
		tempFile = fileHandler.getTempFile("TEST_TEMP_FILE.txt");
		System.out.println("Absolute path of temporary file: " + tempFile.getAbsolutePath());
	}

	@Test
	public void testGetTempDirectoryPath() {
		File tempDirectory = new File(System.getProperty("java.io.tmpdir"));
		System.out.println("Absolute path of temporary directory: " + tempDirectory);
	}

	@After
	public void clean() {
		if (tempFile != null) {
			tempFile.delete();
		}
	}
}

Add a comment for log.


/*
 * Copyright 2018 Basis Technology Corp.
 *
 * 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.basistech.rosette.apimodel;

/**
 * A model type for morphological analysis.
 */
public enum MorphologyModelType {
    DEFAULT,
    PERCEPTRON,
    /**/;
}

/*
 * Copyright 2018 Basis Technology Corp.
 *
 * 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.basistech.rosette.apimodel;

/**
 * A model type for morphological analysis.
 */
public enum MorphologyModelType {
    DEFAULT,
    DNN,
    PERCEPTRON,
    /**/;
}

Add DNN as new morphology model type


package hello;

import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;

import hello.Hello;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = Hello.class)
@AutoConfigureMockMvc
@ActiveProfiles("test")
public class HomePageTest {

	@Autowired
	private MockMvc mvc;

	@Test
	public void getRoot() throws Exception {
		mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.TEXT_HTML)).andExpect(status().isOk());
	}

	@Test
	public void getJsonRoot() throws Exception {
		mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.APPLICATION_JSON))
		.andExpect(status().isNotFound());
	}

}

package hello;

import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = Hello.class)
@AutoConfigureMockMvc
@ActiveProfiles("test")
public class HomePageTest {

	@Autowired
	private MockMvc mvc;

	@Test
	public void getRoot() throws Exception {
		mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.TEXT_HTML)).andExpect(status().isOk());
	}

	@Test
	public void getJsonRoot() throws Exception {
		mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.APPLICATION_JSON))
		.andExpect(status().isNotFound());
	}
}

Remove obsolete import and fix formatting in test.


package co.uk.jiveelection.campaign;

import java.io.IOException;

import twitter4j.TwitterException;
import co.uk.jiveelection.campaign.twit.TwitHelper;

/**
 * Main entry point for the Jive Campaign application. Sets up a continuously running loop that
 * checks the latest tweet from the named candidate, translates it to jive, then tweets it as a
 * jivebot.
 *
 */
public class App {

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

		TwitHelper jivebotDavidCameron = new TwitHelper("David_Cameron", "davidjiveron");
		TwitHelper jivebotEdMiliband = new TwitHelper("Ed_Miliband", "edjiveaband");
		TwitHelper jivebotNickClegg = new TwitHelper("nick_clegg", "nickjivegg");

	}

}

package co.uk.jiveelection.campaign;

import java.io.IOException;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import twitter4j.TwitterException;
import co.uk.jiveelection.campaign.twit.TwitHelper;

/**
 * Main entry point for the Jive Campaign application. Sets up a continuously running loop that
 * checks the latest tweet from the named candidate, translates it to jive, then tweets it as a
 * jivebot.
 *
 */
@SpringBootApplication
public class App {

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

		TwitHelper jivebotDavidCameron = new TwitHelper("David_Cameron", "davidjiveron");
		TwitHelper jivebotEdMiliband = new TwitHelper("Ed_Miliband", "edjiveaband");
		TwitHelper jivebotNickClegg = new TwitHelper("nick_clegg", "nickjivegg");

	}

}

Enable Spring Boot for this app


package com.collective.celos;

/**
 * Uniquely identifies a workflow.
 */
public class WorkflowID extends ValueObject {

    private final String id;

    public WorkflowID(String id) {
        this.id = Util.requireNonNull(id);
        if (id.trim().equals("")) {
            throw new IllegalArgumentException("Workflow ID can't be only whitespace.");
        }
    }

    public String getID() {
        return id;
    }

}

package com.collective.celos;

/**
 * Uniquely identifies a workflow.
 */
public class WorkflowID extends ValueObject {

    protected final String id;

    public WorkflowID(String id) {
        this.id = Util.requireNonNull(id);
        if (id.trim().equals("")) {
            throw new IllegalArgumentException("Workflow ID can't be only whitespace.");
        }
    }

    public String getID() {
        return id;
    }

}

Make id member protected for consistency with other value objects.


package com.tuenti.tuentitv.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.widget.ProgressBar;
import butterknife.InjectView;
import com.tuenti.tuentitv.R;
import java.util.LinkedList;
import java.util.List;

/**
 * @author Pedro Vicente Gómez Sánchez.
 */
public class LoadingActivity extends BaseActivity {

  private static final long LOADING_TIME_IN_MILLIS = 3000;

  @InjectView(R.id.pb_loading) ProgressBar pb_loading;

  @Override protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.loading_activity);
    super.onCreate(savedInstanceState);
    pb_loading.getIndeterminateDrawable()
        .setColorFilter(0x32FFFFFF, android.graphics.PorterDuff.Mode.MULTIPLY);

    new Handler().postDelayed(new Runnable() {
      @Override public void run() {
        startMainActivity();
      }
    }, LOADING_TIME_IN_MILLIS);
  }

  private void startMainActivity() {
    Intent intent = new Intent(this, MainActivity.class);
    startActivity(intent);
    finish();
  }

  @Override protected List getModules() {
    return new LinkedList();
  }
}

package com.tuenti.tuentitv.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.widget.ProgressBar;
import butterknife.InjectView;
import com.tuenti.tuentitv.R;
import java.util.LinkedList;
import java.util.List;

/**
 * @author Pedro Vicente Gómez Sánchez.
 */
public class LoadingActivity extends BaseActivity {

  private static final long LOADING_TIME_IN_MILLIS = 3000;

  @InjectView(R.id.pb_loading) ProgressBar pb_loading;

  private Runnable startMainActivity;
  private Handler handler;

  @Override protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.loading_activity);
    super.onCreate(savedInstanceState);
    pb_loading.getIndeterminateDrawable()
        .setColorFilter(0x32FFFFFF, android.graphics.PorterDuff.Mode.MULTIPLY);
    handler = new Handler();
    startMainActivity = new Runnable() {
      @Override public void run() {
        startMainActivity();
      }
    };
    handler.postDelayed(startMainActivity, LOADING_TIME_IN_MILLIS);
  }

  @Override public void onBackPressed() {
    super.onBackPressed();
    handler.removeCallbacks(startMainActivity);
  }

  private void startMainActivity() {
    Intent intent = new Intent(this, MainActivity.class);
    startActivity(intent);
    finish();
  }

  @Override protected List getModules() {
    return new LinkedList();
  }
}

Remove start main activity task from handler if back button is pressed during loading process.


package info.u_team.u_team_test;

import org.apache.logging.log4j.*;

import info.u_team.u_team_core.construct.ConstructManager;
import info.u_team.u_team_core.integration.IntegrationManager;
import info.u_team.u_team_core.util.verify.JarSignVerifier;
import net.minecraftforge.fml.common.Mod;

@Mod(TestMod.MODID)
public class TestMod {

	public static final String MODID = "uteamtest";
	public static final Logger LOGGER = LogManager.getLogger("UTeamTest");

	public TestMod() {
		JarSignVerifier.checkSigned(MODID);

		LOGGER.info("--------------------------------------- LOADING TEST MOD ---------------------------------------");

//		TestCommonBusRegister.register();
//		DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> TestClientBusRegister::register);

		ConstructManager.constructConstructs(MODID);

		IntegrationManager.constructIntegrations(MODID);
	}
}

package info.u_team.u_team_test;

import org.apache.logging.log4j.*;

import info.u_team.u_team_core.construct.ConstructManager;
import info.u_team.u_team_core.integration.IntegrationManager;
import info.u_team.u_team_core.util.annotation.AnnotationManager;
import info.u_team.u_team_core.util.verify.JarSignVerifier;
import net.minecraftforge.fml.common.Mod;

@Mod(TestMod.MODID)
public class TestMod {

	public static final String MODID = "uteamtest";
	public static final Logger LOGGER = LogManager.getLogger("UTeamTest");

	public TestMod() {
		JarSignVerifier.checkSigned(MODID);

		LOGGER.info("--------------------------------------- LOADING TEST MOD ---------------------------------------");

		// TestCommonBusRegister.register();
		// DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> TestClientBusRegister::register);

		AnnotationManager.callAnnotations(MODID);
	}
}

Update testmod to use the new method