/*
 * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
 * under one or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information regarding copyright
 * ownership. Camunda licenses this file to you under the Apache License,
 * Version 2.0; 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.camunda.bpm.client.interceptor;

/**
 *
Client request interceptor makes it possible to apply changes to each request before it is sent to the http server

 *
 * @author Tassilo Weidner
 */
@FunctionalInterface
public interface ClientRequestInterceptor {

  /**
   * Has been invoked before a request is sent to the http server
   *
   * @param requestContext provides the data of the request and offers methods to change it
   */
  void intercept(ClientRequestContext requestContext);

}

/*
 * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
 * under one or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information regarding copyright
 * ownership. Camunda licenses this file to you under the Apache License,
 * Version 2.0; 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.camunda.bpm.client.interceptor;

/**
 *
Client request interceptor makes it possible to apply changes to each request before it is sent to the http server

 *
 * @author Tassilo Weidner
 */
@FunctionalInterface
public interface ClientRequestInterceptor {

  /**
   * Gets invoked before a request is sent to the http server
   *
   * @param requestContext provides the data of the request and offers methods to change it
   */
  void intercept(ClientRequestContext requestContext);

}

Improve wording in a javadoc comment


package com.orientechnologies.orient.core.sql.executor;

import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import static com.orientechnologies.orient.core.sql.executor.ExecutionPlanPrintUtils.printExecutionPlan;

/**
 * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com)
 */
public class OSleepStatementExecutionTest {
  static ODatabaseDocument db;

  @BeforeClass public static void beforeClass() {
    db = new ODatabaseDocumentTx("memory:OSleepStatementExecutionTest");
    db.create();
  }

  @AfterClass public static void afterClass() {
    db.close();
  }

  @Test public void testBegin() {
    long begin = System.currentTimeMillis();
    OTodoResultSet result = db.command("sleep 1000");
    Assert.assertTrue(System.currentTimeMillis() - begin > 1000);
    printExecutionPlan(null, result);
    Assert.assertNotNull(result);
    Assert.assertTrue(result.hasNext());
    OResult item = result.next();
    Assert.assertEquals("sleep", item.getProperty("operation"));
    Assert.assertFalse(result.hasNext());
  }

}

package com.orientechnologies.orient.core.sql.executor;

import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import static com.orientechnologies.orient.core.sql.executor.ExecutionPlanPrintUtils.printExecutionPlan;

/**
 * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com)
 */
public class OSleepStatementExecutionTest {
  static ODatabaseDocument db;

  @BeforeClass public static void beforeClass() {
    db = new ODatabaseDocumentTx("memory:OSleepStatementExecutionTest");
    db.create();
  }

  @AfterClass public static void afterClass() {
    db.close();
  }

  @Test public void testBasic() {
    long begin = System.currentTimeMillis();
    OTodoResultSet result = db.command("sleep 1000");
    Assert.assertTrue(System.currentTimeMillis() - begin >= 1000);
    printExecutionPlan(null, result);
    Assert.assertNotNull(result);
    Assert.assertTrue(result.hasNext());
    OResult item = result.next();
    Assert.assertEquals("sleep", item.getProperty("operation"));
    Assert.assertFalse(result.hasNext());
  }

}

Fix test case for SLEEP statement


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

public class UniqueKeyConstraintViolationException extends TransientStorageException{
  public UniqueKeyConstraintViolationException() {
  }

  public UniqueKeyConstraintViolationException(String message) {
    super(message);
  }

  public UniqueKeyConstraintViolationException(Throwable cause) {
    super(cause);
  }

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

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

public class UniqueKeyConstraintViolationException extends StorageException{
  public UniqueKeyConstraintViolationException() {
  }

  public UniqueKeyConstraintViolationException(String message) {
    super(message);
  }

  public UniqueKeyConstraintViolationException(Throwable cause) {
    super(cause);
  }

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

Allow disabling Users/Groups Cache on the NN side


package net.wequick.example.small;

import net.wequick.small.Small;

/**
 * Created by galen on 15/11/3.
 */
public class Application extends android.app.Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Small.setBaseUri("http://m.wequick.net/demo/");
    }
}

package net.wequick.example.small;

import net.wequick.small.Small;

/**
 * Created by galen on 15/11/3.
 */
public class Application extends android.app.Application {
    @Override
    public void onCreate() {
        super.onCreate();

        // Options
        Small.setBaseUri("http://m.wequick.net/demo/");

        // Required
        Small.preSetUp(this);
    }
}

Add Small.preSetUp to sample application


package ca.jaysoo.extradimensions;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

public class ExtraDimensionsPackage implements ReactPackage {

    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Arrays.asList();
    }

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

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();

        modules.add(new ExtraDimensionsModule(reactContext));

        return modules;
    }
}

package ca.jaysoo.extradimensions;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

public class ExtraDimensionsPackage implements ReactPackage {

    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Arrays.asList();
    }

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

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();

        modules.add(new ExtraDimensionsModule(reactContext));

        return modules;
    }
}

Add support for RN 0.55


package de.asw.courses.web2016.demo.backend.servlet.redir;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * {@code http://localhost:8080/asw2016-demo-webapp/redirect?redirect_uri=http://www.google.de }
 * @author tom
 *
 */
@WebServlet("/redirect")
public class ExternalRedirectionExampleServlet extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

		String redirectUri = req.getParameter("redirect_uri");
		resp.sendRedirect(redirectUri); // sends a 302 Temporary Redirect
	}
}

Add servlet example for external redirection


package org.gemoc.sample.tfsm.design.services;

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

import org.gemoc.gemoc_language_workbench.extensions.sirius.services.AbstractGemocAnimatorServices;

public class TFSMAnimatorServices extends AbstractGemocAnimatorServices {

	@Override
	protected List<StringCouple> getRepresentationRefreshList() {
		final List<StringCouple> res = new ArrayList<StringCouple>();

		res.add(new StringCouple("TFSM", "Animator"));

		return res;
	}

}

package org.gemoc.sample.tfsm.design.services;

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

import org.gemoc.gemoc_language_workbench.extensions.sirius.services.AbstractGemocAnimatorServices;
import org.gemoc.gemoc_modeling_workbench.ui.debug.sirius.services.AbstractGemocDebuggerServices.StringCouple;

public class TFSMAnimatorServices extends AbstractGemocAnimatorServices {

	@Override
	protected List<StringCouple> getRepresentationRefreshList() {
		final List<StringCouple> res = new ArrayList<StringCouple>();

		res.add(new StringCouple("TrafficControl","Debug"));
		res.add(new StringCouple("Semaphore","Debug"));

		res.add(new StringCouple("TrafficControl","Animation"));
		res.add(new StringCouple("Semaphore","Animation"));

		//res.add(new StringCouple("TFSM","Animator"));

		return res;
	}

}

Fix content of the map.


package internal.org.springframework.content.rest.utils;

import org.springframework.content.commons.utils.BeanUtils;

public final class DomainObjectUtils {

    private DomainObjectUtils() {}

    public static final Object getId(Object entity) {

        if (BeanUtils.hasFieldWithAnnotation(entity, javax.persistence.Id.class)) {
            return BeanUtils.getFieldWithAnnotation(entity, javax.persistence.Id.class);
        } else if (BeanUtils.hasFieldWithAnnotation(entity, org.springframework.data.annotation.Id.class)) {
            return BeanUtils.getFieldWithAnnotation(entity, org.springframework.data.annotation.Id.class);
        }

        return null;
    }
}

package internal.org.springframework.content.rest.utils;

import org.springframework.content.commons.utils.BeanUtils;

public final class DomainObjectUtils {

    private static boolean JAVAX_PERSISTENCE_ID_CLASS_PRESENT = false;

    static {
        try {
            JAVAX_PERSISTENCE_ID_CLASS_PRESENT = DomainObjectUtils.class.getClassLoader().loadClass("javax.persistence.Id") != null;
        } catch (ClassNotFoundException e) {}
    }

    private DomainObjectUtils() {}

    public static final Object getId(Object entity) {

        if (JAVAX_PERSISTENCE_ID_CLASS_PRESENT && BeanUtils.hasFieldWithAnnotation(entity, javax.persistence.Id.class)) {
            return BeanUtils.getFieldWithAnnotation(entity, javax.persistence.Id.class);
        } else if (BeanUtils.hasFieldWithAnnotation(entity, org.springframework.data.annotation.Id.class)) {
            return BeanUtils.getFieldWithAnnotation(entity, org.springframework.data.annotation.Id.class);
        }

        return null;
    }
}

Add class check before attempting to find javax.persistence.Id annotation


package org.carlspring.strongbox.storage.repository;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import java.io.Serializable;

/**
 * @author carlspring
 */
//@XmlAccessorType(XmlAccessType.FIELD)
public abstract class CustomConfiguration
        implements Serializable
{

}

package org.carlspring.strongbox.storage.repository;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import java.io.Serializable;

/**
 * @author carlspring
 */
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class CustomConfiguration
        implements Serializable
{

}

Make it possible to specify custom configuration for repositories


/*
 * Copyright 2022-2022 Asynchronous Game Query Library
 *
 * 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.ibasco.agql.protocols.valve.source.query.message;

/**
 * A special {@link SourceQueryRequest} which supports challenge based protocols
 *
 * @author Rafael Luis Ibasco
 */
abstract public class SourceQueryAuthRequest extends SourceQueryRequest {

    private Integer challenge;

    private boolean autoUpdate = true;

    protected SourceQueryAuthRequest() {
        this(null);
    }

    protected SourceQueryAuthRequest(Integer challenge) {
        this.challenge = challenge;
    }

    public Integer getChallenge() {
        return challenge;
    }

    public void setChallenge(Integer challenge) {
        this.challenge = challenge;
    }

    public boolean isAutoUpdate() {
        return autoUpdate;
    }

    public void setAutoUpdate(boolean autoUpdate) {
        this.autoUpdate = autoUpdate;
    }
}

/*
 * Copyright (c) 2022 Asynchronous Game Query Library
 *
 * 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.ibasco.agql.protocols.valve.source.query.message;

/**
 * A special {@link SourceQueryRequest} which supports challenge based protocols
 *
 * @author Rafael Luis Ibasco
 */
abstract public class SourceQueryAuthRequest extends SourceQueryRequest {

    private Integer challenge;

    private boolean autoUpdate;

    protected SourceQueryAuthRequest() {
        this(null);
    }

    protected SourceQueryAuthRequest(Integer challenge) {
        this.challenge = challenge;
        this.autoUpdate = challenge == null;
    }

    public Integer getChallenge() {
        return challenge;
    }

    public void setChallenge(Integer challenge) {
        this.challenge = challenge;
    }

    public boolean isAutoUpdate() {
        return autoUpdate;
    }

    public void setAutoUpdate(boolean autoUpdate) {
        this.autoUpdate = autoUpdate;
    }
}

Set autoUpdate to true if challenge is null


package nl.idgis.publisher.provider.database.messages;

import java.io.Serializable;

import nl.idgis.publisher.domain.service.Type;

public class DatabaseColumnInfo implements Serializable {

	private static final long serialVersionUID = 8052868017910750424L;

	private final String name;

	private final String typeName;

	public DatabaseColumnInfo(String name, String typeName) {
		this.name = name;
		this.typeName = typeName;
	}

	public String getName() {
		return name;
	}

	public String getTypeName() {
		return typeName;
	}

	public Type getType() {
		switch(typeName.toUpperCase()) {
			case "NUMBER":
			case "FLOAT":
				return Type.NUMERIC;
			case "DATE":
				return Type.DATE;
			case "VARCHAR2":
			case "NVARCHAR2":
			case "NCHAR":
			case "CHAR":
			case "CLOB":
			case "NCLOB":
				return Type.TEXT;
			case "SDO_GEOMETRY":
			case "ST_GEOMETRY":
				return Type.GEOMETRY;
		}

		return null;
	}

	@Override
	public String toString() {
		return "DatabaseColumnInfo [name=" + name + ", typeName=" + typeName + "]";
	}
}

package nl.idgis.publisher.provider.database.messages;

import java.io.Serializable;

import nl.idgis.publisher.domain.service.Type;

public class DatabaseColumnInfo implements Serializable {

	private static final long serialVersionUID = 8052868017910750424L;

	private final String name;

	private final String typeName;

	public DatabaseColumnInfo(String name, String typeName) {
		this.name = name;
		this.typeName = typeName;
	}

	public String getName() {
		return name;
	}

	public String getTypeName() {
		return typeName;
	}

	public Type getType() {
		switch(typeName.toUpperCase()) {
			case "NUMBER":
			case "FLOAT":
				return Type.NUMERIC;
			case "DATE":
			case "TIMESTAMP(6)":
				return Type.DATE;
			case "VARCHAR2":
			case "NVARCHAR2":
			case "NCHAR":
			case "CHAR":
			case "CLOB":
			case "NCLOB":
				return Type.TEXT;
			case "SDO_GEOMETRY":
			case "ST_GEOMETRY":
				return Type.GEOMETRY;
		}

		return null;
	}

	@Override
	public String toString() {
		return "DatabaseColumnInfo [name=" + name + ", typeName=" + typeName + "]";
	}
}

Add timestamp to types column info


/*
Copyright 2015 Anton Vorobyev
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 co.vorobyev.exitsign;

/**
 * Constant class collecting exit status codes.
 *
 * @author Anton Vorobyev
 * @since 0.1
 */
public final class ExitStatus {

    /**
     * Don't create instance of this class, it is constant class.
     */
    private ExitStatus() {
        throw new AssertionError();
    }

    /**
     * Exit code returned when execution finishes successfully
     */
    public static final int SUCCESS = 0;

    /**
     * Exit code returned when execution finishes successfully, synonym of SUCCESS
     */
    public static final int OK = 0;

    /**
     * Exit code returned when execution finishes failingly
     */
    public static final int FAILURE = 1;

    /**
     * Exit code returned when execution finishes failingly, synonym of FAILURE
     */
    public static final int BAD = 1;

}

/*
Copyright 2015 Anton Vorobyev
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 co.vorobyev.exitsign;

/**
 * Constant class collecting exit status codes.
 *
 * @author Anton Vorobyev
 * @since 0.1
 */
public final class ExitStatus {

    /**
     * Don't create instance of this class, it is constant class.
     */
    private ExitStatus() {
        throw new AssertionError();
    }

    /**
     * Exit code returned when execution finishes successfully
     */
    public static final int SUCCESS = 0;

    /**
     * Exit code returned when execution finishes failingly
     */
    public static final int FAILURE = 1;

}

Remove synonyms of primitive statuses


package org.kohsuke.github;

import org.junit.Assert;
import org.junit.Before;
import org.kohsuke.randname.RandomNameGenerator;

import java.io.File;

/**
 * @author Kohsuke Kawaguchi
 */
public abstract class AbstractGitHubApiTestBase extends Assert {

    protected GitHub gitHub;

    @Before
    public void setUp() throws Exception {
        File f = new File(System.getProperty("user.home"), ".github.kohsuke2");
        if (f.exists()) {
            // use the non-standard credential preferentially, so that developers of this library do not have
            // to clutter their event stream.
            gitHub = GitHubBuilder.fromPropertyFile(f.getPath()).build();
        } else {
            gitHub = GitHub.connect();
        }
    }

    protected static final RandomNameGenerator rnd = new RandomNameGenerator();
}

package org.kohsuke.github;

import org.junit.Assert;
import org.junit.Before;
import org.kohsuke.randname.RandomNameGenerator;

import java.io.File;

/**
 * @author Kohsuke Kawaguchi
 */
public abstract class AbstractGitHubApiTestBase extends Assert {

    protected GitHub gitHub;

    @Before
    public void setUp() throws Exception {
        File f = new File(System.getProperty("user.home"), ".github.kohsuke2");
        if (f.exists()) {
            // use the non-standard credential preferentially, so that developers of this library do not have
            // to clutter their event stream.
            gitHub = GitHubBuilder.fromPropertyFile(f.getPath()).withRateLimitHandler(RateLimitHandler.FAIL).build();
        } else {
            gitHub = GitHubBuilder.fromCredentials().withRateLimitHandler(RateLimitHandler.FAIL).build();
        }
    }

    protected static final RandomNameGenerator rnd = new RandomNameGenerator();
}

Use FAIL rate-limit handler for tests


/**
 * Project RSA Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Feb 25, 2014.
 */

/**
 *
 * This class is responsible for safe operations on files. This class contatin
 * the basic input/output operations.
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class IOOperations {

}

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * Project RSA Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Feb 25, 2014.
 */

/**
 *
 * This class is responsible for safe operations on files. This class contain
 * the basic input/output operations.
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class IOOperations {

    /**
     * Object to keep instance of RSA.
     */
    private RSA rsa;

    /**
     *
     * @param rsa
     */
    public IOOperations(RSA rsa) {
        this.setRsa(rsa);
    }

    /**
     * This method gets RSA instance.
     *
     * @return the RSA instance.
     */
    public RSA getRsa() {
        return rsa;
    }

    /**
     * This method reads file from given directory.
     *
     * @param filePath
     *            The directory for file.
     * @return The {@link InputStream} for read file.
     * @throws IOException
     */
    public InputStream readFile(String filePath) throws IOException {
        InputStream InputStream = null;
        File file = new File(filePath);

        if (file.exists()) {
            InputStream = new FileInputStream(file);
        }

        return InputStream;
    }

    /**
     * This method sets RSA instance.
     *
     * @param rsa
     *            The RSA to set
     */
    public void setRsa(RSA rsa) {
        this.rsa = rsa;
    }

    /**
     * This method creates output stream to write into file.
     *
     * @param filePath
     *            The directory for file location.
     * @return The {@link OutputStream} for file to write.
     * @throws FileNotFoundException
     */
    public OutputStream writeFile(String filePath) throws FileNotFoundException {
        OutputStream outputStream = null;
        File file = new File(filePath);

        if (file.exists()) {
            outputStream = new FileOutputStream(file);
        }

        return outputStream;
    }

}

Add method for read and write file


package uk.ac.ebi.atlas.dao;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import javax.inject.Inject;
import java.util.Map;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations = {"classpath:applicationContext.xml", "classpath:solrContextIT.xml", "classpath:oracleContext.xml"})
public class OrganismEnsemblDAOIT {

    @Inject
    private OrganismEnsemblDAO subject;

    @Test
    public void getOrganismEnsemblNamesMap() throws Exception {
        Map<String, String> organismEnsemblNames = subject.getEnsemblOrganismNamesMap();

        assertThat(organismEnsemblNames.get("homo sapiens"), is("ensembl"));
        assertThat(organismEnsemblNames.get("mus musculus"), is("ensembl"));
        assertThat(organismEnsemblNames.size(), is(31));
        assertThat(organismEnsemblNames.get("arabidopsis thaliana"), is("plants"));

    }

}

package uk.ac.ebi.atlas.dao;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import javax.inject.Inject;
import java.util.Map;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations = {"classpath:applicationContext.xml", "classpath:solrContextIT.xml", "classpath:oracleContext.xml"})
public class OrganismEnsemblDAOIT {

    @Inject
    private OrganismEnsemblDAO subject;

    @Test
    public void getOrganismEnsemblNamesMap() throws Exception {
        Map<String, String> organismEnsemblNames = subject.getEnsemblOrganismNamesMap();

        assertThat(organismEnsemblNames.get("homo sapiens"), is("ensembl"));
        assertThat(organismEnsemblNames.get("mus musculus"), is("ensembl"));
        assertThat(organismEnsemblNames.size(), is(33));
        assertThat(organismEnsemblNames.get("arabidopsis thaliana"), is("plants"));

    }

}

Modify test to pass with two new DB rows


package org.wildfly.swarm.it.transactions;

import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver;
import org.wildfly.swarm.it.AbstractIntegrationTest;

import static org.fest.assertions.Assertions.assertThat;

/**
 * @author Bob McWhirter
 */
@RunWith(Arquillian.class)
public class TransactionsApplicationIT extends AbstractIntegrationTest {

    @Drone
    WebDriver browser;

    @Test
    public void testActive() {
        browser.navigate().to("http://localhost:8080/");
        assertThat(browser.getPageSource()).contains("Active");
    }

    @Test
    public void testBeginCommit() {
        browser.navigate().to("http://localhost:8080/begincommit");
        assertThat(browser.getPageSource()).contains("Transaction begun ok and committed ok" );
    }

    @Test
    public void testBeginRollback() {
        browser.navigate().to("http://localhost:8080/beginrollback");
        assertThat(browser.getPageSource()).contains("Transaction begun ok and rolled back ok" );
    }
}

package org.wildfly.swarm.it.transactions;

import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver;
import org.wildfly.swarm.it.AbstractIntegrationTest;

import static org.fest.assertions.Assertions.assertThat;

/**
 * @author Bob McWhirter
 * @author Ken Finnigan
 */
@RunWith(Arquillian.class)
public class TransactionsApplicationIT extends AbstractIntegrationTest {

    @Drone
    WebDriver browser;

    @Test
    public void testTransactions() {
        browser.navigate().to("http://localhost:8080/");
        assertThat(browser.getPageSource()).contains("Active");

        browser.navigate().to("http://localhost:8080/begincommit");
        assertThat(browser.getPageSource()).contains("Transaction begun ok and committed ok" );

        browser.navigate().to("http://localhost:8080/beginrollback");
        assertThat(browser.getPageSource()).contains("Transaction begun ok and rolled back ok" );
    }
}

Modify Transactions tests into a single ordered test, as ordering of separate test methods is unpredictable


public class Fibonacci {
    private static final int MAX_TERM_VALUE = 10000;

    public static void main(String[] args) {
        System.out.println("This program lists the Fibonacci sequence.");

        int prevTerm = 0;
        int term = 0;

        while (term < MAX_TERM_VALUE) {
            System.out.println(term);

            if (term == 0) {
                term++;

            } else {
                term = prevTerm + term;
                prevTerm = term - prevTerm;
            }
        }
    }
}

public class Fibonacci {
    private static final int MAX_TERM_VALUE = 10000;

    public static void main(String[] args) {
        System.out.println("This program lists the Fibonacci sequence.");

        int term1 = 0;
        int term2 = 1;

        while (term1 < MAX_TERM_VALUE) {
            System.out.println(term1);

            term2 = term1 + term2;
            term1 = term2 - term1;
        }
    }
}

Refactor section assigment 2 problem 1


/**
 *
OData JPA Processor API Library - Mapping Model

 * The JPA EDM Mapping model (XML document) is represented as JAXB annotated Java Classes.
 *
 * @author SAP AG
 */
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.sap.com/core/odata/processor/api/jpa/model/mapping", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package com.sap.core.odata.processor.api.jpa.model.mapping;

Package Info for Mapping Model


/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2012, Red Hat, Inc., and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * 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.jboss.as.test.integration.sar.injection.pojos;

/**
 * @author Richard Opalka
 */
interface AMBean {

    int getCount();

    boolean getStartCalled();

    boolean getCreateCalled();

}

/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2012, Red Hat, Inc., and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * 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.jboss.as.test.integration.sar.injection.pojos;

/**
 * @author Richard Opalka
 */
public interface AMBean {

    int getCount();

    boolean getStartCalled();

    boolean getCreateCalled();

}

Fix Mbean interface must be public, fails validation on JDK8


/**
 * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.web.server.push.analytics.formatting;

import com.opengamma.core.historicaltimeseries.HistoricalTimeSeries;
import com.opengamma.engine.value.ValueSpecification;

/**
 *
 */
/* package */ class HistoricalTimeSeriesFormatter extends AbstractFormatter<HistoricalTimeSeries> {

  private final LocalDateDoubleTimeSeriesFormatter _delegate = new LocalDateDoubleTimeSeriesFormatter();

  /* package */ HistoricalTimeSeriesFormatter() {
    super(HistoricalTimeSeries.class);
  }

  @Override
  public Object formatCell(HistoricalTimeSeries value, ValueSpecification valueSpec) {
    return _delegate.formatCell(value.getTimeSeries(), valueSpec);
  }

  @Override
  public Object format(HistoricalTimeSeries value, ValueSpecification valueSpec, Format format) {
    return super.format(value, valueSpec, format);
  }

  @Override
  public DataType getDataType() {
    return DataType.TIME_SERIES;
  }
}

/**
 * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.web.server.push.analytics.formatting;

import com.opengamma.core.historicaltimeseries.HistoricalTimeSeries;
import com.opengamma.engine.value.ValueSpecification;

/**
 *
 */
/* package */ class HistoricalTimeSeriesFormatter extends AbstractFormatter<HistoricalTimeSeries> {

  private final LocalDateDoubleTimeSeriesFormatter _delegate = new LocalDateDoubleTimeSeriesFormatter();

  /* package */ HistoricalTimeSeriesFormatter() {
    super(HistoricalTimeSeries.class);
  }

  @Override
  public Object formatCell(HistoricalTimeSeries value, ValueSpecification valueSpec) {
    return _delegate.formatCell(value.getTimeSeries(), valueSpec);
  }

  @Override
  public Object format(HistoricalTimeSeries value, ValueSpecification valueSpec, Format format) {
    return _delegate.format(value.getTimeSeries(), valueSpec, format);
  }

  @Override
  public DataType getDataType() {
    return DataType.TIME_SERIES;
  }
}

Tweak to time series formatting


package com.orientechnologies.orient.core.storage.impl.local;

import com.orientechnologies.common.concur.lock.OInterruptedException;
import com.orientechnologies.common.log.OLogManager;

public class OStorageInterruptionManager {

  private int depth = 0;
  private boolean interrupted = false;

  protected void interrupt(Thread thread) {
    synchronized (this) {
      if (depth <= 0) {
        interrupted = true;
      } else if (thread != null) {
        thread.interrupt();
      }
    }
  }

  protected void enterCriticalPath() {
    synchronized (this) {
      if (Thread.currentThread().isInterrupted() || (interrupted && depth == 0)) {
        final Thread thread = Thread.currentThread();
        //        thread.interrupt();
        OLogManager.instance().warnNoDb(this, "Execution  of thread '%s' is interrupted", thread);
        throw new OInterruptedException("Command interrupted");
      }
      this.depth++;
    }
  }

  protected void exitCriticalPath() {
    synchronized (this) {
      this.depth--;
      if (interrupted && depth == 0) {
        final Thread thread = Thread.currentThread();
        //        thread.interrupt();
        OLogManager.instance().warnNoDb(this, "Execution  of thread '%s' is interrupted", thread);
        throw new OInterruptedException("Command interrupted");
      }
    }
  }
}

package com.orientechnologies.orient.core.storage.impl.local;

import com.orientechnologies.common.concur.lock.OInterruptedException;
import com.orientechnologies.common.log.OLogManager;

public class OStorageInterruptionManager {

  private int depth = 0;
  private boolean interrupted = false;

  protected void interrupt(Thread thread) {
    synchronized (this) {
      if (depth <= 0) {
        interrupted = true;
      } else if (thread != null) {
        thread.interrupt();
      }
    }
  }

  public void enterCriticalPath() {
    synchronized (this) {
      if (Thread.currentThread().isInterrupted() || (interrupted && depth == 0)) {
        final Thread thread = Thread.currentThread();
        //        thread.interrupt();
        OLogManager.instance().warnNoDb(this, "Execution  of thread '%s' is interrupted", thread);
        throw new OInterruptedException("Command interrupted");
      }
      this.depth++;
    }
  }

  public void exitCriticalPath() {
    synchronized (this) {
      this.depth--;
      if (interrupted && depth == 0) {
        final Thread thread = Thread.currentThread();
        //        thread.interrupt();
        OLogManager.instance().warnNoDb(this, "Execution  of thread '%s' is interrupted", thread);
        throw new OInterruptedException("Command interrupted");
      }
    }
  }
}

Change visibility of storage interruption manager


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

import javax.swing.JMenuBar;

public class MenuBar extends JMenuBar {

	private static final long serialVersionUID = 5179328504511930019L;

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

	private void addMenus() {
		super.add(new FileMenu());
	}
}

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

import javax.swing.JMenuBar;

public class MenuBar extends JMenuBar {

	private static final long serialVersionUID = 5179328504511930019L;

	private FileMenu fileMenu;
	private DocumentMenu documentMenu;

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

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

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

Add document menu to menu bar.


/*
 * Copyright (C) 2014 Pedro Vicente Gómez Sánchez.
 *
 * 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.github.pedrovgs.app.problem11;

/**
 * Given a integer, can you write a method to transform a given integer to String? Take into
 * account
 * you can receive negative integers.
 *
 * @author Pedro Vicente Gómez Sánchez.
 */
public class IntToString {

  public String transform(int number) {
    return null;
  }

}

/*
 * Copyright (C) 2014 Pedro Vicente Gómez Sánchez.
 *
 * 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.github.pedrovgs.app.problem11;

/**
 * Given a integer, can you write a method to transform a given integer to String? Take into
 * account
 * you can receive negative integers.
 *
 * @author Pedro Vicente Gómez Sánchez.
 */
public class IntToString {

  /**
   * Algorithm implementation based on the module of a given number and iterate until the number is
   * zero. With this approach we get a complexity order equals to O(N) in time terms where N is the
   * number of digits in the given integer. In space terms, the complexity order is also O(N)
   * because we are using an StringBuilder as auxiliary data structure.
   */
  public String transform(int number) {
    boolean isNegative = false;
    StringBuilder sb = new StringBuilder();
    if (number == 0) {
      return "0";
    } else if (number < 0) {
      isNegative = true;
    }
    number = Math.abs(number);

    while (number > 0) {
      sb.append(number % 10);
      number /= 10;
    }

    if (isNegative) {
      sb.append("-");
    }

    return sb.reverse().toString();
  }
}

Add implementation to problem 11


/*
 * Mutability Detector
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 *
 * Further licensing information for this project can be found in
 * 		license/LICENSE.txt
 */

package org.mutabilitydetector.unittesting.assertionbenchmarks;

import java.math.BigDecimal;

import org.mutabilitydetector.cli.CommandLineOptions;
import org.mutabilitydetector.cli.RunMutabilityDetector;
import org.mutabilitydetector.repackaged.com.google.classpath.ClassPath;
import org.mutabilitydetector.repackaged.com.google.classpath.ClassPathFactory;

public class CheckSomeClass {

	public static void main(String[] args) {
		//checkClass(TestIllegalFieldValueException.class);
//		checkClass(DurationField.class);
		checkClass(BigDecimal.class);
	}

	private static void checkClass(Class<?> toAnalyse) {
		ClassPath cp = new ClassPathFactory().createFromJVM();
		String match = toAnalyse.getName().replace("$", "\\$");
		CommandLineOptions options = new CommandLineOptions(System.out, "-v", "-match", match);
		new RunMutabilityDetector(cp, options).run();
	}

}

/*
 * Mutability Detector
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 *
 * Further licensing information for this project can be found in
 * 		license/LICENSE.txt
 */

package org.mutabilitydetector.unittesting.assertionbenchmarks;

import java.math.BigDecimal;

import org.mutabilitydetector.cli.CommandLineOptions;
import org.mutabilitydetector.cli.NamesFromClassResources;
import org.mutabilitydetector.cli.RunMutabilityDetector;
import org.mutabilitydetector.repackaged.com.google.classpath.ClassPath;
import org.mutabilitydetector.repackaged.com.google.classpath.ClassPathFactory;

public class CheckSomeClass {

	public static void main(String[] args) {
		//checkClass(TestIllegalFieldValueException.class);
//		checkClass(DurationField.class);
		checkClass(BigDecimal.class);
	}

	private static void checkClass(Class<?> toAnalyse) {
		ClassPath cp = new ClassPathFactory().createFromJVM();
		String match = toAnalyse.getName().replace("$", "\\$");
		CommandLineOptions options = new CommandLineOptions(System.out, "-v", "-match", match);
		new RunMutabilityDetector(cp, options, new NamesFromClassResources(options.match())).run();
	}

}

Update client to account for change in signature.


/*
 * #%L
 * wcm.io
 * %%
 * Copyright (C) 2014 wcm.io
 * %%
 * 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.
 * #L%
 */
/**
 * Miscellaneous helper classes.
 */
@org.osgi.annotation.versioning.Version("0.5.0")
package io.wcm.sling.commons.util;

/*
 * #%L
 * wcm.io
 * %%
 * Copyright (C) 2014 wcm.io
 * %%
 * 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.
 * #L%
 */
/**
 * Miscellaneous helper classes.
 */
@org.osgi.annotation.versioning.Version("0.6.0")
package io.wcm.sling.commons.util;

Add Escape.jcrQueryLiteral and Escape.jcrQueryContainsExpr methods.


/*
 * Copyright 2015-2016 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v10.html
 */

package extensions;

import org.junit.gen5.api.Assertions;
import org.junit.gen5.api.extension.AfterEachExtensionPoint;
import org.junit.gen5.api.extension.ExceptionHandlerExtensionPoint;
import org.junit.gen5.api.extension.ExtensionContext.Namespace;
import org.junit.gen5.api.extension.ExtensionContext.Store;
import org.junit.gen5.api.extension.TestExtensionContext;
import org.opentest4j.AssertionFailedError;

public class ExpectToFailExtension implements ExceptionHandlerExtensionPoint, AfterEachExtensionPoint {

	@Override
	public void handleException(TestExtensionContext context, Throwable throwable) throws Throwable {
		if (throwable instanceof AssertionFailedError) {
			getExceptionStore(context).put("exception", throwable);
			return;
		}
		throw throwable;
	}

	private Store getExceptionStore(TestExtensionContext context) {
		return context.getStore(Namespace.of(context));
	}

	@Override
	public void afterEach(TestExtensionContext context) throws Exception {
		if (getExceptionStore(context).get("exception") == null)
			Assertions.fail("Test should have failed");
	}
}

/*
 * Copyright 2015-2016 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v10.html
 */

package extensions;

import static org.junit.gen5.api.Assertions.assertNotNull;

import org.junit.gen5.api.extension.AfterEachExtensionPoint;
import org.junit.gen5.api.extension.ExceptionHandlerExtensionPoint;
import org.junit.gen5.api.extension.ExtensionContext.Namespace;
import org.junit.gen5.api.extension.ExtensionContext.Store;
import org.junit.gen5.api.extension.TestExtensionContext;
import org.opentest4j.AssertionFailedError;

public class ExpectToFailExtension implements ExceptionHandlerExtensionPoint, AfterEachExtensionPoint {

	@Override
	public void handleException(TestExtensionContext context, Throwable throwable) throws Throwable {
		if (throwable instanceof AssertionFailedError) {
			getExceptionStore(context).put("exception", throwable);
			return;
		}
		throw throwable;
	}

	@Override
	public void afterEach(TestExtensionContext context) throws Exception {
		assertNotNull(getExceptionStore(context).get("exception"), "Test should have failed");
	}

	private Store getExceptionStore(TestExtensionContext context) {
		return context.getStore(Namespace.of(context));
	}
}

Use assertNotNull instead of `if`


package devopsdistilled.operp.server.data.repo.items.custom.impl;

import javax.inject.Inject;

import devopsdistilled.operp.server.data.repo.items.ProductRepository;
import devopsdistilled.operp.server.data.repo.items.custom.ProductRepositoryCustom;

public class ProductRepositoryCustomImpl implements ProductRepositoryCustom {
	@Inject
	private ProductRepository repo;

}

package devopsdistilled.operp.server.data.repo.items.custom.impl;

import devopsdistilled.operp.server.data.repo.items.custom.ProductRepositoryCustom;

public class ProductRepositoryCustomImpl implements ProductRepositoryCustom {

}

Remove warning message by removing unused field


//
// TrueRandom.java -- Java class TrueRandom
// Project OrcSites
//
// Copyright (c) 2009 The University of Texas at Austin. All rights reserved.
//
// Use and redistribution of this file is governed by the license terms in
// the LICENSE file found in the project's top-level directory and also found at
// URL: http://orc.csres.utexas.edu/license.shtml .
//

package orc.lib.net;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import orc.error.runtime.JavaException;
import orc.error.runtime.TokenException;
import orc.values.sites.compatibility.Args;
import orc.values.sites.compatibility.EvalSite;

public class TrueRandom extends EvalSite {
    private static String baseURL = "http://www.random.org/integers/?num=1&col=1&base=10&format=plain&rnd=new";

    @Override
    public Object evaluate(final Args args) throws TokenException {
        try {
            final String number = HTTPUtils.getURL(new URL(baseURL + "&min=" + args.longArg(0) + "&max=" + (args.longArg(1) - 1)));
            return new Long(number.trim());
        } catch (final MalformedURLException e) {
            throw new JavaException(e);
        } catch (final IOException e) {
            throw new JavaException(e);
        }
    }
}

//
// TrueRandom.java -- Java class TrueRandom
// Project OrcSites
//
// Copyright (c) 2009 The University of Texas at Austin. All rights reserved.
//
// Use and redistribution of this file is governed by the license terms in
// the LICENSE file found in the project's top-level directory and also found at
// URL: http://orc.csres.utexas.edu/license.shtml .
//

package orc.lib.net;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import orc.error.runtime.JavaException;
import orc.error.runtime.TokenException;
import orc.values.sites.compatibility.Args;
import orc.values.sites.compatibility.EvalSite;

public class TrueRandom extends EvalSite {
	private static String baseURL = "https://www.random.org/integers/?num=1&col=1&base=10&format=plain&rnd=new";

    @Override
    public Object evaluate(final Args args) throws TokenException {
        try {
            final String number = HTTPUtils.getURL(new URL(baseURL + "&min=" + args.longArg(0) + "&max=" + (args.longArg(1) - 1)));
            return new Long(number.trim());
        } catch (final MalformedURLException e) {
            throw new JavaException(e);
        } catch (final IOException e) {
            throw new JavaException(e);
        }
    }
}

Fix URL to be HTTPS.


/*
 * -\-\-
 * Spotify Apollo okhttp Client Module
 * --
 * Copyright (C) 2013 - 2015 Spotify AB
 * --
 * 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.spotify.apollo.http.client;

import org.mockserver.mock.action.ExpectationCallback;
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;

public class SleepCallback implements ExpectationCallback {

  @Override
  public HttpResponse handle(final HttpRequest httpRequest) {
    try {
      Thread.sleep(2000);
    } catch (InterruptedException e) {
      return HttpResponse.response().withStatusCode(500);
    }
    return HttpResponse.response().withStatusCode(200);
  }
}

Fix needed trailing spaces in the license


/*******************************************************************************
 * Copyright (c) 2010 Oak Ridge National Laboratory.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 ******************************************************************************/
package org.csstudio.display.pvtable.ui;

import org.csstudio.display.pvtable.model.PVTableItem;
import org.eclipse.jface.viewers.CellLabelProvider;

/** Cell label provider for PV Table that handles the tool tip
 *  @author Kay Kasemir
 */
abstract public class PVTableCellLabelProvider extends CellLabelProvider
{
    private static final int TOOL_TIP_MAX = 100;

    @Override
    public String getToolTipText(final Object element)
    {
        final PVTableItem item = (PVTableItem) element;
        final String text = item.toString();
        // Limit size of tool tip (in case of array data)
        if (text.length() > TOOL_TIP_MAX)
            return text.substring(0, TOOL_TIP_MAX) + "...";
        return text;
    }
}

/*******************************************************************************
 * Copyright (c) 2010 Oak Ridge National Laboratory.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 ******************************************************************************/
package org.csstudio.display.pvtable.ui;

import org.csstudio.display.pvtable.model.PVTableItem;
import org.eclipse.jface.viewers.CellLabelProvider;

/** Cell label provider for PV Table that handles the tool tip
 *  @author Kay Kasemir
 */
abstract public class PVTableCellLabelProvider extends CellLabelProvider
{
    private static final int TOOL_TIP_MAX = 100;

    @Override
    public String getToolTipText(final Object element)
    {
        final PVTableItem item = (PVTableItem) element;
        if (item == PVTableModelContentProvider.NEW_ITEM)
            return "Add new PV to table by adding its name";
        final String text = item.toString();
        // Limit size of tool tip (in case of array data)
        if (text.length() > TOOL_TIP_MAX)
            return text.substring(0, TOOL_TIP_MAX) + "...";
        return text;
    }
}

Fix tool tip of last row


/*
 * Copyright 2014 Open mHealth
 *
 * 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.openmhealth.dsu.configuration;

/**
 * An interface containing shared properties for OAuth2 configurations.
 *
 * @author Emerson Farrugia
 */
public interface OAuth2Properties {

    String CLIENT_ROLE = "ROLE_CLIENT";
    String END_USER_ROLE = "ROLE_END_USER";
    String DATA_POINT_RESOURCE_ID = "dataPoints";
    String DATA_POINT_READ_SCOPE = "read_data_points";
    String DATA_POINT_WRITE_SCOPE = "write_data_points";
    String DATA_POINT_DELETE_SCOPE = "delete_data_points";
}

/*
 * Copyright 2014 Open mHealth
 *
 * 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.openmhealth.dsu.configuration;

/**
 * An interface containing shared properties for OAuth2 configurations.
 *
 * @author Emerson Farrugia
 */
public interface OAuth2Properties {

    String CLIENT_ROLE = "ROLE_CLIENT";
    String END_USER_ROLE = "ROLE_END_USER";
    String DATA_POINT_RESOURCE_ID = "dataPoint";
    String DATA_POINT_READ_SCOPE = "read_data_points";
    String DATA_POINT_WRITE_SCOPE = "write_data_points";
    String DATA_POINT_DELETE_SCOPE = "delete_data_points";
}

Use old resource ID, so it's backward compatible with existing tokens.


/*
 * Copyright 2014 A.C.R. Development
 */
package acr.browser.lightning;

public class SettingsController {

	static boolean clearHistory = false;

	/**
	 * The purpose of this class is so that I can clear the dropdown history in the main activities if the user selects
	 * to clear the history from the disk in advanced settings
	 */
	static void setClearHistory(boolean choice) {
		clearHistory = choice;
	}

	/**
	 * return the choice
	 */
	static boolean getClearHistory() {
		if (clearHistory) {
			clearHistory = false;
			return true;
		}
		return clearHistory;
	}
}

/*
 * Copyright 2014 A.C.R. Development
 */
package acr.browser.lightning;

public class SettingsController {

	private static boolean clearHistory;

	/**
	 * The purpose of this class is so that I can clear the dropdown history in the main activities if the user selects
	 * to clear the history from the disk in advanced settings
	 */
	public static void setClearHistory(boolean choice) {
		clearHistory = choice;
	}

	/**
	 * return the choice
	 */
	public static boolean getClearHistory() {
		if (clearHistory) {
			clearHistory = false;
			return true;
		}
		return false;
	}
}

Add missing 'private' and 'public' access' modifiers, fix warnings


package io.tracee.contextlogger.jaxws.container;

/**
 * This class is not directly used but exists for the users convenience
 * (Like adding @HandlerChain(xmlFile=TraceeContextLoggerJaxwsConstants.TRACEE_WITH_ERROR_LOGGING_HANDLER_CHAIN_URL)
 */
@SuppressWarnings("UnusedDeclaration")
public final class TraceeContextLoggerJaxwsConstants {

	private TraceeContextLoggerJaxwsConstants() { }

	public static final String TRACEE_WITH_ERROR_LOGGING_HANDLER_CHAIN_URL =
			"/src/main/resources/io/tracee/contextlogger/jaxws/TraceeWithErrorLoggingHandlerChain.xml";

}

package io.tracee.contextlogger.jaxws.container;

/**
 * This class is not directly used but exists for the users convenience
 * (Like adding @HandlerChain(xmlFile=TraceeContextLoggerJaxwsConstants.TRACEE_WITH_ERROR_LOGGING_HANDLER_CHAIN_URL)
 */
@SuppressWarnings("UnusedDeclaration")
public final class TraceeContextLoggerJaxwsConstants {

	private TraceeContextLoggerJaxwsConstants() { }

	public static final String TRACEE_WITH_ERROR_LOGGING_HANDLER_CHAIN_URL =
			"/io/tracee/contextlogger/jaxws/TraceeWithErrorLoggingHandlerChain.xml";

}

Adjust path: If the file is assembled with the xml file into a jar file, the project structure is discarded.


/**
 *
 */
package jp.ac.nii.prl.mape.monitoring.service;

import org.springframework.stereotype.Service;

import jp.ac.nii.prl.mape.monitoring.model.Instance;

@Service("instanceService")
public class InstanceServiceImpl implements InstanceService {

	/* (non-Javadoc)
	 * @see jp.ac.nii.prl.mape.monitoring.service.InstanceService#fromAWS(com.amazonaws.services.ec2.model.Instance)
	 */
	@Override
	public Instance fromAWS(com.amazonaws.services.ec2.model.Instance aws) {
		Instance instance = new Instance();
		instance.setAmi(aws.getImageId());
		instance.setInstID(aws.getInstanceId());
		instance.setInstStatus(0);
		instance.setInstType(aws.getInstanceType());
		instance.setSecurityGroupRef(aws.getSecurityGroups().iterator().next().getGroupId());
		instance.setState(aws.getState().getCode());
		return instance;
	}

}

/**
 *
 */
package jp.ac.nii.prl.mape.monitoring.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import jp.ac.nii.prl.mape.monitoring.model.Instance;

@Service("instanceService")
public class InstanceServiceImpl implements InstanceService {

	private final CloudWatchService cwService;

	@Autowired
	public InstanceServiceImpl(CloudWatchService cwService) {
		this.cwService = cwService;
	}

	/* (non-Javadoc)
	 * @see jp.ac.nii.prl.mape.monitoring.service.InstanceService#fromAWS(com.amazonaws.services.ec2.model.Instance)
	 */
	@Override
	public Instance fromAWS(com.amazonaws.services.ec2.model.Instance aws) {
		Instance instance = new Instance();
		instance.setAmi(aws.getImageId());
		instance.setInstID(aws.getInstanceId());
		instance.setInstStatus(0);
		instance.setInstType(aws.getInstanceType());
		instance.setSecurityGroupRef(aws.getSecurityGroups().iterator().next().getGroupId());
		instance.setState(aws.getState().getCode());
		instance.setLoad(cwService.getLoad(instance.getInstID()));
		return instance;
	}

}

Include instance load in instance creation


package com.yammer.tenacity.testing;

import com.netflix.config.ConfigurationManager;
import com.netflix.hystrix.Hystrix;
import com.netflix.hystrix.contrib.yammermetricspublisher.HystrixYammerMetricsPublisher;
import com.netflix.hystrix.strategy.HystrixPlugins;
import org.junit.After;

import java.util.concurrent.TimeUnit;

public abstract class TenacityTest {
    static {
        initialization();
    }

    private static void initialization() {
        HystrixPlugins.getInstance().registerMetricsPublisher(new HystrixYammerMetricsPublisher());
        ConfigurationManager
                .getConfigInstance()
                .setProperty("hystrix.command.default.metrics.healthSnapshot.intervalInMilliseconds", "1");
    }

    @After
    public void testTeardown() {
        Hystrix.reset(1, TimeUnit.SECONDS);
    }
}

package com.yammer.tenacity.testing;

import com.netflix.config.ConfigurationManager;
import com.netflix.hystrix.Hystrix;
import com.netflix.hystrix.contrib.yammermetricspublisher.HystrixYammerMetricsPublisher;
import com.netflix.hystrix.strategy.HystrixPlugins;
import org.junit.After;
import org.junit.Before;

import java.util.concurrent.TimeUnit;

public abstract class TenacityTest {
    static {
        HystrixPlugins.getInstance().registerMetricsPublisher(new HystrixYammerMetricsPublisher());
    }

    @Before
    public void testInitialization() {
        ConfigurationManager
                .getConfigInstance()
                .setProperty("hystrix.command.default.metrics.healthSnapshot.intervalInMilliseconds", "1");
    }

    @After
    public void testTeardown() {
        Hystrix.reset(1, TimeUnit.SECONDS);
        ConfigurationManager.getConfigInstance().clear();
    }
}

Reset the ConfigurationManager when testing Tenacity


package net.daverix.slingerorm.sample;

import android.provider.BaseColumns;
import net.daverix.slingerorm.annotation.DatabaseEntity;
import net.daverix.slingerorm.annotation.FieldName;
import net.daverix.slingerorm.annotation.GetField;
import net.daverix.slingerorm.annotation.SetField;

/**
 * Created by daverix on 2/2/14.
 */
@DatabaseEntity
public abstract class AbstractComplexEntity {
    @FieldName(BaseColumns._ID) private long _id;

    @GetField("_id")
    public long getId() {
        return _id;
    }

    @SetField("_id")
    public void setId(long id) {
        _id = id;
    }

}

package net.daverix.slingerorm.sample;

import net.daverix.slingerorm.annotation.DatabaseEntity;
import net.daverix.slingerorm.annotation.FieldName;
import net.daverix.slingerorm.annotation.GetField;
import net.daverix.slingerorm.annotation.SetField;

/**
 * Created by daverix on 2/2/14.
 */
@DatabaseEntity
public abstract class AbstractComplexEntity {
    @FieldName("_Id") private long _id;

    @GetField("_id")
    public long getId() {
        return _id;
    }

    @SetField("_id")
    public void setId(long id) {
        _id = id;
    }

}

Change name on id to see that it generates correct


package day01;

import common.BaseSolution;
import common.InputReader;

public class Solution extends BaseSolution implements common.Solution {

    public static void main(String[] args) {
        new Solution().run();
    }

    class BaseFuelCalculator {
        public int calculateFuel() {
            int mass, totalFuel = 0;
            InputReader reader = getInputReader();
            String line = reader.next();
            while (line != null) {
                mass = Integer.parseInt(line);
                totalFuel += getFuel(mass);
                line = reader.next();
            }
            return totalFuel;
        }

        protected int getFuelForMass(int mass) {
            return mass / 3 - 2;
        }

        protected int getFuel(int mass) {
            return 0;
        }
    }

    class Part1FuelCalculator extends BaseFuelCalculator {
        protected int getFuel(int mass) {
            return getFuelForMass(mass);
        }
    }

    class Part2FuelCalculator extends BaseFuelCalculator {
        protected int getFuel(int mass) {
            int fuel = 0;
            int fuelPiece = mass;
            do {
                fuelPiece = getFuelForMass(fuelPiece);
                if (fuelPiece > 0) {
                    fuel += fuelPiece;
                }
            } while (fuelPiece > 0);
            return fuel;
        }
    }

    public String part1() {
        return String.valueOf(new Part1FuelCalculator().calculateFuel());
    }

    public String part2() {
        return String.valueOf(new Part2FuelCalculator().calculateFuel());
    }
}

package day01;

import common.BaseSolution;
import common.InputReader;

public class Solution extends BaseSolution implements common.Solution {

    public static void main(String[] args) {
        new Solution().run();
    }

    class BaseFuelCalculator {
        public int calculateFuel() {
            int mass, totalFuel = 0;
            InputReader reader = getInputReader();
            String line = reader.next();
            while (line != null) {
                mass = Integer.parseInt(line);
                totalFuel += getFuel(mass);
                line = reader.next();
            }
            return totalFuel;
        }

        protected int getFuelForMass(int mass) {
            return mass / 3 - 2;
        }

        protected int getFuel(int mass) {
            return 0;
        }
    }

    class Part1FuelCalculator extends BaseFuelCalculator {
        protected int getFuel(int mass) {
            return getFuelForMass(mass);
        }
    }

    class Part2FuelCalculator extends BaseFuelCalculator {
        protected int getFuel(int mass) {
            int fuel = 0;
            int fuelPiece = getFuelForMass(mass);
            while (fuelPiece > 0) {
                fuel += fuelPiece;
                fuelPiece = getFuelForMass(fuelPiece);
            }
            return fuel;
        }
    }

    public String part1() {
        return String.valueOf(new Part1FuelCalculator().calculateFuel());
    }

    public String part2() {
        return String.valueOf(new Part2FuelCalculator().calculateFuel());
    }
}

Simplify existing day 1 loop


/**
 * Copyright 2016-2017 Sixt GmbH & Co. Autovermietung KG
 * 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.sixt.service.framework.kafka.messaging;

import com.google.inject.Inject;
import com.sixt.service.framework.ServiceProperties;
import org.apache.kafka.clients.CommonClientConfigs;

import java.util.Properties;

public class ProducerFactory {

    private final ServiceProperties serviceProperties;

    @Inject
    public ProducerFactory(ServiceProperties serviceProperties) {
        this.serviceProperties = serviceProperties;
    }

    public Producer createProducer() {
        String kafkaBootstrapServers = serviceProperties.getKafkaServer();

        Properties kafkaProducerConfig = new Properties();
        kafkaProducerConfig.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, kafkaBootstrapServers);

        return new Producer(kafkaProducerConfig);
    }

}

/**
 * Copyright 2016-2017 Sixt GmbH & Co. Autovermietung KG
 * 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.sixt.service.framework.kafka.messaging;

import com.google.inject.Inject;
import com.sixt.service.framework.ServiceProperties;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.producer.ProducerConfig;

import java.util.Properties;

public class ProducerFactory {

    private final ServiceProperties serviceProperties;

    @Inject
    public ProducerFactory(ServiceProperties serviceProperties) {
        this.serviceProperties = serviceProperties;
    }

    public Producer createProducer() {
        String kafkaBootstrapServers = serviceProperties.getKafkaServer();

        Properties kafkaProducerConfig = new Properties();
        kafkaProducerConfig.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, kafkaBootstrapServers);
        kafkaProducerConfig.put(ProducerConfig.ACKS_CONFIG, "all");  // ensure that records have been replicated to other kafka nodes

        return new Producer(kafkaProducerConfig);
    }

}

Set ack to all to ensure records are replicated on other kafka nodes.


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

/**
 * Interfaces and API for input normalization.
 *
 * @since 4.0
 */
@org.gradle.api.Incubating
package org.gradle.normalization;

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

/**
 * Interfaces and API for input normalization.
 *
 * @since 4.0
 */
@org.gradle.api.Incubating
@org.gradle.api.NonNullApi
package org.gradle.normalization;

Cover `org.gradle.normalization` with nullability annotations


package com.craftminecraft.bungee.bungeeban.command;

import com.craftminecraft.bungee.bungeeban.BanManager;

import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command;

public class GUnbanIpCommand extends Command {
	public GUnbanIpCommand() {
		super("gunbanip", "bungeeban.command.gunbanip");
	}
	@Override
	public void execute(CommandSender sender, String[] args) {
		if (args.length != 2) {
			sender.sendMessage(ChatColor.RED + "Wrong command format. <required> [optional]");
			sender.sendMessage(ChatColor.RED + "/gunbanip <ip>");
			return;
		}
		BanManager.gunban(args[0]);
		sender.sendMessage(ChatColor.RED + args[0] + " has been unbanned");
	}

}

package com.craftminecraft.bungee.bungeeban.command;

import com.craftminecraft.bungee.bungeeban.BanManager;

import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command;

public class GUnbanIpCommand extends Command {
	public GUnbanIpCommand() {
		super("gunbanip", "bungeeban.command.gunbanip");
	}
	@Override
	public void execute(CommandSender sender, String[] args) {
		if (args.length != 1) {
			sender.sendMessage(ChatColor.RED + "Wrong command format. <required> [optional]");
			sender.sendMessage(ChatColor.RED + "/gunbanip <ip>");
			return;
		}
		BanManager.gunban(args[0]);
		sender.sendMessage(ChatColor.RED + args[0] + " has been unbanned");
	}

}

Fix gunbanip wanting 2 arguments


package seedu.task.storage;

import javax.xml.bind.annotation.XmlValue;

import seedu.task.commons.exceptions.IllegalValueException;
import seedu.task.model.tag.Tag;

/**
 * JAXB-friendly adapted version of the Tag.
 */
public class XmlAdaptedTag {

    @XmlValue
    public String tagName;

    /**
     * Constructs an XmlAdaptedTag.
     * This is the no-arg constructor that is required by JAXB.
     */
    public XmlAdaptedTag() {}

    /**
     * Converts a given Tag into this class for JAXB use.
     *
     * @param source future changes to this will not affect the created
     */
    public XmlAdaptedTag(Tag source) {
        tagName = source.tagName;
    }

    /**
     * Converts this jaxb-friendly adapted tag object into the model's Tag object.
     *
     * @throws IllegalValueException if there were any data constraints violated in the adapted task
     */
    public Tag toModelType() throws IllegalValueException {
        return new Tag(tagName);
    }

}

Fix trailing whitespace for checkstyle


package org.springframework.site.domain.projects;

import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

public class ProjectVersionTests {

	@Test
	public void getShortNameForCurrentVersion() {
		ProjectRelease version = new ProjectRelease("1.2.3.RELEASE", ProjectRelease.ReleaseStatus.CURRENT, "", "", "", "");
		assertThat(version.getVersionDisplayName(), equalTo("1.2.3"));
	}

	@Test
	public void getShortNameForPreReleaseVersion() {
		ProjectRelease version = new ProjectRelease("1.2.3.M1", ProjectRelease.ReleaseStatus.PRERELEASE, "", "", "", "");
		assertThat(version.getVersionDisplayName(), equalTo("1.2.3.M1"));
	}

	@Test
	public void getShortNameForOtherVersion() {
		ProjectRelease version = new ProjectRelease("1.2.3.RC1", ProjectRelease.ReleaseStatus.PRERELEASE,"", "", "", "");
		assertThat(version.getVersionDisplayName(), equalTo("1.2.3.RC1"));
	}
}

package org.springframework.site.domain.projects;

import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

public class ProjectVersionTests {

	@Test
	public void getDisplayNameForCurrentVersion() {
		ProjectRelease version = new ProjectRelease("1.2.3.RELEASE", ProjectRelease.ReleaseStatus.CURRENT, "", "", "", "");
		assertThat(version.getVersionDisplayName(), equalTo("1.2.3"));
	}

	@Test
	public void getDisplayNameForPreReleaseVersion() {
		ProjectRelease version = new ProjectRelease("1.2.3.M1", ProjectRelease.ReleaseStatus.PRERELEASE, "", "", "", "");
		assertThat(version.getVersionDisplayName(), equalTo("1.2.3.M1"));
	}

	@Test
	public void getDisplayNameForOtherVersion() {
		ProjectRelease version = new ProjectRelease("1.2.3.RC1", ProjectRelease.ReleaseStatus.PRERELEASE,"", "", "", "");
		assertThat(version.getVersionDisplayName(), equalTo("1.2.3.RC1"));
	}
}

Rename remaining 'shortName' refs to 'versionDisplayName'


package com.example.jourdanrodrigues.controk;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;

public abstract class BaseFragmentCreation extends BaseFragment{

    protected abstract Boolean errorInFields();
    protected abstract void initializeFields(View view);

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);

        initializeFields(view);

        return view;
    }

    protected void validateEmptyField(EditText editText) {
        editText.setError(editText.getText().toString().isEmpty() ? "Field cannot be empty!" : null);
    }

    protected void setEmptyFieldValidations(final EditText editText) {
        editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) { validateEmptyField(editText); }
        });
        editText.addTextChangedListener(new TextValidator(editText) {
            @Override
            public void validate(EditText innerEditText) { validateEmptyField(innerEditText); }
        });
    }
}

package com.example.jourdanrodrigues.controk;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;

public abstract class BaseFragmentCreation extends BaseFragment {

    protected abstract Boolean errorInFields();

    protected abstract void initializeFields(View view);

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);

        initializeFields(view);

        return view;
    }

    protected void validateEmptyField(EditText editText) {
        editText.setError(editText.getText().toString().isEmpty() ? "Field cannot be empty!" : null);
    }

    protected void setEmptyFieldValidations(final EditText editText) {
        editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                validateEmptyField(editText);
            }
        });
        editText.addTextChangedListener(new TextValidator(editText) {
            @Override
            public void validate(EditText innerEditText) {
                validateEmptyField(innerEditText);
            }
        });
    }
}

Reformat base fragment creation file


package controllers;

import play.mvc.Controller;
import play.mvc.Result;
import views.html.confighelper;
import views.html.index;

/**
 * This controller contains an action to handle HTTP requests
 * to the application's home page.
 */
public class HomeController extends Controller {

    /**
     * Renders the main home page and provides the Gnag client ID used to create the GitHub authentication
     * link.
     * @return
     */
    public Result index() {
        return ok(index.render());
    }

    /**
     * Will show the page for generating a Gradle config for a specific project. If the user has not authorized GitHub
     * this will redirect to start the authentication flow.
     * @return
     */
    public Result configHelper() {
        if (session(GitHubAuthController.TOKEN_KEY) == null) {
            return redirect("/startAuth");
        } else {
            return ok(confighelper.render(session(GitHubAuthController.TOKEN_KEY)));
        }
    }

}

package controllers;

import play.mvc.Controller;
import play.mvc.Result;
import views.html.confighelper;
import views.html.index;

/**
 * This controller contains an action to handle HTTP requests
 * to the application's home page.
 */
public class HomeController extends Controller {

    /**
     * Renders the main home page and provides the Gnag client ID used to create the GitHub authentication
     * link.
     * @return
     */
    public Result index() {
        session().remove(GitHubAuthController.TOKEN_KEY);
        return ok(index.render());
    }

    /**
     * Will show the page for generating a Gradle config for a specific project. If the user has not authorized GitHub
     * this will redirect to start the authentication flow.
     * @return
     */
    public Result configHelper() {
        if (session(GitHubAuthController.TOKEN_KEY) == null) {
            return redirect("/startAuth");
        } else {
            return ok(confighelper.render(session(GitHubAuthController.TOKEN_KEY)));
        }
    }

}

Remove token from session once back on the index page


/*
 * Copyright 2014, Timo Westkämper
 *
 * 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.mysema.query.sql.support;

import static com.google.common.base.StandardSystemProperty.JAVA_SPECIFICATION_VERSION;

import java.sql.SQLException;

/**
 * A {@code SQLExceptionWrapper} is used to accommodate for
 * {@literal Java™ 7}'s suppressed exceptions.
 *
 * <p>
 * When {@literal Java™ 6} is used, a fallback {@code SQLExceptionWrapper}
 * that produces similar output is used instead.
 * </p>
 * @author Shredder121
 */
public abstract class SQLExceptionWrapper {

    public static final SQLExceptionWrapper INSTANCE;

    static {
        double javaVersion
                = Double.parseDouble(JAVA_SPECIFICATION_VERSION.value());
        if (javaVersion > 1.6) {
            INSTANCE = new JaveSE7SQLExceptionWrapper();
        } else {
            INSTANCE = new JavaSE6SQLExceptionWrapper();
        }
    }

    public abstract RuntimeException wrap(SQLException exception);

    public abstract RuntimeException wrap(String message, SQLException exception);

}

/*
 * Copyright 2014, Timo Westkämper
 *
 * 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.mysema.query.sql.support;

import static com.google.common.base.StandardSystemProperty.JAVA_SPECIFICATION_VERSION;

import java.sql.SQLException;

/**
 * A {@code SQLExceptionWrapper} is used to accommodate for
 * Java™ 7's suppressed exceptions.
 *
 * <p>
 * When Java™ 6 is used, a fallback {@code SQLExceptionWrapper}
 * that produces similar output is used instead.
 * </p>
 * @author Shredder121
 */
public abstract class SQLExceptionWrapper {

    public static final SQLExceptionWrapper INSTANCE;

    static {
        double javaVersion
                = Double.parseDouble(JAVA_SPECIFICATION_VERSION.value());
        if (javaVersion > 1.6) {
            INSTANCE = new JaveSE7SQLExceptionWrapper();
        } else {
            INSTANCE = new JavaSE6SQLExceptionWrapper();
        }
    }

    public abstract RuntimeException wrap(SQLException exception);

    public abstract RuntimeException wrap(String message, SQLException exception);

}

Remove the {@literal } wrapping in the JavaDoc


/*
 * Copyright (C) 2015 Piotr Wittchen
 *
 * 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.github.pwittchen.prefser.library.rx2;

import com.google.gson.Gson;
import java.lang.reflect.Type;

public final class GsonConverter implements JsonConverter {

  private final Gson gson = new Gson();

  @Override public <T> T fromJson(String json, Type typeOfT) {
    return gson.fromJson(json, typeOfT);
  }

  @Override public <T> String toJson(T object, Type typeOfT) {
    return gson.toJson(object, typeOfT);
  }
}

/*
 * Copyright (C) 2015 Piotr Wittchen
 *
 * 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.github.pwittchen.prefser.library.rx2;

import android.support.annotation.NonNull;
import com.google.gson.Gson;
import java.lang.reflect.Type;

public final class GsonConverter implements JsonConverter {

  private final Gson gson;

  public GsonConverter(@NonNull Gson gson) {
    this.gson = gson;
  }

  public GsonConverter() {
    gson = new Gson();
  }

  @Override public <T> T fromJson(String json, Type typeOfT) {
    return gson.fromJson(json, typeOfT);
  }

  @Override public <T> String toJson(T object, Type typeOfT) {
    return gson.toJson(object, typeOfT);
  }
}

Allow to pass custom instance of Gson object


package org.openqa.selenium.testing.drivers;

import com.google.common.base.Supplier;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;

public class SauceBackedDriverSupplier implements Supplier<WebDriver> {

  private final Capabilities capabilities;

  public SauceBackedDriverSupplier(Capabilities caps) {
    this.capabilities = caps;
  }

  public WebDriver get() {
    if (!SauceDriver.shouldUseSauce()) {
      return null;
    }

    return new SauceDriver(capabilities);
  }
}

package org.openqa.selenium.testing.drivers;

import com.google.common.base.Supplier;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.LocalFileDetector;

public class SauceBackedDriverSupplier implements Supplier<WebDriver> {

  private final Capabilities capabilities;

  public SauceBackedDriverSupplier(Capabilities caps) {
    this.capabilities = caps;
  }

  public WebDriver get() {
    if (!SauceDriver.shouldUseSauce()) {
      return null;
    }

    SauceDriver driver = new SauceDriver(capabilities);
    driver.setFileDetector(new LocalFileDetector());
    return driver;
  }
}

Use a file detector for Sauce tests


package org.kew.shs.dedupl.transformers;

import org.apache.commons.lang.StringUtils;

/**
 * This transformer translates author strings in the form "(Author1) Author2" to "Author1"
 * @author nn00kg
 *
 */
public class StripPublishingAuthorTransformer implements Transformer{

	public String transform(String s) {
		String transformed = s;
		if (StringUtils.isNotBlank(s) && ((s.indexOf("(") != -1) && s.indexOf(")") != -1))
			transformed = s.substring(s.indexOf("(")+1,s.indexOf(")"));
		return transformed;
	}

	public static void main(String[] args) {
		StripPublishingAuthorTransformer t  = new StripPublishingAuthorTransformer();
		System.out.println(t.transform("(Author1) Author 2"));
	}

}

package org.kew.shs.dedupl.transformers;

import org.apache.commons.lang.StringUtils;

/**
 * This transformer translates author strings in the form "(Author1) Author2" to "Author1"
 * @author nn00kg
 *
 */
public class StripPublishingAuthorTransformer implements Transformer{

	public String transform(String s) {
		String transformed = s;
		if (StringUtils.isNotBlank(s) && ((s.indexOf("(") != -1) && s.indexOf(")") != -1))
			transformed = s.substring(s.indexOf("(")+1,s.indexOf(")"));
		else
			transformed = "";
		return transformed;
	}

	public static void main(String[] args) {
		StripPublishingAuthorTransformer t  = new StripPublishingAuthorTransformer();
		System.out.println(t.transform("(Author1) Author 2"));
		System.out.println(t.transform("Author3"));
		System.out.println(t.transform("(Author4)"));
	}

}

Add delimited output file and new AuthorAbbreviatedMatcher


import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.GeneratorAdapter;
import org.objectweb.asm.commons.Method;

public class Gen {

    public static void main(String[] args) {
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
        cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC, "GenBCode", null, "java/lang/Object", null);

        Method init = Method.getMethod("void <init>()");
        GeneratorAdapter gaInit = new GeneratorAdapter(Opcodes.ACC_PUBLIC, init, null, null, cw);
        gaInit.visitCode();
        gaInit.loadThis();
        gaInit.invokeConstructor(Type.getType(Object.class), init);
        gaInit.returnValue();
        gaInit.endMethod();

        Method run = Method.getMethod("int run()");
        GeneratorAdapter ga = new GeneratorAdapter((Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC), run, null, null, cw);
        ga.visitCode();
        // BEGIN important part
        ga.push(42);
        // END important part
        ga.returnValue();
        ga.endMethod();

        cw.visitEnd();

        byte[] generatedByteCode = cw.toByteArray();
    }
}

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.GeneratorAdapter;
import org.objectweb.asm.commons.Method;

public class Gen {

    public static void main(String[] args) {
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
        cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC, "GenBCode", null, "java/lang/Object", null);

        Method init = Method.getMethod("void <init>()");
        GeneratorAdapter gaInit = new GeneratorAdapter(Opcodes.ACC_PUBLIC, init, null, null, cw);
        gaInit.visitCode();
        gaInit.loadThis();
        gaInit.invokeConstructor(Type.getType(Object.class), init);
        gaInit.returnValue();
        gaInit.endMethod();

        Method run = Method.getMethod("int run()");
        GeneratorAdapter ga = new GeneratorAdapter((Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC), run, null, null, cw);
        ga.visitCode();
        // BEGIN important part
        ga.push(42);
        // END important part
        ga.returnValue();
        ga.endMethod();

        cw.visitEnd();

        byte[] generatedByteCode = cw.toByteArray();

        try {
            Path path = Paths.get("GenBCode.class");
            Files.write(path, generatedByteCode);
        } catch(Exception e) {
            System.out.println("Cannot write to file");
        }

        System.out.println(GenBCode.run());
    }
}

Write generated class to a .class and run it


package me.rkfg.xmpp.bot;

import me.rkfg.xmpp.bot.irc.IRCBot;
import ru.ppsrk.gwt.client.LogicException;

public class Main {

    public static final IBot INSTANCE = new IRCBot();

    public static void main(String[] args) throws LogicException {
        INSTANCE.run();
    }

}

package me.rkfg.xmpp.bot;

import java.io.IOException;

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

import me.rkfg.xmpp.bot.irc.IRCBot;
import me.rkfg.xmpp.bot.matrix.MatrixBot;
import me.rkfg.xmpp.bot.xmpp.XMPPBot;
import ru.ppsrk.gwt.client.LogicException;
import ru.ppsrk.gwt.server.SettingsManager;

public class Main {

    public static final IBot INSTANCE;
    private static Logger log = LoggerFactory.getLogger(Main.class);

    static {
        SettingsManager sm = SettingsManager.getInstance();
        sm.setFilename("settings.ini");
        try {
            sm.loadSettings();
        } catch (IOException e) {
            log.warn("{}", e);
        }
        String type = sm.getStringSetting("type");
        if (type == null) {
            INSTANCE = null;
        } else {
            switch (type) {
            case "xmpp":
                INSTANCE = new XMPPBot();
                break;
            case "matrix":
                INSTANCE = new MatrixBot();
                break;
            case "irc":
                INSTANCE = new IRCBot();
                break;
            default:
                INSTANCE = null;
                break;
            }
        }
    }

    public static void main(String[] args) throws LogicException {
        if (INSTANCE == null) {
            log.error("Set 'type' parameter in settings.ini to the bot type (xmpp, matrix or irc).");
            return;
        }
        INSTANCE.run();
    }

}

Select bot type via config