/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.rendering.transformation.linkchecker;

import org.xwiki.component.annotation.ComponentRole;

/**
 * Configuration options for the Link Checker Transformation.
 *
 * @version $Id$
 * @since 3.3M2
 */
@ComponentRole
public interface LinkCheckerTransformationConfiguration
{
    /**
     * @return the amount of time (in ms) after which a link should be rechecked for validity
     */
    long getCheckTimeout();

    /**
     * @param checkTimeout the time after which a link should be checked again for validity
     */
    public void setCheckTimeout(long checkTimeout);
}

/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.rendering.transformation.linkchecker;

import org.xwiki.component.annotation.ComponentRole;

/**
 * Configuration options for the Link Checker Transformation.
 *
 * @version $Id$
 * @since 3.3M2
 */
@ComponentRole
public interface LinkCheckerTransformationConfiguration
{
    /**
     * @return the amount of time (in ms) after which a link should be rechecked for validity
     */
    long getCheckTimeout();

    /**
     * @param checkTimeout the time after which a link should be checked again for validity
     */
    void setCheckTimeout(long checkTimeout);
}

Create a Transformation to check broken external links * Fix checkstyle error


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

import java.util.Enumeration;
import java.util.Iterator;

public class IteratorToEnumeration implements Enumeration
{
    private Iterator m_iter = null;

    public IteratorToEnumeration(Iterator iter)
    {
        m_iter = iter;
    }

    public boolean hasMoreElements()
    {
        if (m_iter == null)
            return false;
        return m_iter.hasNext();
    }

    public Object nextElement()
    {
        if (m_iter == null)
            return null;
        return m_iter.next();
    }
}

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

import java.util.Enumeration;
import java.util.Iterator;

public class IteratorToEnumeration implements Enumeration
{
    private final Iterator m_iter;

    public IteratorToEnumeration(Iterator iter)
    {
        m_iter = iter;
    }

    public boolean hasMoreElements()
    {
        if (m_iter == null)
            return false;
        return m_iter.hasNext();
    }

    public Object nextElement()
    {
        if (m_iter == null)
            return null;
        return m_iter.next();
    }
}

Make iterator member final to prevent visibility issues.


package net.imagej.ops.viewOp;

import net.imagej.ops.Computer;
import net.imagej.ops.ViewOps.View;

public interface DefaultView<I, O> extends View, Computer<I, O> {
	// NB: Marker interface
}

package net.imagej.ops.viewOp;

import net.imagej.ops.view.ViewOps;
import net.imagej.ops.view.ViewOps.View;
import net.imglib2.Interval;
import net.imglib2.RandomAccessible;
import net.imglib2.view.IntervalView;
import net.imglib2.view.Views;

import org.scijava.ItemIO;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

@Plugin(type = ViewOps.View.class, name = ViewOps.View.NAME)
public class DefaultView<T>
		extends
		AbstractView<RandomAccessible< T >, IntervalView< T >>
		implements
		View<RandomAccessible< T >, IntervalView< T >> {

	@Parameter(type = ItemIO.INPUT)
	private Interval interval;

	@Override
	public IntervalView< T > compute(RandomAccessible< T > input) {
		return Views.interval(input, interval);
	}

}

Add default implementation of View interface.


package python;

public interface Platform {
    /**
     * Return the number of CPU nanoseconds that this thread has consumed.
     */
    public long clock();

    public void debug(java.lang.String msg);

    public void debug(java.lang.String msg, java.lang.Object obj);

    public org.python.Object getPlatform();

    public org.python.Object stderr();

    public org.python.Object stdout();

    public org.python.Object stdin();

    public org.python.Object args();
}

Fix one last file with missing eof newline


package com.grayben.riskExtractor.headingMarker.elector;

import java.util.List;

import com.grayben.riskExtractor.headingMarker.TextCandidate;
import com.grayben.riskExtractor.headingMarker.nominator.NomineesRetrievable;

public class ElectedTextList implements
	NomineesRetrievable,
	ElecteesRetrievable {

	List<String> textList;

    public List<String> getTextList() {
        return textList;
    }

    public void setTextList(List<String> textList) {
        this.textList = textList;
    }

	List<TextCandidate> nominees;

    @Override
    public List<TextCandidate> getNominees() {
        // TODO Auto-generated method stub
        return null;
    }

    public void setNominees(List<TextCandidate> nominees) {
        this.nominees = nominees;
    }

    List<TextCandidate> electees;

    @Override
    public List<TextCandidate> getElectees() {
        // TODO Auto-generated method stub
        return null;
    }

    public void setElectees(List<TextCandidate> electees) {
        this.electees = electees;
    }

	public ElectedTextList(List<String> textList, List<TextCandidate> nominees, List<TextCandidate> electees){
		super();
		this.textList = textList;
		this.nominees = nominees;
		this.electees = electees;
	}

}

package com.grayben.riskExtractor.headingMarker.elector;

import java.util.List;

import com.grayben.riskExtractor.headingMarker.TextCandidate;
import com.grayben.riskExtractor.headingMarker.nominator.NomineesRetrievable;

public class ElectedTextList implements
	NomineesRetrievable,
	ElecteesRetrievable {

	List<String> textList;

    public List<String> getTextList() {
        return textList;
    }

    public void setTextList(List<String> textList) {
        this.textList = textList;
    }

	List<TextCandidate> nominees;

    @Override
    public List<TextCandidate> getNominees() {
        // TODO Auto-generated method stub
        return this.nominees;
    }

    public void setNominees(List<TextCandidate> nominees) {
        this.nominees = nominees;
    }

    List<TextCandidate> electees;

    @Override
    public List<TextCandidate> getElectees() {
        // TODO Auto-generated method stub
        return this.electees;
    }

    public void setElectees(List<TextCandidate> electees) {
        this.electees = electees;
    }

	public ElectedTextList(List<String> textList, List<TextCandidate> nominees, List<TextCandidate> electees){
		super();
		this.textList = textList;
		this.nominees = nominees;
		this.electees = electees;
	}

}

Fix accessors to pass unit tests


package nom.bdezonia.zorbage.type.data.universal;

public interface InternalRepresentation {

	void setInternalRep(TensorOctonionRepresentation rep);
	void setSelf(TensorOctonionRepresentation rep);

}

/*
 * Zorbage: an algebraic data hierarchy for use in numeric processing.
 *
 * Copyright (C) 2016-2017 Barry DeZonia
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package nom.bdezonia.zorbage.type.data.universal;

/**
 *
 * @author Barry DeZonia
 *
 */
public interface InternalRepresentation {

	void setInternalRep(TensorOctonionRepresentation rep);
	void setSelf(TensorOctonionRepresentation rep);

}

Add a header to a file that needs it


import javafx.application.Application;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.stage.Stage;
import model.ModelDatabase;
import view.View;

/**
 * Created by Thagus on 01/09/16.
 */
public class Main extends Application{
    private Stage window;
    private ModelDatabase db;

    public static void main(String[] args){
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        this.window = primaryStage;
        db = ModelDatabase.instance();

        window.setOnCloseRequest(e -> {
            e.consume();
            closeProgram();
        });

        View view = new View();
        view.start(window);
    }

    private void closeProgram(){
        Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Are you sure you want to quit?", ButtonType.YES, ButtonType.NO, ButtonType.CANCEL);
        alert.setTitle("Exit");
        alert.setHeaderText(null);

        alert.showAndWait();

        if (alert.getResult() == ButtonType.YES){
            db.close();
            window.close();
        }
    }
}

import javafx.application.Application;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.stage.Stage;
import model.ModelDatabase;
import view.View;

/**
 * Created by Thagus on 01/09/16.
 */
public class Main extends Application{
    private Stage window;
    private ModelDatabase db;

    public static void main(String[] args){
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        this.window = primaryStage;
        db = ModelDatabase.instance();

        window.setOnCloseRequest(e -> {
            e.consume();
            closeProgram();
        });

        View view = new View();
        view.start(window);
    }

    private void closeProgram(){
        Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Are you sure you want to quit?", ButtonType.YES, ButtonType.NO, ButtonType.CANCEL);
        alert.setTitle("Exit");
        alert.setHeaderText(null);

        alert.showAndWait();

        if (alert.getResult() == ButtonType.YES){
            db.close();
            window.close();
            System.exit(0);
        }
    }
}

Exit whole system when closing main window


/*
 * Copyright 2014, ApiFest project
 *
 * 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.apifest.client;

public class RevokeUserTokensRequest {

    private String userId;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

}

/*
 * Copyright 2014, ApiFest project
 *
 * 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.apifest.client;

public class RevokeUserTokensRequest {

    private String user_id;

    public String getUser_id() {
        return user_id;
    }

    public void setUser_id(String userId) {
        this.user_id = userId;
    }

}

Change the field name so the serialized field name matches the one the server expects


package de.meldanor.VaadinChart.charts;

import java.util.Collection;

import com.vaadin.annotations.JavaScript;

@JavaScript("circlechart_connector.min.js")
public abstract class CircleChart extends Chart {

    private static final long serialVersionUID = 6506866186112698558L;

    protected CircleChart() {
        // For serialization
        this("pie");
    }

    public CircleChart(final String type) {
        getState(false).setType(type);
    }

    public String getType() {
        return getState(false).getType();
    }

    @Override
    protected CircleChartState getState() {
        return (CircleChartState) super.getState();
    }

    @Override
    protected CircleChartState getState(boolean markAsDirty) {
        return (CircleChartState) super.getState(markAsDirty);
    }

    public void addDataSeries(CircleDataSeries series) {
        getState().getSeries().add(series);
    }

    public void addDataSeries(Collection<CircleDataSeries> series) {
        getState().getSeries().addAll(series);
//        CircleChartState state = getState(false);
//        series.forEach(s -> state.getSeries().put(s.getLabel(), s));
//        markAsDirty();
    }
}

package de.meldanor.VaadinChart.charts;

import java.util.Collection;

import com.vaadin.annotations.JavaScript;

@JavaScript("circlechart_connector.min.js")
public abstract class CircleChart extends Chart {

    private static final long serialVersionUID = 6506866186112698558L;

    protected CircleChart() {
        // For serialization
        this("pie");
    }

    public CircleChart(final String type) {
        getState(false).setType(type);
    }

    public String getType() {
        return getState(false).getType();
    }

    @Override
    protected CircleChartState getState() {
        return (CircleChartState) super.getState();
    }

    @Override
    protected CircleChartState getState(boolean markAsDirty) {
        return (CircleChartState) super.getState(markAsDirty);
    }

    public void addDataSeries(CircleDataSeries series) {
        getState().getSeries().add(series);
    }

    public void addDataSeries(Collection<CircleDataSeries> series) {
        getState().getSeries().addAll(series);
    }

    public void removeDataSeries(String label) {
        getState().getSeries().removeIf(s -> s.getLabel().equals(label));
    }
}

Add missing remove function for series


/*
 * Copyright (c) 2000-2018 TeamDev Ltd. All rights reserved.
 * TeamDev PROPRIETARY and CONFIDENTIAL.
 * Use is subject to license terms.
 */

package io.spine.web.firebase;

import io.spine.web.QueryProcessingResult;

import javax.servlet.ServletResponse;
import java.io.IOException;

/**
 * A result of a query processed by a {@link FirebaseQueryBridge}.
 *
 * <p>This result represents a database path to the requested data.
 * See {@link FirebaseQueryBridge} for more details.
 *
 * @author Dmytro Dashenkov
 */
final class FirebaseQueryProcessingResult implements QueryProcessingResult {

    private static final String MIME_TYPE = "text/plain";

    private final FirebaseDatabasePath path;

    FirebaseQueryProcessingResult(FirebaseDatabasePath path) {
        this.path = path;
    }

    @Override
    public void writeTo(ServletResponse response) throws IOException {
        final String databaseUrl = path.toString();
        response.getWriter().append(databaseUrl);
        response.setContentType(MIME_TYPE);
    }

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

/*
 * Copyright (c) 2000-2018 TeamDev Ltd. All rights reserved.
 * TeamDev PROPRIETARY and CONFIDENTIAL.
 * Use is subject to license terms.
 */

package io.spine.web.firebase;

import io.spine.web.QueryProcessingResult;

import javax.servlet.ServletResponse;
import java.io.IOException;

/**
 * A result of a query processed by a {@link FirebaseQueryBridge}.
 *
 * <p>This result represents a database path to the requested data.
 * See {@link FirebaseQueryBridge} for more details.
 *
 * @author Dmytro Dashenkov
 */
final class FirebaseQueryProcessingResult implements QueryProcessingResult {

    private static final String MIME_TYPE = "text/plain";

    private final FirebaseDatabasePath path;

    FirebaseQueryProcessingResult(FirebaseDatabasePath path) {
        this.path = path;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void writeTo(ServletResponse response) throws IOException {
        final String databaseUrl = path.toString();
        response.getWriter().append(databaseUrl);
        response.setContentType(MIME_TYPE);
    }

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

Add a formal doc for an overridden method.


package kurs.zadania.adressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigationHelper extends HelperBase{

  public NavigationHelper(WebDriver wd) {
    super(wd);
  }

 // public void gotoGroupPage() { click(By.linkText("groups")); }

/* sprawdzanie elementu na stronie i przejście po linku - wariant 1
  public void gotoGroupPage() {
    if (!isElementPresent(By.tagName("h1"))
            || !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            || !isElementPresent(By.name("new"))) {
      click(By.linkText("groups"));
    }
  }
*/
// sprawdzanie elementu na stronie i przejście po linku - wariant 2 lepszy

  public void gotoGroupPage() {
    if (isElementPresent(By.tagName("h1"))
            && !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            && !isElementPresent(By.name("new"))) {
      return;
    }
      click(By.linkText("groups"));
    }

  public void gotoMainPage() {
    if (isElementPresent(By.id("maintable"))) {
      return;
    }
      click(By.linkText("home"));
  }
}

package kurs.zadania.adressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigationHelper extends HelperBase{

  public NavigationHelper(WebDriver wd) {
    super(wd);
  }

  public void gotoGroupPage() {
      click(By.linkText("groups"));
  }

  public void gotoMainPage() {
      click(By.linkText("home"));

  }
}

Revert "Revert "Revert "optimization of the transition between the pages"""


package nl.surfnet.coin.selfservice.api.rest;

import nl.surfnet.coin.selfservice.domain.CoinUser;
import nl.surfnet.coin.selfservice.util.SpringSecurity;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HttpServletBean;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import static nl.surfnet.coin.selfservice.api.rest.Constants.HTTP_X_IDP_ENTITY_ID;

@Controller
@RequestMapping(value = "/users", produces = MediaType.APPLICATION_JSON_VALUE)
public class UsersController extends BaseController {

  @RequestMapping("/me")
  public ResponseEntity<RestResponse> me(HttpServletRequest request) {
    return new ResponseEntity(this.createRestResponse(SpringSecurity.getCurrentUser()), HttpStatus.OK);
  }

  @RequestMapping("/me/switch-to-idp/{switchToIdp}")
  public ResponseEntity currentIdp(@PathVariable("switchToIdp") String switchToIdp, HttpServletResponse response) {
    SpringSecurity.setCurrentIdp(switchToIdp);
    response.setHeader(HTTP_X_IDP_ENTITY_ID, switchToIdp);
    return new ResponseEntity(HttpStatus.OK);
  }

}

package nl.surfnet.coin.selfservice.api.rest;

import nl.surfnet.coin.selfservice.domain.CoinUser;
import nl.surfnet.coin.selfservice.util.SpringSecurity;
import org.owasp.esapi.waf.internal.InterceptingHTTPServletRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.HttpServletBean;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import static nl.surfnet.coin.selfservice.api.rest.Constants.HTTP_X_IDP_ENTITY_ID;

@Controller
@RequestMapping(value = "/users", produces = MediaType.APPLICATION_JSON_VALUE)
public class UsersController extends BaseController {

  @RequestMapping("/me")
  public ResponseEntity<RestResponse> me(HttpServletRequest request) {
    return new ResponseEntity(this.createRestResponse(SpringSecurity.getCurrentUser()), HttpStatus.OK);
  }

  @RequestMapping("/me/switch-to-idp/**")
  public ResponseEntity currentIdp(HttpServletResponse response, HttpServletRequest request) {
    String path = (String)request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
    String switchToIdp = path.replaceAll("/users/me/switch-to-idp/", "");
    SpringSecurity.setCurrentIdp(switchToIdp);
    response.setHeader(HTTP_X_IDP_ENTITY_ID, switchToIdp);
    return new ResponseEntity(HttpStatus.OK);
  }

}

Fix issue with the `switch-to-idp` controller mapping


package io.quarkus.mutiny.deployment;

import java.util.concurrent.ExecutorService;

import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ExecutorBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.mutiny.runtime.MutinyInfrastructure;

public class MutinyProcessor {

    @BuildStep
    public FeatureBuildItem registerFeature() {
        return new FeatureBuildItem(Feature.MUTINY);
    }

    @BuildStep
    @Record(ExecutionTime.RUNTIME_INIT)
    public void initExecutor(ExecutorBuildItem executorBuildItem, MutinyInfrastructure recorder) {
        ExecutorService executor = executorBuildItem.getExecutorProxy();
        recorder.configureMutinyInfrastructure(executor);
    }

    @BuildStep
    @Record(ExecutionTime.RUNTIME_INIT)
    public void defineDroppedExceptionHandler(MutinyInfrastructure recorder) {
        recorder.configureDroppedExceptionHandler();
    }

    @BuildStep
    @Record(ExecutionTime.RUNTIME_INIT)
    public void defineThreadBlockingChecker(MutinyInfrastructure recorder) {
        recorder.configureThreadBlockingChecker();
    }
}

package io.quarkus.mutiny.deployment;

import java.util.concurrent.ExecutorService;

import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ExecutorBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.mutiny.runtime.MutinyInfrastructure;

public class MutinyProcessor {

    @BuildStep
    public FeatureBuildItem registerFeature() {
        return new FeatureBuildItem(Feature.MUTINY);
    }

    @BuildStep
    @Record(ExecutionTime.RUNTIME_INIT)
    public void initExecutor(ExecutorBuildItem executorBuildItem, MutinyInfrastructure recorder) {
        ExecutorService executor = executorBuildItem.getExecutorProxy();
        recorder.configureMutinyInfrastructure(executor);
    }

    @BuildStep
    @Record(ExecutionTime.STATIC_INIT)
    public void defineDroppedExceptionHandler(MutinyInfrastructure recorder) {
        recorder.configureDroppedExceptionHandler();
    }

    @BuildStep
    @Record(ExecutionTime.STATIC_INIT)
    public void defineThreadBlockingChecker(MutinyInfrastructure recorder) {
        recorder.configureThreadBlockingChecker();
    }
}

Move Mutiny infrastructure initialization to STATIC_INIT


package com.red.alert.config;

public class Alerts {
    // Date format for recent alerts display
    public static final String DATE_FORMAT = "HH:mm:ss (dd/MM/yy)";

    // Time to wait before calling finish() on AlertPopup after POST_IMPACT_WAIT_MINUTES passed
    public static final int ALERT_POPUP_DONE_PADDING = 10;

    // Time that must pass (in seconds) in between alerts for the same zone (to avoid duplicate alerts)
    public static final int DUPLICATE_ALERTS_PADDING_TIME = 60;

}

package com.red.alert.config;

public class Alerts {
    // Date format for recent alerts display
    public static final String DATE_FORMAT = "HH:mm:ss (dd/MM/yy)";

    // Time to wait before calling finish() on AlertPopup after POST_IMPACT_WAIT_MINUTES passed
    public static final int ALERT_POPUP_DONE_PADDING = 10;

    // Time that must pass (in seconds) in between alerts for the same zone (to avoid duplicate alerts)
    public static final int DUPLICATE_ALERTS_PADDING_TIME = 60 * 2;

}

Increase duplicate alert padding time to 2 minutes


/*
 * Copyright (C) 2013 Square, 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 retrofit2.http;

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

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

/**
 * Denotes that the request body will use form URL encoding. Fields should be declared as parameters
 * and annotated with {@link Field @Field}.
 *
 *
Requests made with this annotation will have {@code application/x-www-form-urlencoded} MIME
 * type. Field names and values will be UTF-8 encoded before being URI-encoded in accordance to RFC-3986.
 */
@Documented
@Target(METHOD)
@Retention(RUNTIME)
public @interface FormUrlEncoded {}

Change old IETF reference link


package com.github.vedenin.thirdpartylib.htmlparser;

import com.github.vedenin.thirdpartylib.annotations.Atom;
import com.github.vedenin.thirdpartylib.annotations.BoilerPlate;
import org.jsoup.parser.Tag;

/**
 * This Atom pattern (pattern that extends a Proxy pattern that have only minimal methods from original class)
 * This using to light-reference to another third party open-source libraries
 *
 * Created by vvedenin on 12/19/2016.
 */
@Atom
public class TagAtom {
    private final Tag tag;

    public static TagAtom valueOf(String tagString) {
        return new TagAtom(Tag.valueOf(tagString));
    }

    // Just boilerplate code for Atom
    @Override
    @BoilerPlate
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TagAtom tagAtom = (TagAtom) o;

        return !(tag != null ? !tag.equals(tagAtom.tag) : tagAtom.tag != null);

    }

    @Override
    @BoilerPlate
    public int hashCode() {
        return tag != null ? tag.hashCode() : 0;
    }

    @BoilerPlate
    private TagAtom(Tag tag) {
        this.tag = tag;
    }

    @BoilerPlate
    public static TagAtom getAtom(Tag tag) {
        return new TagAtom(tag);
    }
}

package com.github.vedenin.thirdpartylib.htmlparser;

import com.github.vedenin.thirdpartylib.annotations.Atom;
import com.github.vedenin.thirdpartylib.annotations.BoilerPlate;
import com.github.vedenin.thirdpartylib.annotations.Reference;
import org.jsoup.parser.Tag;

/**
 * This Atom pattern (pattern that extends a Proxy pattern that have only minimal methods from original class)
 * This using to light-reference to another third party open-source libraries
 *
 * Created by vvedenin on 12/19/2016.
 */
@Atom
@Reference({ElementAtom.class})
public class TagAtom {
    private final Tag tag;

    public static TagAtom valueOf(String tagString) {
        return new TagAtom(Tag.valueOf(tagString));
    }

    // Just boilerplate code for Atom
    @Override
    @BoilerPlate
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TagAtom tagAtom = (TagAtom) o;

        return !(tag != null ? !tag.equals(tagAtom.tag) : tagAtom.tag != null);

    }

    @Override
    @BoilerPlate
    public int hashCode() {
        return tag != null ? tag.hashCode() : 0;
    }

    @BoilerPlate
    private TagAtom(Tag tag) {
        this.tag = tag;
    }

    @BoilerPlate
    public static TagAtom getAtom(Tag tag) {
        return new TagAtom(tag);
    }
}

Create atom-proxy for third party libs


package com.elpatika.stepic.view;

import android.os.Bundle;
import android.os.Handler;

import com.elpatika.stepic.R;
import com.elpatika.stepic.base.BaseFragmentActivity;

public class SplashActivity extends BaseFragmentActivity {

    // Splash screen wait time
    private static final int SPLASH_TIME_OUT = 3000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //This stops from opening again from the Splash screen when minimized
        if (!isTaskRoot()) {
            finish();
            return;
        }

        setContentView(R.layout.activity_splash);
        overridePendingTransition(R.anim.slide_in_from_end, R.anim.slide_out_to_start);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                mShell.getScreenProvider().showLaunchScreen(SplashActivity.this, false);

                finish();
            }
        }, SPLASH_TIME_OUT);

    }
}

package com.elpatika.stepic.view;

import android.os.Bundle;
import android.os.Handler;

import com.elpatika.stepic.R;
import com.elpatika.stepic.base.BaseFragmentActivity;

public class SplashActivity extends BaseFragmentActivity {

    // Splash screen wait time
    private static final int SPLASH_TIME_OUT = 3000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //This stops from opening again from the Splash screen when minimized
        if (!isTaskRoot()) {
            finish();
            return;
        }

        setContentView(R.layout.activity_splash);
        overridePendingTransition(R.anim.slide_in_from_end, R.anim.slide_out_to_start);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                if (!isFinishing()) {
                    mShell.getScreenProvider().showLaunchScreen(SplashActivity.this, false);

                    finish();
                }
            }
        }, SPLASH_TIME_OUT);

    }
}

Fix bug with second start splash activity


package org.skife.jdbi.v2;

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

class ListContainerBuilder implements ContainerBuilder<List<?>>
{
    private final ArrayList<Object> list;

    ListContainerBuilder()
    {
        this.list = new ArrayList();
    }

    public ListContainerBuilder add(Object it)
    {
        list.add(it );
        return this;
    }

    public List<?> build()
    {
        return list;
    }
}

package org.skife.jdbi.v2;

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

class ListContainerBuilder implements ContainerBuilder<List<?>>
{
    private final ArrayList<Object> list;

    ListContainerBuilder()
    {
        this.list = new ArrayList<Object>();
    }

    @Override
    public ListContainerBuilder add(Object it)
    {
        list.add(it);
        return this;
    }

    @Override
    public List<?> build()
    {
        return list;
    }
}

Put @Override annotations back in now that jdbi is 1.6 only


package java.util;

import edu.columbia.cs.psl.phosphor.struct.ControlTaintTagStack;
import edu.columbia.cs.psl.phosphor.struct.TaintedBooleanWithObjTag;

public interface Collection<E> extends Iterable<E> {
    int size();

    boolean isEmpty();

    boolean contains(Object o);

    Iterator<E> iterator();

    Object[] toArray();

    <T> T[] toArray(T[] a);

    boolean add(E e);

    TaintedBooleanWithObjTag add$$PHOSPHORTAGGED(E e, TaintedBooleanWithObjTag ret);

    TaintedBooleanWithObjTag add$$PHOSPHORTAGGED(E e, ControlTaintTagStack ctrl, TaintedBooleanWithObjTag ret);

    boolean remove(Object o);

    boolean containsAll(Collection<?> c);

    boolean addAll(Collection<? extends E> c);

    boolean removeAll(Collection<?> c);

    boolean retainAll(Collection<?> c);

    void clear();

    boolean equals(Object o);

    int hashCode();
}

package java.util;

import edu.columbia.cs.psl.phosphor.struct.ControlTaintTagStack;
import edu.columbia.cs.psl.phosphor.struct.TaintedBooleanWithObjTag;

import java.util.stream.Stream;

public interface Collection<E> extends Iterable<E> {
    int size();

    boolean isEmpty();

    boolean contains(Object o);

    Iterator<E> iterator();

    Object[] toArray();

    <T> T[] toArray(T[] a);

    boolean add(E e);

    Stream<E> stream();

    TaintedBooleanWithObjTag add$$PHOSPHORTAGGED(E e, TaintedBooleanWithObjTag ret);

    TaintedBooleanWithObjTag add$$PHOSPHORTAGGED(E e, ControlTaintTagStack ctrl, TaintedBooleanWithObjTag ret);

    boolean remove(Object o);

    boolean containsAll(Collection<?> c);

    boolean addAll(Collection<? extends E> c);

    boolean removeAll(Collection<?> c);

    boolean retainAll(Collection<?> c);

    void clear();

    boolean equals(Object o);

    int hashCode();
}

Add stream() method to collection compile-time interface


package com.tinkerpop.gremlin.server.op.standard;

import com.tinkerpop.gremlin.driver.Tokens;
import com.tinkerpop.gremlin.driver.message.RequestMessage;
import com.tinkerpop.gremlin.server.Context;
import com.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor;
import com.tinkerpop.gremlin.server.op.OpProcessorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.script.Bindings;
import javax.script.SimpleBindings;
import java.util.Map;
import java.util.Optional;

/**
 * Operations to be used by the {@link StandardOpProcessor}.
 *
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
final class StandardOps {
    private static final Logger logger = LoggerFactory.getLogger(StandardOps.class);

    public static void evalOp(final Context context) throws OpProcessorException {
        final RequestMessage msg = context.getRequestMessage();
        AbstractEvalOpProcessor.evalOp(context, context::getGremlinExecutor, () -> {
            final Bindings bindings = new SimpleBindings();
            Optional.ofNullable((Map<String, Object>) msg.getArgs().get(Tokens.ARGS_BINDINGS)).ifPresent(bindings::putAll);
            return bindings;
        });
    }
}

package com.tinkerpop.gremlin.server.op.standard;

import com.tinkerpop.gremlin.driver.Tokens;
import com.tinkerpop.gremlin.driver.message.RequestMessage;
import com.tinkerpop.gremlin.server.Context;
import com.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor;
import com.tinkerpop.gremlin.server.op.OpProcessorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.script.Bindings;
import javax.script.SimpleBindings;
import java.util.Map;
import java.util.Optional;

/**
 * Operations to be used by the {@link StandardOpProcessor}.
 *
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
final class StandardOps {
    private static final Logger logger = LoggerFactory.getLogger(StandardOps.class);

    public static void evalOp(final Context context) throws OpProcessorException {
        final RequestMessage msg = context.getRequestMessage();

        logger.debug("Sessionless request {} for eval in thread {}", msg.getRequestId(), Thread.currentThread().getName());

        AbstractEvalOpProcessor.evalOp(context, context::getGremlinExecutor, () -> {
            final Bindings bindings = new SimpleBindings();
            Optional.ofNullable((Map<String, Object>) msg.getArgs().get(Tokens.ARGS_BINDINGS)).ifPresent(bindings::putAll);
            return bindings;
        });
    }
}

Add logging message to sessionless op processor.


package com.ezardlabs.dethsquare;

public final class Camera extends Script {
	public final RectF bounds = new RectF();
	public static Camera main;

	public Camera(boolean main) {
		if (main) Camera.main = this;
	}

	public void update() {
		bounds.left = transform.position.x;
		bounds.top = transform.position.y;
		bounds.right = bounds.left + Screen.width / Screen.scale;
		bounds.bottom = bounds.top + Screen.height / Screen.scale;
	}
}

package com.ezardlabs.dethsquare;

public final class Camera extends Script {
	public final RectF bounds = new RectF();
	public static Camera main;
	private boolean isMain = false;

	public Camera(boolean main) {
		isMain = main;
	}

	@Override
	public void start() {
		if (isMain) main = this;
	}

	public void update() {
		bounds.left = transform.position.x;
		bounds.top = transform.position.y;
		bounds.right = bounds.left + Screen.width / Screen.scale;
		bounds.bottom = bounds.top + Screen.height / Screen.scale;
	}
}

Move setting of main camera from constructor to start method


/*
 * Copyright 2002-2013 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 org.springframework.security.web.csrf;

/**
 * Thrown when no expected {@link CsrfToken} is found but is required.
 *
 * @author Rob Winch
 * @since 3.2
 */
@SuppressWarnings("serial")
public class MissingCsrfTokenException extends CsrfException {

	public MissingCsrfTokenException(String actualToken) {
		super("Expected CSRF token not found. Has your session expired?");
	}
}

/*
 * Copyright 2002-2013 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 org.springframework.security.web.csrf;

/**
 * Thrown when no expected {@link CsrfToken} is found but is required.
 *
 * @author Rob Winch
 * @since 3.2
 */
@SuppressWarnings("serial")
public class MissingCsrfTokenException extends CsrfException {

	public MissingCsrfTokenException(String actualToken) {
		super("Could not verify the provided CSRF token because your session was not found.");
	}
}

Improve CSRF missing error message


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

import cucumber.api.junit.Cucumber;

import org.junit.runner.RunWith;

/**
 * Runs scenarios in all <tt>.feature</tt> files (this package and any subpackages).
 */
@RunWith(Cucumber.class)
@Cucumber.Options(
        format = {
                "html:target/cucumber-html-report"
                ,"json:target/cucumber.json"
        },
        glue={"classpath:domainapp.integtests.specglue"},
        strict = true,
        tags = { "~@backlog", "~@ignore" })
public class RunSpecs {
    // intentionally empty
}

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

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

import org.junit.runner.RunWith;

/**
 * Runs scenarios in all <tt>.feature</tt> files (this package and any subpackages).
 */
@RunWith(Cucumber.class)
@CucumberOptions(
        format = {
                "html:target/cucumber-html-report"
                ,"json:target/cucumber.json"
        },
        glue={"classpath:domainapp.integtests.specglue"},
        strict = true,
        tags = { "~@backlog", "~@ignore" })
public class RunSpecs {
    // intentionally empty
}

Replace deprecated @Cucumber.Options with @CucumberOptions


package io.dropwizard.lifecycle;

import org.eclipse.jetty.server.Server;

import java.util.EventListener;

public interface ServerLifecycleListener extends EventListener {
    void serverStarted(Server server);
}

package io.dropwizard.lifecycle;

import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import java.util.EventListener;

public interface ServerLifecycleListener extends EventListener {
    void serverStarted(Server server);

    default int getLocalPort(Server server) {
        return ((ServerConnector) server.getConnectors()[0]).getLocalPort();
    }

    default int getAdminPort(Server server) {
        final Connector[] connectors = server.getConnectors();
        return ((ServerConnector) connectors[connectors.length -1]).getLocalPort();
    }
}

Add helper functions for getting the local and admin ports from a server instance


package com.blamejared.mcbot.commands;

import com.blamejared.mcbot.commands.api.Command;
import com.blamejared.mcbot.commands.api.CommandBase;
import com.blamejared.mcbot.commands.api.CommandContext;
import com.blamejared.mcbot.commands.api.CommandException;
import com.blamejared.mcbot.commands.api.Flag;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;

@Command
public class CommandLMGTFY extends CommandBase {

    private static final Flag FLAG_IE = new SimpleFlag("ie", false);

    public CommandLMGTFY() {
        super("lmgtfy", false, Lists.newArrayList(FLAG_IE));
    }

    @Override
    public void process(CommandContext ctx) throws CommandException {
        if (ctx.getArgs().size() < 1) {
            throw new CommandException("Not enough arguments.");
        }
        int iie = ctx.getFlags().containsKey(FLAG_IE) ? 1 : 0;
        StringBuilder arg = new StringBuilder("http://lmgtfy.com/?iie=").append(iie).append("&q=");
        arg.append(Joiner.on('+').join(ctx.getArgs()));
        ctx.reply(arg.toString());
    }

    public String getUsage() {
        return "<question>";
    }
}

package com.blamejared.mcbot.commands;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.blamejared.mcbot.commands.api.Command;
import com.blamejared.mcbot.commands.api.CommandBase;
import com.blamejared.mcbot.commands.api.CommandContext;
import com.blamejared.mcbot.commands.api.CommandException;
import com.blamejared.mcbot.commands.api.Flag;
import com.google.common.base.Charsets;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;

@Command
public class CommandLMGTFY extends CommandBase {

    private static final Flag FLAG_IE = new SimpleFlag("ie", false);

    public CommandLMGTFY() {
        super("lmgtfy", false, Lists.newArrayList(FLAG_IE));
    }

    @Override
    public void process(CommandContext ctx) throws CommandException {
        if (ctx.getArgs().size() < 1) {
            throw new CommandException("Not enough arguments.");
        }
        int iie = ctx.getFlags().containsKey(FLAG_IE) ? 1 : 0;
        StringBuilder url = new StringBuilder("<http://lmgtfy.com/?iie=").append(iie).append("&q=");
        String arg = Joiner.on(' ').join(ctx.getArgs());
        try {
            ctx.reply(url.append(URLEncoder.encode(ctx.sanitize(arg), Charsets.UTF_8.name())).append(">").toString());
        } catch (UnsupportedEncodingException e) {
            throw new CommandException(e);
        }
    }

    public String getUsage() {
        return "<question>";
    }
}

Fix URL encoding of lmgtfy output


package com.faforever.api.data.domain;

import com.yahoo.elide.annotation.Include;
import lombok.Setter;
import org.hibernate.annotations.Immutable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Setter
@Table(name = "map_statistics")
@Include(type = MapStatistics.TYPE_NAME)
@Immutable
public class MapStatistics {
  public static final String TYPE_NAME = "mapStatistics";

  private Integer id;
  private Integer downloads;
  private Integer plays;
  private Integer draws;
  private Map map;

  @Id
  @Column(name = "map_id")
  public int getId() {
    return id;
  }

  @Column(name = "downloads")
  public int getDownloads() {
    return downloads;
  }

  @Column(name = "plays")
  public int getPlays() {
    return plays;
  }

  @Column(name = "draws")
  public int getDraws() {
    return draws;
  }

  @OneToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "map_id", insertable = false, updatable = false)
  public Map getMap() {
    return map;
  }
}

package com.faforever.api.data.domain;

import com.yahoo.elide.annotation.Include;
import lombok.Setter;
import org.hibernate.annotations.Immutable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Setter
@Table(name = "map_statistics")
@Include(type = MapStatistics.TYPE_NAME)
@Immutable
public class MapStatistics {
  public static final String TYPE_NAME = "mapStatistics";

  private Integer id;
  private Integer downloads;
  private Integer plays;
  private Integer draws;
  private Map map;

  @Id
  @Column(name = "map_id")
  public Integer getId() {
    return id;
  }

  @Column(name = "downloads")
  public Integer getDownloads() {
    return downloads;
  }

  @Column(name = "plays")
  public Integer getPlays() {
    return plays;
  }

  @Column(name = "draws")
  public Integer getDraws() {
    return draws;
  }

  @OneToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "map_id", insertable = false, updatable = false)
  public Map getMap() {
    return map;
  }
}

Set return type to Integer


package com.graphicsengine.charset;

import java.io.IOException;

import com.graphicsengine.assets.AssetManager;
import com.nucleus.renderer.BaseRenderer;
import com.nucleus.texturing.Texture2D;

/**
 * Use to create charmaps from JSON source
 *
 * @author Richard Sahlin
 *
 */
public class PlayfieldFactory {

    public static Playfield createCharmap(BaseRenderer baseRenderer, PlayfieldSetup constructor) throws IOException {

        Playfield map = new Playfield(constructor.mapWidth * constructor.mapHeight);
        PlayfieldProgram program = new PlayfieldProgram();
        baseRenderer.createProgram(program);
        Texture2D texture = AssetManager.getInstance().getTexture(baseRenderer, constructor.textureSource);
        map.createMesh(program, texture, constructor.tileWidth, constructor.tileHeight, constructor.zpos,
                constructor.textureFramesX, constructor.textureFramesY);
        map.setupPlayfield(constructor.mapWidth, constructor.mapHeight, constructor.xpos, constructor.ypos);
        map.setPlayfieldData(constructor.data, 0, 0, constructor.data.length);
        return map;
    }
}

package com.graphicsengine.charset;

import java.io.IOException;

import com.graphicsengine.assets.AssetManager;
import com.nucleus.renderer.BaseRenderer;
import com.nucleus.texturing.Texture2D;

/**
 * Use to create charmaps from JSON source
 *
 * @author Richard Sahlin
 *
 */
public class PlayfieldFactory {

    /**
     * Factory method for creating a playfield
     *
     * @param baseRenderer
     * @param constructor
     * @return
     * @throws IOException
     */
    public static Playfield create(BaseRenderer baseRenderer, PlayfieldSetup constructor) throws IOException {

        Playfield map = new Playfield(constructor.mapWidth * constructor.mapHeight);
        PlayfieldProgram program = new PlayfieldProgram();
        baseRenderer.createProgram(program);
        Texture2D texture = AssetManager.getInstance().getTexture(baseRenderer, constructor.textureSetup);
        map.createMesh(program, texture, constructor.tileWidth, constructor.tileHeight, constructor.zpos,
                constructor.textureFramesX, constructor.textureFramesY);
        map.setupPlayfield(constructor.mapWidth, constructor.mapHeight, constructor.xpos, constructor.ypos);
        map.setPlayfieldData(constructor.data, 0, 0, constructor.data.length);
        return map;
    }
}

Change playfield factory method name to create()


/*
 * Copyright (c) 2014 Wyatt Childers.
 *
 * All Rights Reserved
 */

package com.skelril.aurora.prayer.PrayerFX;

import com.skelril.aurora.prayer.PrayerType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;

/**
 * Author: Turtle9598
 */
public class ZombieFX extends AbstractEffect {

    @Override
    public PrayerType getType() {

        return PrayerType.ZOMBIE;
    }

    @Override
    public void add(Player player) {

        if (player.getWorld().getEntitiesByClass(Zombie.class).size() < 1000) {
            player.getWorld().spawn(player.getLocation(), Zombie.class);
        }
    }

    @Override
    public void clean(Player player) {

        // Nothing to do here
    }
}

/*
 * Copyright (c) 2014 Wyatt Childers.
 *
 * All Rights Reserved
 */

package com.skelril.aurora.prayer.PrayerFX;

import com.skelril.aurora.prayer.PrayerType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;

/**
 * Author: Turtle9598
 */
public class ZombieFX extends AbstractEffect {

    @Override
    public PrayerType getType() {

        return PrayerType.ZOMBIE;
    }

    @Override
    public void add(Player player) {

        if (player.getWorld().getEntitiesByClass(Zombie.class).size() < 1000) {
            player.getWorld().spawn(player.getLocation(), Zombie.class).setTarget(player);
        }
    }

    @Override
    public void clean(Player player) {

        // Nothing to do here
    }
}

Set the target of zombies spawned by the Zombie curse


package net.openhft.chronicle.bytes;

import org.junit.Test;

import java.io.File;
import java.io.RandomAccessFile;

import static org.junit.Assert.*;

public class MappedBytesTest {

    @Test
    public void shouldNotBeReadOnly() throws Exception {
        MappedBytes bytes = MappedBytes.mappedBytes(File.createTempFile("mapped", "bytes"), 1024);
        assertFalse(bytes.isBackingFileReadOnly());
        bytes.writeUtf8(null); // used to blow up.
        assertNull(bytes.readUtf8());
        bytes.release();
    }

    @Test
    public void shouldBeReadOnly() throws Exception {
        final File tempFile = File.createTempFile("mapped", "bytes");
        final RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
        raf.setLength(4096);
        assertTrue(tempFile.setWritable(false));
        final MappedBytes mappedBytes = MappedBytes.readOnly(tempFile);

        assertTrue(mappedBytes.
                isBackingFileReadOnly());
        mappedBytes.release();
    }
}

package net.openhft.chronicle.bytes;

import org.junit.Test;

import java.io.File;
import java.io.RandomAccessFile;

import static org.junit.Assert.*;

public class MappedBytesTest {

    @Test
    public void shouldNotBeReadOnly() throws Exception {
        MappedBytes bytes = MappedBytes.mappedBytes(File.createTempFile("mapped", "bytes"), 64 << 10);
        assertFalse(bytes.isBackingFileReadOnly());
        bytes.writeUtf8(null); // used to blow up.
        assertNull(bytes.readUtf8());
        bytes.release();
    }

    @Test
    public void shouldBeReadOnly() throws Exception {
        final File tempFile = File.createTempFile("mapped", "bytes");
        final RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
        raf.setLength(4096);
        assertTrue(tempFile.setWritable(false));
        final MappedBytes mappedBytes = MappedBytes.readOnly(tempFile);

        assertTrue(mappedBytes.
                isBackingFileReadOnly());
        mappedBytes.release();
    }
}

Fix a bug where MappedBytes.writeUtf8 crashed the JVM if passed a null


package main;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;

public class MatrixTransformationTest {
    @Test
    void rotateTo90Degrees() throws Exception {
        int[][] matrix = new int[][] {
                {0, 0, 0, 0},
                {1, 1, 1, 1},
                {2, 2, 2, 2},
                {3, 3, 3, 3}
        };
        int[][] result = new int[][] {
                {3, 2, 1, 0},
                {3, 2, 1, 0},
                {3, 2, 1, 0},
                {3, 2, 1, 0}
        };
        assertArrayEquals(result, MatrixTransformation.rotateTo90Degrees(matrix));
    }

    @Test
    void zeroefyMatrix() throws Exception {
        int[][] matrix = new int[][] {
                {1, 1, 1, 1, 1},
                {1, 1, 1, 0, 1},
                {1, 1, 1, 1, 1},
                {1, 0, 1, 1, 1}
        };
        int[][] result = new int[][] {
                {1, 0, 1, 0, 1},
                {0, 0, 0, 0, 0},
                {1, 0, 1, 0, 1},
                {0, 0, 0, 0, 0}
        };
        assertArrayEquals(result, MatrixTransformation.zeroefyMatrix(matrix));
    }
}

package main;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;

class MatrixTransformationTest {
    @Test
    void rotateTo90Degrees() throws Exception {
        int[][] matrix = new int[][] {
                {0, 0, 0, 0},
                {1, 1, 1, 1},
                {2, 2, 2, 2},
                {3, 3, 3, 3}
        };
        int[][] result = new int[][] {
                {3, 2, 1, 0},
                {3, 2, 1, 0},
                {3, 2, 1, 0},
                {3, 2, 1, 0}
        };
        assertArrayEquals(result, MatrixTransformation.rotateTo90Degrees(matrix));
    }

    @Test
    void zeroefyMatrix() throws Exception {
        int[][] matrix = new int[][] {
                {1, 1, 1, 1, 1},
                {1, 1, 1, 0, 1},
                {1, 1, 1, 1, 1},
                {1, 0, 1, 1, 1}
        };
        int[][] result = new int[][] {
                {1, 0, 1, 0, 1},
                {0, 0, 0, 0, 0},
                {1, 0, 1, 0, 1},
                {0, 0, 0, 0, 0}
        };
        assertArrayEquals(result, MatrixTransformation.zeroefyMatrix(matrix));
    }
}

Remove public declaration from test class.


package com.vaadin.components.gwt.polymer.client;

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

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.vaadin.components.gwt.polymer.client.element.ImportsMap;

public class Polymer {

    private static Polymer instance = new Polymer();

    private static Set<String> urlImported = new HashSet<>();

    /*
	 * Injects the correspondent html template to page head section.
	 */
    public static void ensureHTMLImport(Class<?> clazz) {
        String tagName = computeTagName(clazz);
        GWT.log(tagName);
        ensureHTMLImport(tagName);
    }

    public static void ensureHTMLImport(String tagName) {
        String href = "bower_components/" + ImportsMap.getInstance().get(tagName);
        if (!urlImported.contains(href)) {
            Element head = Document.get().getElementsByTagName("head").getItem(0);
            Element htmlImport = Document.get().createLinkElement();
            htmlImport.setAttribute("rel", "import");
            htmlImport.setAttribute("href", GWT.getModuleBaseForStaticFiles() + href);
            head.appendChild(htmlImport);
            urlImported.add(href);
        }
    }

    private static String computeTagName(Class<?> clazz) {
        return clazz.getSimpleName().replaceAll("([A-Z])", "-$1").replaceFirst("^-+", "").toLowerCase();
    }

    public static Polymer getInstance() {
        return instance;
    }

    private Polymer() {
    }
}

package com.vaadin.components.gwt.polymer.client;

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

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.vaadin.components.gwt.polymer.client.element.ImportsMap;

public abstract class Polymer {

    private static Set<String> urlImported = new HashSet<>();

    // Ensures that the tagName has been registered, otherwise injects
    // the appropriate <import> tag in the document header
    public static void ensureHTMLImport(String tagName) {
        String href = "bower_components/" + ImportsMap.getInstance().get(tagName);
        if (!urlImported.contains(href)) {
            Element link = Document.get().createLinkElement();
            link.setAttribute("rel", "import");
            link.setAttribute("href", GWT.getModuleBaseForStaticFiles() + href);
            Document.get().getHead().appendChild(link);
            urlImported.add(href);
        }
    }

}

Remove unused methods and make the class static


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

import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Scopes;
import org.weakref.jmx.guice.ExportBinder;

import static io.airlift.configuration.ConfigurationModule.bindConfig;
import static io.airlift.http.client.HttpClientBinder.httpClientBinder;

public class FailureDetectorModule
        implements Module
{
    @Override
    public void configure(Binder binder)
    {
        httpClientBinder(binder)
                .bindAsyncHttpClient("failure-detector", ForFailureDetector.class)
                .withTracing();

        bindConfig(binder).to(FailureDetectorConfig.class);

        binder.bind(HeartbeatFailureDetector.class).in(Scopes.SINGLETON);

        binder.bind(FailureDetector.class)
                .to(HeartbeatFailureDetector.class)
                .in(Scopes.SINGLETON);

        ExportBinder.newExporter(binder)
                .export(HeartbeatFailureDetector.class)
                .withGeneratedName();
    }
}

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

import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Scopes;
import org.weakref.jmx.guice.ExportBinder;

import static io.airlift.configuration.ConfigurationModule.bindConfig;
import static io.airlift.http.client.HttpClientBinder.httpClientBinder;

public class FailureDetectorModule
        implements Module
{
    @Override
    public void configure(Binder binder)
    {
        httpClientBinder(binder)
                .bindAsyncHttpClient("failure-detector", ForFailureDetector.class)
                .withPrivateIoThreadPool()
                .withTracing();

        bindConfig(binder).to(FailureDetectorConfig.class);

        binder.bind(HeartbeatFailureDetector.class).in(Scopes.SINGLETON);

        binder.bind(FailureDetector.class)
                .to(HeartbeatFailureDetector.class)
                .in(Scopes.SINGLETON);

        ExportBinder.newExporter(binder)
                .export(HeartbeatFailureDetector.class)
                .withGeneratedName();
    }
}

Use a private I/O thread pool for failure detector


package bramble.configuration;

public abstract class BrambleConfiguration {

	public static final int MASTER_PORT = 5800;
	public static final int SLAVE_PORT = 5801;
	public static final int WEB_API_SERVER_PORT = 5802;
	public static final int WEB_SERVER_PORT = 8000;
	public static final String MASTER_NODE_IP = "169.254.48.35";

	public static final String WEB_SERVER_FILE_LOCATION = "C:/Users/Tom/workspace/PicoBramble/PicoBrambleWebGUI/";

	public static final int LISTENER_DELAY_MS = 3;
	public static final int HANDSHAKE_FREQUENCY_MS = 5000;
	public static final int NODE_TIMEOUT_MS = HANDSHAKE_FREQUENCY_MS * 3;

	public static final int THREADS_PER_NODE = 5;

}

package bramble.configuration;

public abstract class BrambleConfiguration {

	public static final int MASTER_PORT = 5800;
	public static final int SLAVE_PORT = 5801;
	public static final int WEB_API_SERVER_PORT = 5802;
	public static final int WEB_SERVER_PORT = 8000;
	public static final String MASTER_NODE_IP = "169.254.48.35";

	public static final String WEB_SERVER_FILE_LOCATION = "../PicoBrambleWebGUI/";

	public static final int LISTENER_DELAY_MS = 3;
	public static final int HANDSHAKE_FREQUENCY_MS = 5000;
	public static final int NODE_TIMEOUT_MS = HANDSHAKE_FREQUENCY_MS * 3;

	public static final int THREADS_PER_NODE = 5;

}

Use relative path for web files location


package io.digdag.cli.client;

import io.digdag.cli.SystemExitException;
import io.digdag.client.DigdagClient;
import io.digdag.client.api.RestProject;
import io.digdag.client.api.RestProjectCollection;

import static io.digdag.cli.SystemExitException.systemExit;

public class ShowProjects
        extends ClientCommand
{
    @Override
    public void mainWithClientException()
            throws Exception
    {
        DigdagClient client = buildClient();

        RestProjectCollection projects = client.getProjects();
        for (RestProject proj : projects.getProjects()) {
            ln(proj.getName());
            ln("  id: " + proj.getId());
            ln("  revision: " + proj.getRevision());
            ln("  archive type: " + proj.getArchiveType());
            ln("  project created at: " + proj.getCreatedAt());
            ln("  revision updated at: " + proj.getUpdatedAt());
            ln("");
        }
        err.println("Use `" + programName + " workflows <project-name>` to show details.");
    }

    public SystemExitException usage(String error)
    {
        err.println("Usage: " + programName + " projects");
        showCommonOptions();
        return systemExit(error);
    }
}

package io.digdag.cli.client;

import io.digdag.cli.SystemExitException;
import io.digdag.cli.TimeUtil;
import io.digdag.client.DigdagClient;
import io.digdag.client.api.RestProject;
import io.digdag.client.api.RestProjectCollection;

import static io.digdag.cli.SystemExitException.systemExit;

public class ShowProjects
        extends ClientCommand
{
    @Override
    public void mainWithClientException()
            throws Exception
    {
        DigdagClient client = buildClient();

        RestProjectCollection projects = client.getProjects();
        ln("Projects");
        for (RestProject proj : projects.getProjects()) {
            ln("  name: %s", proj.getName());
            ln("  id: %s", proj.getId());
            ln("  revision: %s", proj.getRevision());
            ln("  archive type: %s", proj.getArchiveType());
            ln("  project created at: %s", TimeUtil.formatTime(proj.getCreatedAt()));
            ln("  revision updated at: %s", TimeUtil.formatTime(proj.getUpdatedAt()));
            ln("");
        }
        err.println("Use `" + programName + " workflows <project-name>` to show details.");
    }

    public SystemExitException usage(String error)
    {
        err.println("Usage: " + programName + " projects");
        showCommonOptions();
        return systemExit(error);
    }
}

Change output format like digdag sessions


package me.coley.recaf.command.impl;

import me.coley.recaf.Recaf;
import me.coley.recaf.control.Controller;
import me.coley.recaf.control.gui.GuiController;
import me.coley.recaf.control.headless.HeadlessController;
import picocli.CommandLine;

import java.io.File;

/**
 * Command line initializer for Recaf, invoked from the main method.
 *
 * @author Matt
 */
@CommandLine.Command(
		name = "Recaf",
		version = Recaf.VERSION,
		description = "Recaf: A modern java bytecode editor.",
		mixinStandardHelpOptions = true)
public class Initializer implements Runnable {
	/**
	 * Workspace file to import.
	 */
	@CommandLine.Option(names = {"--input" }, description = "The input file to load. " +
			"Supported types are: class, jar, json")
	public File input;
	@CommandLine.Option(names = {"--script" }, description = "Script file to load for cli usage")
	public File script;
	@CommandLine.Option(names = { "--cli" }, description = "Run Recaf via CLI")
	public boolean cli;

	@Override
	public void run() {
		Controller controller;
		if (cli || script != null)
			controller = new HeadlessController(input, script);
		else
			controller = new GuiController(input);
		controller.setup();
		controller.run();
	}
}

package me.coley.recaf.command.impl;

import me.coley.recaf.Recaf;
import me.coley.recaf.control.Controller;
import me.coley.recaf.control.gui.GuiController;
import me.coley.recaf.control.headless.HeadlessController;
import picocli.CommandLine;

import java.awt.*;
import java.io.File;

/**
 * Command line initializer for Recaf, invoked from the main method.
 *
 * @author Matt
 */
@CommandLine.Command(
		name = "Recaf",
		version = Recaf.VERSION,
		description = "Recaf: A modern java bytecode editor.",
		mixinStandardHelpOptions = true)
public class Initializer implements Runnable {
	/**
	 * Workspace file to import.
	 */
	@CommandLine.Option(names = {"--input" }, description = "The input file to load. " +
			"Supported types are: class, jar, json")
	public File input;
	@CommandLine.Option(names = {"--script" }, description = "Script file to load for cli usage")
	public File script;
	@CommandLine.Option(names = { "--cli" }, description = "Run Recaf via CLI")
	public boolean cli;

	@Override
	public void run() {
		Controller controller;
		if (cli || script != null || GraphicsEnvironment.isHeadless())
			controller = new HeadlessController(input, script);
		else
			controller = new GuiController(input);
		controller.setup();
		controller.run();
	}
}

Check if we are running in headless environment


package org.usfirst.frc2832.Robot_2016.HID;

import java.util.ArrayList;

public class VirtualGamepad {
	private ArrayList<GamepadState> states;
	private boolean done;

	// Millisecond timings
	long startTime, recordedOffset;
	int lastIndex = 0;

	public VirtualGamepad(ArrayList<GamepadState> states) {
		this.states = states;
	}

	public void start() {
		startTime = System.currentTimeMillis();
		recordedOffset = states.get(0).timestamp;

		done = false;
		lastIndex = 0;
	}

	public boolean isDone() {
		return (done);
	}

	public GamepadState getCurrentState() {
		long time = System.currentTimeMillis();

		// Interpolate the times, using the last recorded gamepad state.
		while (states.get(lastIndex).timestamp - recordedOffset <= time - startTime)
			lastIndex++;
		lastIndex--;

		if (lastIndex >= states.size()) {
			done = true;
			return (null);
		}

		// lastIndex now has the latest recorded data from the gamepad at this current time.
		return (states.get(lastIndex));
	}
}

package org.usfirst.frc2832.Robot_2016.HID;

import java.util.ArrayList;

public class VirtualGamepad {
	private ArrayList<GamepadState> states;
	private boolean done;

	// Millisecond timings
	long startTime, recordedOffset;
	int lastIndex = 0;

	public VirtualGamepad(ArrayList<GamepadState> states) {
		this.states = states;
	}

	public void start() {
		startTime = System.currentTimeMillis();
		recordedOffset = states.get(0).timestamp;

		done = false;
		lastIndex = 0;
	}

	public boolean isDone() {
		return (done);
	}

	public GamepadState getCurrentState() {
		long time = System.currentTimeMillis();

		// Interpolate the times, using the last recorded gamepad state.
		while (lastIndex < states.size()) {
			if (states.get(lastIndex).timestamp - recordedOffset <= time - startTime)
				lastIndex++;
		}

		if (lastIndex >= states.size()) {
			done = true;
			return (null);
		}

		// We overshot in that interpolation stage, that was the first time it "failed"
		lastIndex--;

		// lastIndex now has the latest recorded data from the gamepad at this current time.
		return (states.get(lastIndex));
	}
}

Fix issue with out of bounds array check in recordable autonomous


package de.japkit.roo.japkit.web;

import org.springframework.format.FormatterRegistrar;
import org.springframework.format.FormatterRegistry;

import de.japkit.annotations.ParamNames;
import de.japkit.metaannotations.Method;
import de.japkit.metaannotations.Template;
import de.japkit.roo.base.web.EntityConverterUtil;
import de.japkit.roo.base.web.LabelProvider;

@Template
public abstract class ControllerFormatterMembers implements FormatterRegistrar, LabelProvider<FormBackingObject> {

		@Method(imports={EntityConverterUtil.class} ,
				bodyCode="EntityConverterUtil.registerConverters(#{fbo.name}.class, registry, crudOperations(), this);")
		@ParamNames("registry")
		@Override
		public void registerFormatters(FormatterRegistry registry) {
			//EntityConverterUtil.registerConverters(FormBackingObject.class, registry, crudOperations(), this);
		}

		//TODO
		@Method(bodyCode="return \"ID: \" + entity.getId();")
		@Override
		@ParamNames("entity")
		public String getLabel(FormBackingObject entity) {
			return null;
		}

}

package de.japkit.roo.japkit.web;

import org.springframework.format.FormatterRegistrar;
import org.springframework.format.FormatterRegistry;

import de.japkit.annotations.ParamNames;
import de.japkit.metaannotations.Method;
import de.japkit.metaannotations.Template;
import de.japkit.roo.base.web.EntityConverterUtil;
import de.japkit.roo.base.web.LabelProvider;

@Template
public abstract class ControllerFormatterMembers implements FormatterRegistrar, LabelProvider<FormBackingObject> {

		@Method(imports={EntityConverterUtil.class} ,
				bodyCode="EntityConverterUtil.registerConverters(#{fbo.code}.class, registry, crudOperations(), this);")
		@ParamNames("registry")
		@Override
		public void registerFormatters(FormatterRegistry registry) {
			//EntityConverterUtil.registerConverters(FormBackingObject.class, registry, crudOperations(), this);
		}

		//TODO
		@Method(bodyCode="return \"ID: \" + entity.getId();")
		@Override
		@ParamNames("entity")
		public String getLabel(FormBackingObject entity) {
			return null;
		}

}

Use .code instead of .name for type references in code bodies


/*
 * This file is part of COMPASS. It is subject to the license terms in
 * the LICENSE file found in the top-level directory of this distribution.
 * (Also available at http://www.apache.org/licenses/LICENSE-2.0.txt)
 * You may not use this file except in compliance with the License.
 */
package de.dfki.asr.compass.test.integration;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.testng.Arquillian;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import static org.testng.Assert.assertTrue;
import org.testng.annotations.Test;

public class DeploymentDeployTest extends Arquillian {
	public static final String ARTIFACT =
			"de.dfki.asr.compass:compass-deployment:ear:?";

	@Deployment
	public static EnterpriseArchive getCoreCompassDeployment() {
		return Maven.configureResolverViaPlugin()
				.resolve(ARTIFACT)
				.withoutTransitivity()
				.asSingle(EnterpriseArchive.class);
	}

	@Test
	public void itWorked() {
		assertTrue(true);
	}
}

/*
 * This file is part of COMPASS. It is subject to the license terms in
 * the LICENSE file found in the top-level directory of this distribution.
 * (Also available at http://www.apache.org/licenses/LICENSE-2.0.txt)
 * You may not use this file except in compliance with the License.
 */
package de.dfki.asr.compass.test.integration;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.testng.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import static org.testng.Assert.assertTrue;
import org.testng.annotations.Test;

public class DeploymentDeployTest extends Arquillian {
	public static final String ARTIFACT =
			"de.dfki.asr.compass:compass-deployment:ear:?";

	@Deployment
	public static EnterpriseArchive getCoreCompassDeployment() {
		JavaArchive testWar = ShrinkWrap
				.create(JavaArchive.class)
				.addClass(DeploymentDeployTest.class);
		EnterpriseArchive compass = Maven.configureResolverViaPlugin()
				.resolve(ARTIFACT)
				.withoutTransitivity()
				.asSingle(EnterpriseArchive.class);
		compass.addAsLibrary(testWar);
		return compass;
	}

	@Test
	public void itWorked() {
		assertTrue(true);
	}
}

Add the Unit Test as a Library to the EAR prior to deployment.


import rabbit.Receiver;

public class Client {

    public static void main(String[] args) {
        Receiver receiver = new Receiver();
        receiver.startReceiving();
    }
}

import dmon.core.commons.helpers.CommandLineArgumentParser;
import dmon.core.commons.helpers.PidManipulation;
import dmon.core.commons.helpers.ProgramArguments;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import rabbit.Receiver;

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

    public static void main(String[] args) {
        MDC.put("pid", PidManipulation.getPid());
        logger.info("Scanner is started!");

        new CommandLineArgumentParser(args).parse();
        if (ProgramArguments.getPidFile() != null) {
            PidManipulation.writeOwnPidToFile(ProgramArguments.getPidFile());
        }
        else {
            PidManipulation.writeOwnPidToFile("../var/specs_monitoring_nmap_scheduler.pid");
        }

        Receiver receiver = new Receiver();
        receiver.startReceiving();

        MDC.clear();
    }
}

Add argument parser to Scheduler component.


public class BasicArithmatic
{
	private static final int constant = 10;

	public static int casualMethod()
	{
		return 1;
	}

	public static void main(String args)
	{
		int a = 4;
		int b = 2 + casualMethod();
		int sum = a + b;
		int product = a*b;
		int difference = a -b;
		int addImmediate = a + 2;
		int subImmediate = a - 2;
		//int addConstant = b * constant;
		//addConstant += 2;
		int multiplyImmediate = b * 0x05;
		int parenthesis = a + ( a + b );
		int pemdasFull = (a + b) * 3 - 10;
		int pemdasFullAlternate = a + b * (3 - 10);
		int multipleParenthis = 1 + (a + (b - 5) * 2) * 7;
		//multiplyImmediate = multiplyImmediate << 1;
		//multiplyImmediate++;
		//boolean test = true | false;

		//CasualMethod();

		//Sum(a, b);
		// DO NOT LEX
		/* Do not lex */
		/*
		 * Do not lex 2
		 */
		// /**/ Do not lex 3
		/*
		 *
		 * // */
		// Strings are currently unsupported
		// String s = "/*LexAstring" + lex + "LexAstring*/ LexAstring";
	}
}

public class BasicArithmatic
{
	private static final int constant = 10;

	public static int casualMethod()
	{
		return 1;
	}

	public static void main(String args)
	{
		int a = 4;
		int b = 2 + casualMethod();
		if (true)
		{
			b += 1;
		}
		int sum = a + b;
		int product = a*b;
		int difference = a -b;
		int addImmediate = a + 2;
		int subImmediate = a - 2;
		//int addConstant = b * constant;
		//addConstant += 2;
		int multiplyImmediate = b * 0x05;
		int parenthesis = a + ( a + b );
		int pemdasFull = (a + b) * 3 - 10;
		int pemdasFullAlternate = a + b * (3 - 10);
		int multipleParenthis = 1 + (a + (b - 5) * 2) * 7;
		//multiplyImmediate = multiplyImmediate << 1;
		//multiplyImmediate++;
		//boolean test = true | false;

		//CasualMethod();

		//Sum(a, b);
		// DO NOT LEX
		/* Do not lex */
		/*
		 * Do not lex 2
		 */
		// /**/ Do not lex 3
		/*
		 *
		 * // */
		// Strings are currently unsupported
		// String s = "/*LexAstring" + lex + "LexAstring*/ LexAstring";
	}
}

Add conditional to sample java file


package com.cadyyan.levels.utils;

import com.cadyyan.levels.Levels;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.common.FMLCommonHandler;

import java.io.File;

public class SerializationHelper
{
	private static File playerDataDirectory;

	public static void init()
	{
		MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();

		File worldDirectory = server.getEntityWorld().getSaveHandler().getWorldDirectory();
		playerDataDirectory = new File(worldDirectory, "playerData" + File.separator + Levels.MOD_ID.toLowerCase());

		if (!playerDataDirectory.mkdirs())
			LogUtility.error("Unable to create the player level directory.");
	}

	public static File getPlayerDataDirectory()
	{
		return playerDataDirectory;
	}

	private SerializationHelper()
	{
	}
}

package com.cadyyan.levels.utils;

import com.cadyyan.levels.Levels;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.common.FMLCommonHandler;

import java.io.File;

public class SerializationHelper
{
	private static File playerDataDirectory;

	public static void init()
	{
		MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();

		File worldDirectory = server.getEntityWorld().getSaveHandler().getWorldDirectory();
		playerDataDirectory = new File(worldDirectory, "playerdata" + File.separator + Levels.MOD_ID.toLowerCase());

		if (!playerDataDirectory.mkdirs())
			LogUtility.error("Unable to create the player level directory.");
	}

	public static File getPlayerDataDirectory()
	{
		return playerDataDirectory;
	}

	private SerializationHelper()
	{
	}
}

Fix spelling error in playerdata dir


package org.nwapw.abacus.plugin;

import org.nwapw.abacus.number.NumberInterface;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;

public abstract class NumberImplementation {

    private Class<? extends NumberInterface> implementation;
    private Map<String, Function<NumberInterface, NumberInterface>> promotionPaths;
    private int priority;

    public NumberImplementation(Class<? extends NumberInterface> implementation, int priority){
        this.implementation = implementation;
        this.priority = priority;
        promotionPaths = new HashMap<>();
    }

    public abstract NumberInterface instanceForString(String string);
    public abstract NumberInterface instanceForPi();

}

package org.nwapw.abacus.plugin;

import org.nwapw.abacus.number.NumberInterface;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;

public abstract class NumberImplementation {

    protected Map<Class<? extends NumberInterface>, Function<NumberInterface, NumberInterface>> promotionPaths;
    private Class<? extends NumberInterface> implementation;
    private int priority;

    public NumberImplementation(Class<? extends NumberInterface> implementation, int priority){
        this.implementation = implementation;
        this.priority = priority;
        promotionPaths = new HashMap<>();
    }

    public abstract NumberInterface instanceForString(String string);
    public abstract NumberInterface instanceForPi();

}

Make the promotion map protected and use classes.


package com.axonivy.ivy.process.element.rule.ui.cellEdit;

import org.apache.commons.lang3.math.NumberUtils;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.widgets.Text;

public class NumericValueVerifier implements VerifyListener
{
  @Override
  public void verifyText(VerifyEvent e)
  {
    e.doit = NumberUtils.isParsable(getText(e));
  }

  private String getText(VerifyEvent e)
  {
    if (e.getSource() instanceof Text)
    {
      final String old = ((Text)e.getSource()).getText();
      String current = old.substring(0, e.start) + e.text + old.substring(e.end);
      if (current.indexOf(".") == current.length()-1 || current.indexOf(",") == current.length()-1)
      { // allow one decimal separator at the end
        return current.substring(0, current.length()-1);
      }
      return current;
    }
    return e.text;
  }
}

package com.axonivy.ivy.process.element.rule.ui.cellEdit;

import org.apache.commons.lang3.math.NumberUtils;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.widgets.Text;

public class NumericValueVerifier implements VerifyListener
{
  @Override
  public void verifyText(VerifyEvent e)
  {
    e.doit = NumberUtils.isParsable(getText(e));
  }

  private String getText(VerifyEvent e)
  {
    if (e.getSource() instanceof Text)
    {
      final String old = ((Text)e.getSource()).getText();
      String current = old.substring(0, e.start) + e.text + old.substring(e.end);
      if (current.isEmpty())
      {
        return current;
      }
      if (current.indexOf(".") == current.length()-1 || current.indexOf(",") == current.length()-1)
      { // allow one decimal separator at the end
        return current.substring(0, current.length()-1);
      }
      return current;
    }
    return e.text;
  }
}

Fix IndexOutOfBoundEx for empty numeric values


package io.liveoak.container.tenancy.service;

import java.io.File;
import java.util.function.Consumer;

import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;

/**
 * @author Ken Finnigan
 */
public class ApplicationGitInstallCommitService implements Service<Void> {
    public ApplicationGitInstallCommitService(Consumer<File> gitCommit, File installDir) {
        this.gitCommit = gitCommit;
        this.installDir = installDir;
    }

    @Override
    public void start(StartContext context) throws StartException {
        this.gitCommit.accept(this.installDir);

        // remove ourselves
        context.getController().setMode(ServiceController.Mode.REMOVE);
    }

    @Override
    public void stop(StopContext context) {
    }

    @Override
    public Void getValue() throws IllegalStateException, IllegalArgumentException {
        return null;
    }

    private Consumer<File> gitCommit;
    private File installDir;
}

package io.liveoak.container.tenancy.service;

import java.io.File;
import java.util.function.Consumer;

import org.jboss.logging.Logger;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;

/**
 * @author Ken Finnigan
 */
public class ApplicationGitInstallCommitService implements Service<Void> {
    public ApplicationGitInstallCommitService(Consumer<File> gitCommit, File installDir) {
        this.gitCommit = gitCommit;
        this.installDir = installDir;
    }

    @Override
    public void start(StartContext context) throws StartException {
        try {
            this.gitCommit.accept(this.installDir);
        } catch (RuntimeException re) {
            log.error("Unable to commit to git on application install", re);
        } finally {
            // remove ourselves
            context.getController().setMode(ServiceController.Mode.REMOVE);
        }
    }

    @Override
    public void stop(StopContext context) {
    }

    @Override
    public Void getValue() throws IllegalStateException, IllegalArgumentException {
        return null;
    }

    private Consumer<File> gitCommit;
    private File installDir;
    private static final Logger log = Logger.getLogger(ApplicationGitInstallCommitService.class);
}

Improve error handling of git process to commit installation of application. Mainly of use in tests


package org.apache.geronimo.deployment.plugin.factories;

import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;

/**
 * A Geronimo-specific DeploymentManagerCreationException indicating that
 * there was a login failure.
 *
 * @version $Revision 1.0 $
 */
public class AuthenticationFailedException extends DeploymentManagerCreationException {
    public AuthenticationFailedException(String s) {
        super(s);
    }
}

/**
 *
 * Copyright 2003-2004 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.geronimo.deployment.plugin.factories;

import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;

/**
 * A Geronimo-specific DeploymentManagerCreationException indicating that
 * there was a login failure.
 *
 * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
 */
public class AuthenticationFailedException extends DeploymentManagerCreationException {
    public AuthenticationFailedException(String s) {
        super(s);
    }
}

Add license and header comment


package io.quarkus.reactive.mssql.client;

import java.net.ConnectException;
import java.sql.SQLException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import io.vertx.mssqlclient.MSSQLPool;

@Path("/dev")
public class DevModeResource {

    @Inject
    MSSQLPool client;

    @GET
    @Path("/error")
    @Produces(MediaType.TEXT_PLAIN)
    public CompletionStage<Response> getErrorMessage() throws SQLException {
        CompletableFuture<Response> future = new CompletableFuture<>();
        client.query("SELECT 1").execute(ar -> {
            Class<?> expectedExceptionClass = ConnectException.class;
            if (ar.succeeded()) {
                future.complete(Response.serverError().entity("Expected SQL query to fail").build());
            } else if (!expectedExceptionClass.isAssignableFrom(ar.cause().getClass())) {
                ar.cause().printStackTrace();
                future.complete(Response.serverError()
                        .entity("Expected " + expectedExceptionClass + ", got " + ar.cause().getClass()).build());
            } else {
                future.complete(Response.ok(ar.cause().getMessage()).build());
            }
        });
        return future;
    }
}

package io.quarkus.reactive.mssql.client;

import java.net.ConnectException;
import java.sql.SQLException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import io.vertx.mssqlclient.MSSQLPool;

@Path("/dev")
public class DevModeResource {

    @Inject
    MSSQLPool client;

    @GET
    @Path("/error")
    @Produces(MediaType.TEXT_PLAIN)
    public CompletionStage<Response> getErrorMessage() throws SQLException {
        CompletableFuture<Response> future = new CompletableFuture<>();
        client.query("SELECT 1").execute(ar -> {
            Class<?> expectedExceptionClass = ConnectException.class;
            if (ar.succeeded()) {
                future.complete(Response.serverError().entity("Expected SQL query to fail").build());
            } else if (!expectedExceptionClass.isAssignableFrom(ar.cause().getClass())) {
                future.complete(Response.serverError()
                        .entity("Expected " + expectedExceptionClass + ", got " + ar.cause().getClass()).build());
            } else {
                future.complete(Response.ok(ar.cause().getMessage()).build());
            }
        });
        return future;
    }
}

Remove redundant stacktrace from the test console


package xyz.upperlevel.uppercore.gui;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import xyz.upperlevel.uppercore.Uppercore;

public class GuiListener implements Listener {

    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent e) {
        GuiSystem.close(e.getPlayer());
    }

    @EventHandler
    public void onInventoryClose(InventoryCloseEvent e) {
        if (e.getPlayer() instanceof Player && !GuiSystem.isCalled()) {
            //Cannot call Inventory actions in an inventory event
            Bukkit.getScheduler().runTaskLater(
                    Uppercore.get(),
                    () -> GuiSystem.back((Player) e.getPlayer()),
                    0
            );
        }
    }

    @EventHandler
    public void onInventoryClick(InventoryClickEvent e) {
        if (e.getClickedInventory() == e.getInventory())
            GuiSystem.onClick(e);
        if (e.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY) {
            if (GuiSystem.getHistory((Player) e.getWhoClicked()) != null)
                e.setCancelled(true);
        }
    }
}

package xyz.upperlevel.uppercore.gui;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import xyz.upperlevel.uppercore.Uppercore;

public class GuiListener implements Listener {

    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent e) {
        GuiSystem.close(e.getPlayer());
    }

    @EventHandler
    public void onInventoryClose(InventoryCloseEvent e) {
        if (e.getPlayer() instanceof Player && !GuiSystem.isCalled()) {
            //Cannot call Inventory actions in an inventory event
            Bukkit.getScheduler().runTaskLater(
                    Uppercore.get(),
                    () -> GuiSystem.close((Player) e.getPlayer()),
                    0
            );
        }
    }

    @EventHandler
    public void onInventoryClick(InventoryClickEvent e) {
        if (e.getClickedInventory() == e.getInventory())
            GuiSystem.onClick(e);
        if (e.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY) {
            if (GuiSystem.getHistory((Player) e.getWhoClicked()) != null)
                e.setCancelled(true);
        }
    }
}

Change back to close when player closes inventyory


package org.openlmis.web.controller.vaccine.inventory;

/**
 * Created by hassan on 5/27/17.
 */
public class LogTagTemperatureController {
}

package org.openlmis.web.controller.vaccine.inventory;
import org.openlmis.core.web.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import static org.springframework.web.bind.annotation.RequestMethod.GET;

/**
 * Created by hassan on 5/27/17.
 */

@Controller
@RequestMapping(value = "/log-tag-api/")
public class LogTagTemperatureController extends BaseController {

    @RequestMapping(value="insert.json",method=GET, headers = ACCEPT_JSON)
    public String save(@RequestBody String donor, HttpServletRequest request){

      // String successResponse = String.format("Donor '%s' has been successfully saved");
        System.out.println(donor);
        System.out.println("Got the Rest API");
        return donor;
    }
}

Add log tag temperature controller