package se.tla.mavenversionbumper.vcs;

import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.ExecuteWatchdog;

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

/**
 * Common functionality for implementations of the VersionControl interface.
 */
public abstract class AbstractVersionControl implements VersionControl {

    public static final String VERSIONCONTROL = "versioncontrol";

    @Override
    public void prepareSave(File file) {
        // Default is to do nothing before saving.
    }

    /**
     * Execute this command line, optionally in this working directory.
     * @param cmdLine
     * @param workDir
     */
    protected void execute(CommandLine cmdLine, File workDir) {
        DefaultExecutor exec = new DefaultExecutor();
        exec.setWatchdog(new ExecuteWatchdog(60000));
        if (workDir != null) {
            exec.setWorkingDirectory(workDir);
        }

        try {
            exec.execute(cmdLine);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

package se.tla.mavenversionbumper.vcs;

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

import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.ExecuteWatchdog;

/**
 * Common functionality for implementations of the VersionControl interface.
 */
public abstract class AbstractVersionControl implements VersionControl {

    public static final String VERSIONCONTROL = "versioncontrol";

    @Override
    public void prepareSave(File file) {
        // Default is to do nothing before saving.
    }

    /**
     * Execute this command line, optionally in this working directory.
     * @param cmdLine
     * @param workDir
     */
    protected void execute(CommandLine cmdLine, File workDir) {
        DefaultExecutor exec = new DefaultExecutor();
        exec.setWatchdog(new ExecuteWatchdog(60000));
        if (workDir != null) {
            exec.setWorkingDirectory(workDir);
        }

        System.out.println("Running command:   " + cmdLine.toString());

        try {
            exec.execute(cmdLine);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Print out what will actually be executed.


package org.robockets.stronghold.robot.highgoalshooter;

import edu.wpi.first.wpilibj.command.CommandGroup;

/**
 * Shoot the high goal shooter from anywhere on the field.
 */
public class FreeFire extends CommandGroup {

    public  FreeFire() {
    	addSequential(new VerticalAlign());
    	addSequential(new FireShooter());
    	addSequential(new MoveShootingWheel(0));
    }
}

package org.robockets.stronghold.robot.highgoalshooter;

import edu.wpi.first.wpilibj.command.CommandGroup;

/**
 * Shoot the high goal shooter from anywhere on the field.
 */
public class FreeFire extends CommandGroup {

    public  FreeFire() {
    	addSequential(new VerticalAlign());
    	addSequential(new HorizontalAlign(true));
    	addSequential(new FireShooter());
    	addSequential(new MoveShootingWheel(0));
    }
}

Add horizontal align to free fire command group.


package com.example.mysmall.lib.style;

import android.app.Application;

//import net.wequick.small.Small;

/**
 * Created by galen on 16/8/9.
 */
public class StyleManager extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
//        Small.setWebActivityTheme(R.style.AppTheme);
    }
}

package com.example.mysmall.lib.style;

import android.app.Application;

import net.wequick.small.Small;

/**
 * Created by galen on 16/8/9.
 */
public class StyleManager extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        Small.setWebActivityTheme(R.style.AppTheme);
    }
}

Add sample for setting Small WebActivity theme


package com.uwetrottmann.shopr.utils;

/**
 * Stores data about the current task.
 */
public class Statistics {

    private static Statistics _instance;

    private long mStartTime;
    private int mCycleCount;
    private String mUserName;
    private boolean mIsDiversity;

    private boolean mIsStarted;

    private Statistics() {

    }

    public synchronized static Statistics get() {
        if (_instance == null) {
            _instance = new Statistics();
        }
        return _instance;
    }

    public synchronized void startTask(String username, boolean isDiversity) {
        mIsStarted = true;
        mUserName = username;
        mIsDiversity = isDiversity;
        mStartTime = System.currentTimeMillis();
        mCycleCount = 0;
    }

    public void incrementCycleCount() {
        mCycleCount++;
    }

    public synchronized void stopTask() {
        if (!mIsStarted) {
            return;
        }
        mIsStarted = false;
        long duration = System.currentTimeMillis() - mStartTime;
        // TODO: write to database
    }

}

package com.uwetrottmann.shopr.utils;

import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;

import com.uwetrottmann.shopr.provider.ShoprContract.Stats;

/**
 * Stores data about the current task.
 */
public class Statistics {

    private static Statistics _instance;

    private long mStartTime;
    private int mCycleCount;
    private String mUserName;
    private boolean mIsDiversity;

    private boolean mIsStarted;

    private Statistics() {

    }

    public synchronized static Statistics get() {
        if (_instance == null) {
            _instance = new Statistics();
        }
        return _instance;
    }

    public synchronized void startTask(String username, boolean isDiversity) {
        mIsStarted = true;
        mUserName = username;
        mIsDiversity = isDiversity;
        mStartTime = System.currentTimeMillis();
        mCycleCount = 0;
    }

    public void incrementCycleCount() {
        mCycleCount++;
    }

    /**
     * Stops the task and writes all data to the database.
     *
     * @return The {@link Uri} pointing to the new data set.
     */
    public synchronized Uri finishTask(Context context) {
        if (!mIsStarted) {
            return null;
        }

        mIsStarted = false;
        long duration = System.currentTimeMillis() - mStartTime;

        // Write to database
        ContentValues statValues = new ContentValues();
        statValues.put(Stats.USERNAME, mUserName);
        statValues.put(Stats.TASK_TYPE, mIsDiversity ? "div" : "sim");
        statValues.put(Stats.CYCLE_COUNT, mCycleCount);
        statValues.put(Stats.DURATION, duration);
        final Uri inserted = context.getContentResolver().insert(Stats.CONTENT_URI, statValues);

        return inserted;
    }

}

Store stats when finishing task.

Store stats when finishing task.


package org.realityforge.arez.processor;

import com.google.testing.compile.JavaFileObjects;
import com.google.testing.compile.JavaSourceSubjectFactory;
import javax.annotation.Nonnull;
import javax.tools.JavaFileObject;
import static com.google.common.truth.Truth.assert_;

abstract class AbstractArezProcessorTest
{
  void assertSuccessfulCompile( @Nonnull final String classname )
  {
    final String file = classname.replaceAll( "\\.", "/" );
    assertSuccessfulCompile( "input/" + file + ".java", "expected/" + file + ".java" );
  }

  private void assertSuccessfulCompile( @Nonnull final String inputResource,
                                        @Nonnull final String expectedOutputResource )
  {
    final JavaFileObject source = JavaFileObjects.forResource( inputResource );
    assert_().about( JavaSourceSubjectFactory.javaSource() ).
      that( source ).
      processedWith( new ArezProcessor() ).
      compilesWithoutError().
      and().generatesSources( JavaFileObjects.forResource( expectedOutputResource ) );
  }
}

package org.realityforge.arez.processor;

import com.google.testing.compile.JavaFileObjects;
import com.google.testing.compile.JavaSourceSubjectFactory;
import javax.annotation.Nonnull;
import javax.tools.JavaFileObject;
import static com.google.common.truth.Truth.assert_;

abstract class AbstractArezProcessorTest
{
  void assertSuccessfulCompile( @Nonnull final String classname )
  {
    final String[] elements = classname.contains( "." ) ? classname.split( "." ) : new String[]{ classname };
    final StringBuilder input = new StringBuilder();
    final StringBuilder expected = new StringBuilder();
    input.append( "input" );
    expected.append( "expected" );
    for ( int i = 0; i < elements.length; i++ )
    {
      input.append( '/' );
      input.append( elements[ i ] );
      expected.append( '/' );
      if ( i == elements.length - 1 )
      {
        expected.append( "Arez_" );
      }
      expected.append( elements[ i ] );
    }
    input.append( ".java" );
    expected.append( ".java" );
    assertSuccessfulCompile( input.toString(), expected.toString() );
  }

  private void assertSuccessfulCompile( @Nonnull final String inputResource,
                                        @Nonnull final String expectedOutputResource )
  {
    final JavaFileObject source = JavaFileObjects.forResource( inputResource );
    assert_().about( JavaSourceSubjectFactory.javaSource() ).
      that( source ).
      processedWith( new ArezProcessor() ).
      compilesWithoutError().
      and().generatesSources( JavaFileObjects.forResource( expectedOutputResource ) );
  }
}

Fix the generation of classnames

Fix the generation of classnames


package io.github.aquerr.eaglefactions.entities;

import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.world.Chunk;

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

/**
 * Created by Aquerr on 2017-07-13.
 */
public class Faction
{
    public String Name;
    public int Power;
    public List<String> Members;
    public List<String> Alliances;
    public List<String> Enemies;
    public UUID Leader;
    public List<String> Officers;
    public List<Chunk> Claims;

    public Faction(String factionName, UUID factionLeader)
    {
        this.Name = factionName;
        this.Leader = factionLeader;
        this.Power = 0;
        this.Members = new ArrayList<>();
        this.Claims = new ArrayList<>();
        this.Officers = new ArrayList<>();
        this.Alliances = new ArrayList<>();
        this.Enemies = new ArrayList<>();
    }
}

package io.github.aquerr.eaglefactions.entities;

import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.world.Chunk;

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

/**
 * Created by Aquerr on 2017-07-13.
 */
public class Faction
{
    public String Name;
    public double Power;
    public List<String> Members;
    public List<String> Alliances;
    public List<String> Enemies;
    public UUID Leader;
    public List<String> Officers;
    public List<Chunk> Claims;

    public Faction(String factionName, UUID factionLeader)
    {
        this.Name = factionName;
        this.Leader = factionLeader;
        this.Power = 0;
        this.Members = new ArrayList<>();
        this.Claims = new ArrayList<>();
        this.Officers = new ArrayList<>();
        this.Alliances = new ArrayList<>();
        this.Enemies = new ArrayList<>();
    }
}

Fix crash (change Power type to double)

Fix crash (change Power type to double)


package org.commcare.modern.parse;

import org.commcare.core.interfaces.UserSandbox;
import org.commcare.core.parse.ParseUtils;
import org.javarosa.xml.util.InvalidStructureException;
import org.javarosa.xml.util.UnfullfilledRequirementsException;
import org.xmlpull.v1.XmlPullParserException;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;

/**
 * Convenience methods, mostly for touchforms so we don't have to deal with Java IO
 * in Jython which is terrible
 *
 * Used by touchforms
 *
 * Created by wpride1 on 8/20/15.
 */
@SuppressWarnings("unused")
public class ParseUtilsHelper  extends ParseUtils {
    public static void parseXMLIntoSandbox(String restore, UserSandbox sandbox)
            throws InvalidStructureException, UnfullfilledRequirementsException, XmlPullParserException, IOException {
        InputStream stream = new ByteArrayInputStream(restore.getBytes(StandardCharsets.UTF_8));
        parseIntoSandbox(stream, sandbox);
    }

    public static void parseFileIntoSandbox(File restore, UserSandbox sandbox)
            throws IOException, InvalidStructureException, UnfullfilledRequirementsException, XmlPullParserException {
        InputStream stream = new FileInputStream(restore);
        parseIntoSandbox(stream, sandbox);
    }
}

package org.commcare.modern.parse;

import org.commcare.core.interfaces.UserSandbox;
import org.commcare.core.parse.ParseUtils;
import org.javarosa.xml.util.InvalidStructureException;
import org.javarosa.xml.util.UnfullfilledRequirementsException;
import org.xmlpull.v1.XmlPullParserException;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;

/**
 * Convenience methods, mostly for touchforms so we don't have to deal with Java IO
 * in Jython which is terrible
 *
 * Used by touchforms
 *
 * Created by wpride1 on 8/20/15.
 */
@SuppressWarnings("unused")
public class ParseUtilsHelper  extends ParseUtils {
    public static void parseXMLIntoSandbox(String restore, UserSandbox sandbox, boolean failFast)
            throws InvalidStructureException, UnfullfilledRequirementsException, XmlPullParserException, IOException {
        InputStream stream = new ByteArrayInputStream(restore.getBytes(StandardCharsets.UTF_8));
        parseIntoSandbox(stream, sandbox, failFast);
    }

    public static void parseFileIntoSandbox(File restore, UserSandbox sandbox)
            throws IOException, InvalidStructureException, UnfullfilledRequirementsException, XmlPullParserException {
        InputStream stream = new FileInputStream(restore);
        parseIntoSandbox(stream, sandbox);
    }
}

Add option to fail fast on parse

Add option to fail fast on parse


/**
 * Copyright (C) 2015 The Gravitee team (http://gravitee.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.gravitee.repository.api;

import io.gravitee.repository.model.Application;

import java.util.Optional;
import java.util.Set;

/**
 * @author David BRASSELY (brasseld at gmail.com)
 */
public interface ApplicationRepository {

    Set<Application> findAll();

    Set<Application> findByUser(String username);

    Application create(Application application);

    Application update(Application application);

    Optional<Application> findByName(String applicationName);

    void delete(String apiName);

    int countByUser(String username);

    int countByTeam(String teamName);
}

/**
 * Copyright (C) 2015 The Gravitee team (http://gravitee.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.gravitee.repository.api;

import io.gravitee.repository.model.Application;

import java.util.Optional;
import java.util.Set;

/**
 * @author David BRASSELY (brasseld at gmail.com)
 */
public interface ApplicationRepository {

    Set<Application> findAll();

    Set<Application> findByTeam(String teamName);

    Set<Application> findByUser(String username);

    Application create(Application application);

    Application update(Application application);

    Optional<Application> findByName(String applicationName);

    void delete(String apiName);

    int countByUser(String username);

    int countByTeam(String teamName);
}

Add service to retrieve list of Applications by team


package org.honorato.diagnostics.example;

import android.os.Bundle;

import org.honorato.diagnostics.DiagnosticsActivity;

public class MainActivity extends DiagnosticsActivity {

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

package org.honorato.diagnostics.example;

import android.os.Bundle;

import org.honorato.diagnostics.DiagnosticsActivity;

public class MainActivity extends DiagnosticsActivity {

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

    @Override
    protected void setChecks() {
        super.setChecks();

        // Add your checks like this:
        // this.checks.add(new Check(this.getBaseContext()));
    }
}

Add example for adding check to inherited activity


package org.jetbrains.kotlin.core.log;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.jetbrains.kotlin.core.Activator;

public class KotlinLogger {

    public static void log(IStatus status) {
        Activator.getDefault().getLog().log(status);
    }

    public static void log(int severity, String message, Throwable exception) {
        log(new Status(severity, Activator.PLUGIN_ID, message, exception));
    }

    public static void logError(Throwable exception) {
        log(IStatus.ERROR, "Unexpected Exception", exception);
    }

    public static void logError(String message, Throwable exception) {
        log(IStatus.ERROR, message, exception);
    }

    public static void logInfo(String message) {
        log(IStatus.INFO, message, null);
    }
}

package org.jetbrains.kotlin.core.log;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.jetbrains.kotlin.core.Activator;

public class KotlinLogger {

    public static void log(IStatus status) {
        Activator.getDefault().getLog().log(status);
    }

    public static void log(int severity, String message, Throwable exception) {
        log(new Status(severity, Activator.PLUGIN_ID, message, exception));
    }

    public static void logError(Throwable exception) {
        log(IStatus.ERROR, "Unexpected Exception", exception);
    }

    public static void logError(String message, Throwable exception) {
        log(IStatus.ERROR, message, exception);
    }

    public static void logInfo(String message) {
        log(IStatus.INFO, message, null);
    }

    public static void logAndThrow(Throwable exception) {
        logError(exception);
        throw new RuntimeException(exception);
    }
}

Add method to log and throw runtime exception


/*
 * Copyright (c) 2014 Darren Scott - All Rights Reserved
 *
 * This program is distributed under LGPL Version 2.1 in the hope that
 * it will be useful, but WITHOUT ANY WARRANTY.
 */
package org.bootstrapjsp.tags.core.breadcrumb;

import org.bootstrapjsp.facet.ActiveFacet;
import org.bootstrapjsp.tags.html.ListItem;
import org.tldgen.annotations.Tag;

/**
 * A Breadcrumb item.
 *
 * <li>...</li&gt
 */
@Tag(name="breadcrumbitem",dynamicAttributes=true)
public class BreadcrumbItem extends ListItem {

	public BreadcrumbItem() {
		super();
		super.addFacet(new ActiveFacet(false));
	}

}

/*
 * Copyright (c) 2014 Darren Scott - All Rights Reserved
 *
 * This program is distributed under LGPL Version 2.1 in the hope that
 * it will be useful, but WITHOUT ANY WARRANTY.
 */
package org.bootstrapjsp.tags.core.breadcrumb;

import org.bootstrapjsp.facet.ActiveFacet;
import org.bootstrapjsp.tags.html.ListItem;
import org.tldgen.annotations.Tag;

/**
 * A Breadcrumb item.
 *
 * <li>...</li&gt
 */
@Tag(name="breadcrumbitem",dynamicAttributes=true)
public class BreadcrumbItem extends ListItem {

	@SuppressWarnings("unchecked")
	public BreadcrumbItem() {
		super();
		super.addFacet(new ActiveFacet(false));
		super.setValidParents(Breadcrumb.class);
	}

}

Set valid parents on breadcrumbitem

Set valid parents on breadcrumbitem


package de.espend.idea.laravel.config;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ConfigFileUtil
{
    private static final Pattern configFilePattern = Pattern.compile(".*/config/([\\w-/]+).php$");

    public static ConfigFileMatchResult matchConfigFile(Project project, VirtualFile virtualFile) {
        String path = virtualFile.getPath();
        String projectPath = project.getBaseDir().getPath();

        if(path.startsWith(projectPath)) {
            path = path.substring(projectPath.length());
        }

        Matcher m = configFilePattern.matcher(path);

        // config/app.php
        // config/testing/app.php
        if(m.matches()) {
            return new ConfigFileMatchResult(true, m.group(1).replace('/', '.'));
        } else {
            return new ConfigFileMatchResult(false, "");
        }
    }

    public static class ConfigFileMatchResult
    {
        private boolean matches;

        private String keyPrefix;

        ConfigFileMatchResult(boolean matches, @NotNull String keyPrefix) {
            this.matches = matches;
            this.keyPrefix = keyPrefix;
        }

        public boolean matches() {
            return matches;
        }

        @NotNull
        public String getKeyPrefix() {
            return keyPrefix;
        }
    }
}

package de.espend.idea.laravel.config;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ConfigFileUtil
{
    private static final Pattern configFilePattern = Pattern.compile(".*/config/([\\w-/]+).php$");

    public static ConfigFileMatchResult matchConfigFile(Project project, VirtualFile virtualFile) {
        String projectPath = project.getBaseDir().getPath();
        String path = StringUtil.trimStart(virtualFile.getPath(), projectPath);

        Matcher m = configFilePattern.matcher(path);

        // config/app.php
        // config/testing/app.php
        if(m.matches()) {
            return new ConfigFileMatchResult(true, m.group(1).replace('/', '.'));
        } else {
            return new ConfigFileMatchResult(false, "");
        }
    }

    public static class ConfigFileMatchResult
    {
        private boolean matches;

        private String keyPrefix;

        ConfigFileMatchResult(boolean matches, @NotNull String keyPrefix) {
            this.matches = matches;
            this.keyPrefix = keyPrefix;
        }

        public boolean matches() {
            return matches;
        }

        @NotNull
        public String getKeyPrefix() {
            return keyPrefix;
        }
    }
}

Replace 'substring' with 'trimStart' from the OpenAPI utils


package org.intermine.webservice.server.lists;

import java.io.IOException;

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

import org.intermine.api.InterMineAPI;
import org.intermine.web.context.InterMineContext;

public class AvailableListsServlet extends HttpServlet
{
    /**
     * Serialisation constant.
     */
    private static final long serialVersionUID = 1L;

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        getAvailableLists(request, response);
    }

    private void getAvailableLists(HttpServletRequest request, HttpServletResponse response) {
        final InterMineAPI im = InterMineContext.getInterMineAPI();
        new AvailableListsService(im).service(request, response);
    }

    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        saveUploadedList(request, response);
    }

    private void saveUploadedList(HttpServletRequest request, HttpServletResponse response) {
        final InterMineAPI im = InterMineContext.getInterMineAPI();
        new ListUploadService(im).service(request, response);
    }

    @Override
    public void doDelete(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        deleteList(request, response);
    }

    private void deleteList(HttpServletRequest request, HttpServletResponse response) {
        final InterMineAPI im = InterMineContext.getInterMineAPI();
        new ListDeletionService(im).service(request, response);
    }

}

package org.intermine.webservice.server.lists;

import org.intermine.webservice.server.WebService;
import org.intermine.webservice.server.core.NoServiceException;
import org.intermine.webservice.server.core.WebServiceServlet;

public class AvailableListsServlet extends WebServiceServlet
{
    private static final long serialVersionUID = 1L;

    @Override
    protected WebService getService(Method method) throws NoServiceException {
        switch (method) {
        case GET:
            return new AvailableListsService(api);
        case POST:
            return new ListUploadService(api);
        case DELETE:
            return new ListDeletionService(api);
        default:
            throw new NoServiceException();
        }
    }

}

Use the new WebServiceServlet framework

Use the new WebServiceServlet framework

Former-commit-id: 07bac49517b1151a281de191cd9e80c229196181


package com.strider.datadefender.database.metadata;

import java.sql.ResultSet;
import java.sql.SQLException;

import java.util.List;
import java.util.Set;

/**
 * Public interface to define the contract for all database-specific
 * metadata classes.
 *
 * @author armenak
 */
public interface IMetaData {
    List<MatchMetaData> getMetaData(String vendor);

    // List<MatchMetaData> getMetaData(final String columnType);
    List<MatchMetaData> getMetaDataForRs(final ResultSet rs) throws SQLException;
}

/*
 * Copyright 2014, Armenak Grigoryan, and individual contributors as indicated
 * by the @authors tag. See the copyright.txt 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.
 */
package com.strider.datadefender.database.metadata;

import com.strider.datadefender.DbConfig.Vendor;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 * Public interface to define the contract for all database-specific
 * metadata classes.
 *
 * @author armenak
 */
public interface IMetaData {
    List<MatchMetaData> getMetaData(Vendor vendor);
    List<MatchMetaData> getMetaDataForRs(final ResultSet rs) throws SQLException;
}

Refactor getMetaData to use DbConfig.Vendor


package matlab.syntax;

import java.util.*;

import dl.syntax.*;

public class MatlabAssignment extends MatlabProgram {
	private final RealVariable lhs;
	private final Term rhs;

	public MatlabAssignment( RealVariable lhs, Term rhs ) {
		this.lhs = lhs;
		this.rhs = rhs;
	}

	public RealVariable getLHS() {
		return lhs;
	}

	public Term getRHS() {
		return rhs;
	}

	public Set<RealVariable> getModifiedVariables() {
		Set<RealVariable> variables = new HashSet<>();
		variables.add(getLHS());
		return variables;
	}

	public MatlabAssignment replace( Replacement replacement ) {
		return new MatlabAssignment( lhs, rhs.replace( replacement ));
	}

	public String toString() {
		return lhs.toString() + " = " + rhs.toString() + ";\n";
	}

}

package matlab.syntax;

import java.util.*;

import dl.syntax.*;

public class MatlabAssignment extends MatlabProgram {
	private final RealVariable lhs;
	private final Term rhs;

	public MatlabAssignment( RealVariable lhs, Term rhs ) {
		this.lhs = lhs;
		this.rhs = rhs;
	}

	public RealVariable getLHS() {
		return lhs;
	}

	public Term getRHS() {
		return rhs;
	}

	public Set<RealVariable> getModifiedVariables() {
		Set<RealVariable> variables = new HashSet<>();
		variables.add(getLHS());
		return variables;
	}

	public MatlabAssignment replace( Replacement replacement ) {
		return new MatlabAssignment( (RealVariable) lhs.replace(replacement), rhs.replace( replacement ));
	}

	public String toString() {
		return lhs.toString() + " = " + rhs.toString() + ";\n";
	}

}

Replace LHS with replacement values

Replace LHS with replacement values


/*
 * (C) Copyright 2016 Boni Garcia (http://bonigarcia.github.io/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */
package io.github.bonigarcia.wdm.test;

import org.junit.Before;

import io.github.bonigarcia.wdm.FirefoxDriverManager;
import io.github.bonigarcia.wdm.base.BaseVersionTst;

/**
 * Test asserting Firefox versions.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.5.0
 */
public class FirefoxVersionTest extends BaseVersionTst {

    @Before
    public void setup() {
        browserManager = FirefoxDriverManager.getInstance();
        specificVersions = new String[] { "0.3.0", "0.19.1" };
    }

}

/*
 * (C) Copyright 2016 Boni Garcia (http://bonigarcia.github.io/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 */
package io.github.bonigarcia.wdm.test;

import org.junit.Before;

import io.github.bonigarcia.wdm.FirefoxDriverManager;
import io.github.bonigarcia.wdm.base.BaseVersionTst;

/**
 * Test asserting Firefox versions.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.5.0
 */
public class FirefoxVersionTest extends BaseVersionTst {

    @Before
    public void setup() {
        browserManager = FirefoxDriverManager.getInstance();
        specificVersions = new String[] { "0.8.0", "0.19.1" };
    }

}

Stop using wires in versions for Firefox test


package org.codehaus.xfire.handler;

import org.codehaus.xfire.MessageContext;

/**
 * By virtue of XFire being stream based, a service can not write its
 * response until the very end of processing. So a service which needs
 * to write response headers but do so first before writing the
 * SOAP Body.  The writeResponse method tells an Endpoint that it is
 * now okay (i.e. there have been no Faults) to write the
 * response to the OutputStream (if there is an response to the
 * sender at all) or to another endpoint.
 *

 * If a Service does not wishes to write its response immediately when
 * reading the incoming stream, it may do so and not implement the
 * writeResponse method. The service must then realize that
 * the response Handler pipeline will not be able to outgoing stream.
 *
 * @author Dan Diephouse
 */
public interface EndpointHandler
	extends Handler
{
    public void writeResponse(MessageContext context);
}

package org.codehaus.xfire.handler;

import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.fault.XFireFault;

/**
 * By virtue of XFire being stream based, a service can not write its
 * response until the very end of processing. So a service which needs
 * to write response headers but do so first before writing the
 * SOAP Body.  The writeResponse method tells an Endpoint that it is
 * now okay (i.e. there have been no Faults) to write the
 * response to the OutputStream (if there is an response to the
 * sender at all) or to another endpoint.
 *

 * If a Service does not wishes to write its response immediately when
 * reading the incoming stream, it may do so and not implement the
 * writeResponse method. The service must then realize that
 * the response Handler pipeline will not be able to outgoing stream.
 *
 * @author Dan Diephouse
 */
public interface EndpointHandler
	extends Handler
{
    public void writeResponse(MessageContext context) throws XFireFault;
}

Fix the JavaServiceHandler so the response is written when its
supposed to be.

git-svn-id: 9326b53cbc4a8f4c3d02979b62b178127d5150fe@101 c7d0bf07-ec0d-0410-b2cc-d48fa9be22ba


package com.example.project.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

/**
 * Basic controller for the main menu page.
 */
@Controller
@RequestMapping("")
public class MainController {

    @SuppressWarnings("SpringJavaAutowiringInspection")
	@Autowired
    ServletContext servletContext;

    /**
     * Displays the main menu page.
     * @return the name of the jsp to display
     */
	@RequestMapping("")
	public String home(HttpServletRequest request,
					   Model model,
                       @RequestParam(required = false) String userName,
                       @RequestParam(required = false) String url) {
		model.addAttribute("message", "Hello World!");
		return "main";
	}

}

package com.example.project.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

/**
 * Basic controller for the main menu page.
 */
@Controller
@RequestMapping("")
public class MainController {

    @SuppressWarnings("SpringJavaAutowiringInspection")
	@Autowired
    ServletContext servletContext;

    /**
     * Displays the main menu page.
     * @return the name of the jsp to display
     */
	@RequestMapping("")
	public String home(HttpServletRequest request, Model model) {
		model.addAttribute("message", "Hello World!");
		return "main";
	}

}

Test commit from IntelliJ IDEA

Test commit from IntelliJ IDEA


/*
 * Resources.java
 *
 * Copyright (C) 2009-11 by RStudio, Inc.
 *
 * This program is licensed to you under the terms of version 3 of the
 * GNU Affero General Public License. This program is distributed WITHOUT
 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
 *
 */
package org.rstudio.studio.client.pdfviewer.ui.images;

import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;

public interface Resources extends ClientBundle
{
   ImageResource fileOptionsIcon();
   ImageResource nextPageIcon();
   ImageResource previousPageIcon();
   ImageResource sizeButton();
   ImageResource sizeButtonPressed();
   ImageResource zoomButtonLeft();
   ImageResource zoomButtonLeftPressed();
   ImageResource zoomButtonRight();
   ImageResource zoomButtonRightPressed();
   ImageResource zoomInIcon();
   ImageResource zoomOutIcon();
   ImageResource thumbnailsIcon();
}

/*
 * Resources.java
 *
 * Copyright (C) 2009-11 by RStudio, Inc.
 *
 * This program is licensed to you under the terms of version 3 of the
 * GNU Affero General Public License. This program is distributed WITHOUT
 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
 *
 */
package org.rstudio.studio.client.pdfviewer.ui.images;

import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;

public interface Resources extends ClientBundle
{
   @Source("FileOptionsIcon.png")
   ImageResource fileOptionsIcon();

   @Source("NextPageIcon.png")
   ImageResource nextPageIcon();

   @Source("PreviousPageIcon.png")
   ImageResource previousPageIcon();

   @Source("SizeButton.png")
   ImageResource sizeButton();

   @Source("SizeButtonPressed.png")
   ImageResource sizeButtonPressed();

   @Source("ZoomButtonLeft.png")
   ImageResource zoomButtonLeft();

   @Source("ZoomButtonLeftPressed.png")
   ImageResource zoomButtonLeftPressed();

   @Source("ZoomButtonRight.png")
   ImageResource zoomButtonRight();

   @Source("ZoomButtonRightPressed.png")
   ImageResource zoomButtonRightPressed();

   @Source("ZoomInIcon.png")
   ImageResource zoomInIcon();

   @Source("ZoomOutIcon.png")
   ImageResource zoomOutIcon();

   @Source("ThumbnailsIcon.png")
   ImageResource thumbnailsIcon();
}

Fix compile error on Linux

Fix compile error on Linux


package edu.kit.ipd.crowdcontrol.objectservice.rest.resources;

import org.junit.runner.Description;
import org.junit.runner.Runner;
import org.junit.runner.notification.RunNotifier;

/**
 * @author Niklas Keller
 * @link http://stackoverflow.com/a/10931907/2373138
 */
public class DummyRunner extends Runner {
    @Override
    public Description getDescription() {
        return null;
    }

    public void run(RunNotifier notifier) {
        // Do nothing …
    }
}

package edu.kit.ipd.crowdcontrol.objectservice.rest.resources;

import org.junit.runner.Description;
import org.junit.runner.Runner;
import org.junit.runner.notification.RunNotifier;

/**
 * @author Niklas Keller
 * @link http://stackoverflow.com/a/10931907/2373138
 */
public class DummyRunner extends Runner {
    @Override
    public Description getDescription() {
        return Description.EMPTY;
    }

    public void run(RunNotifier notifier) {
        // Do nothing …
    }
}

Return empty description instead of null


package com.thegongoliers.output.motors;

import com.thegongoliers.input.current.HighCurrentSensor;
import com.thegongoliers.input.time.Clock;
import com.thegongoliers.input.time.RobotClock;

public class CircuitBreakerMotorModule implements MotorModule {

    private final HighCurrentSensor mCurrentSensor;
    private final double mBreakDuration;
    private final Clock mClock;

    private double mLastTripTime;

    private boolean mIsTripped;

    public CircuitBreakerMotorModule(HighCurrentSensor currentSensor, double breakDuration, Clock clock){
        mCurrentSensor = currentSensor;
        mBreakDuration = breakDuration;
        mClock = clock;
    }

    public CircuitBreakerMotorModule(HighCurrentSensor currentSensor, double breakDuration){
        this(currentSensor, breakDuration, new RobotClock());
    }

    @Override
    public double run(double currentSpeed, double desiredSpeed, double deltaTime) {
        if (mCurrentSensor.isTriggered()){
            trip();
        }

        if (mIsTripped && mClock.getTime() - mLastTripTime < mBreakDuration){
            mIsTripped = false;
        }

        if (mIsTripped){
            return 0;
        }

        return desiredSpeed;
    }

    private void trip(){
        mIsTripped = true;
        mLastTripTime = mClock.getTime();
    }

}

package com.thegongoliers.output.motors;

import com.thegongoliers.input.switches.Switch;
import com.thegongoliers.input.time.Clock;
import com.thegongoliers.input.time.RobotClock;
import com.thegongoliers.utils.Resettable;

public class CircuitBreakerMotorModule implements MotorModule {

    private final Switch mSwitch;
    private final double mBreakDuration;
    private final Clock mClock;

    private double mLastTripTime;

    private boolean mIsTripped;

    public CircuitBreakerMotorModule(Switch tripSwitch, double breakDuration, Clock clock){
        mSwitch = tripSwitch;
        mBreakDuration = breakDuration;
        mClock = clock;
    }

    public CircuitBreakerMotorModule(Switch tripSwitch, double breakDuration){
        this(tripSwitch, breakDuration, new RobotClock());
    }

    @Override
    public double run(double currentSpeed, double desiredSpeed, double deltaTime) {
        if (mSwitch.isTriggered()){
            trip();
            if (mSwitch instanceof Resettable){
                ((Resettable) mSwitch).reset();
            }
        }

        if (mIsTripped && mClock.getTime() - mLastTripTime < mBreakDuration){
            mIsTripped = false;
        }

        if (mIsTripped){
            return 0;
        }

        return desiredSpeed;
    }

    private void trip(){
        mIsTripped = true;
        mLastTripTime = mClock.getTime();
    }

}

Make circuit breaker module more generic


/**
 * Copyright 2015 LinkedIn Corp. All rights reserved.
 *
 * 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.
 */
package wherehows.models.view;
import lombok.Getter;
import lombok.AllArgsConstructor;

@Getter
@AllArgsConstructor
public class DatasetValidation {

  private String tier;

  private float score;

  private String description;

  private float weight;

  private String validator;
}

/**
 * Copyright 2015 LinkedIn Corp. All rights reserved.
 *
 * 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.
 */
package wherehows.models.view;
import lombok.Getter;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class DatasetValidation {

  private String tier;

  private float score;

  private String description;

  private float weight;

  private String validator;
}

Add noargsconstructor to datasetvalidation class


package net.engin33r.luaspigot.lua.lib;

import net.engin33r.luaspigot.lua.Library;
import net.engin33r.luaspigot.lua.annotation.LibFunctionDef;
import net.engin33r.luaspigot.lua.type.LuaPlayer;
import org.bukkit.Bukkit;
import org.luaj.vm2.Varargs;

/**
 * Library for interacting with players on and off the server.
 * Mostly deals with creating {@link LuaPlayer} instances.
 * @see LuaPlayer
 */
@SuppressWarnings("unused")
public class PlayerLibrary extends Library {
    @Override
    public String getName() {
        return "player";
    }

    @LibFunctionDef(name = "getByName")
    public Varargs getByName(Varargs args) {
        return new LuaPlayer(Bukkit.getOfflinePlayer(args.checkjstring(1)));
    }
}

package net.engin33r.luaspigot.lua.lib;

import net.engin33r.luaspigot.lua.Library;
import net.engin33r.luaspigot.lua.annotation.LibFunctionDef;
import net.engin33r.luaspigot.lua.type.LuaPlayer;
import net.engin33r.luaspigot.lua.type.LuaUUID;
import org.bukkit.Bukkit;
import org.luaj.vm2.Varargs;

/**
 * Library for interacting with players on and off the server.
 * Mostly deals with creating {@link LuaPlayer} instances.
 * @see LuaPlayer
 */
@SuppressWarnings("unused")
public class PlayerLibrary extends Library {
    @Override
    public String getName() {
        return "player";
    }

    @LibFunctionDef(name = "getByName")
    public Varargs getByName(Varargs args) {
        return new LuaPlayer(Bukkit.getOfflinePlayer(args.checkjstring(1)));
    }

    @LibFunctionDef(name = "getByUUID")
    public Varargs getByUUID(Varargs args) {
        return new LuaPlayer(Bukkit.getOfflinePlayer(
                new LuaUUID(args.checkjstring(1)).getUUID()));
    }
}

Add getting players by UUIDs

Add getting players by UUIDs


package org.synyx.urlaubsverwaltung;

import no.api.freemarker.java8.Java8ObjectWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
public class FreemarkerConfig extends FreeMarkerAutoConfiguration {

    @Autowired
    private freemarker.template.Configuration configuration;

    public FreemarkerConfig(ApplicationContext applicationContext, FreeMarkerProperties properties) {
        super(applicationContext, properties);
    }

    @PostConstruct
    public void postConstruct() {
        configuration.setObjectWrapper(
            new Java8ObjectWrapper(freemarker.template.Configuration.getVersion()));
    }

}

package org.synyx.urlaubsverwaltung;

import no.api.freemarker.java8.Java8ObjectWrapper;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
public class FreemarkerConfig extends FreeMarkerAutoConfiguration {

    private final freemarker.template.Configuration configuration;

    public FreemarkerConfig(ApplicationContext applicationContext, FreeMarkerProperties properties, freemarker.template.Configuration configuration) {
        super(applicationContext, properties);
        this.configuration = configuration;
    }

    @PostConstruct
    public void postConstruct() {
        configuration.setObjectWrapper(new Java8ObjectWrapper(freemarker.template.Configuration.getVersion()));
    }
}

Replace field injection by constructor injection


package uk.org.taverna.scufl2.wfdesc;

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

import javax.xml.bind.JAXBException;

import uk.org.taverna.scufl2.api.container.WorkflowBundle;
import uk.org.taverna.scufl2.api.io.ReaderException;
import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
import uk.org.taverna.scufl2.api.io.WriterException;

public class ConvertToWfdesc {
	public static void main(String[] args) throws JAXBException, IOException,
			ReaderException, WriterException {
		WorkflowBundleIO io = new WorkflowBundleIO();
		for (String filepath : args) {
			File original = new File(filepath);
			String filename = original.getName();
			filename = filename.replaceFirst("\\..*", "") + ".wfdesc.ttl";
			File wfdesc = new File(original.getParentFile(), filename);
			WorkflowBundle wfBundle = io.readBundle(original, null);
			io.writeBundle(wfBundle, wfdesc,
					"text/vnd.wf4ever.wfdesc+turtle");
		}
	}
}

package uk.org.taverna.scufl2.wfdesc;

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

import javax.xml.bind.JAXBException;

import uk.org.taverna.scufl2.api.container.WorkflowBundle;
import uk.org.taverna.scufl2.api.io.ReaderException;
import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
import uk.org.taverna.scufl2.api.io.WriterException;

public class ConvertToWfdesc {
	public static void main(String[] args) throws JAXBException, IOException,
			ReaderException, WriterException {
		WorkflowBundleIO io = new WorkflowBundleIO();
		for (String filepath : args) {
			File original = new File(filepath);
			String filename = original.getName();
			filename = filename.replaceFirst("\\..*", "") + ".wfdesc.ttl";
			File wfdesc = new File(original.getParentFile(), filename);
			WorkflowBundle wfBundle = io.readBundle(original, null);
			io.writeBundle(wfBundle, wfdesc,
					"text/vnd.wf4ever.wfdesc+turtle");
			System.out.println("Converted " + original.getPath() + " to " + wfdesc.getPath());
		}
	}
}

Add system.out for each file converted

Add system.out for each file converted


package edu.syr.pcpratts.rootbeer.testcases.rootbeertest.serialization;

import edu.syr.pcpratts.rootbeer.runtime.Kernel;

public class AutoboxingRunOnGpu implements Kernel {

  private Double m_result;
  public void gpuMethod() {
    m_result = returnDouble();
  }

  private double returnDouble() {
    return 10;
  }

  public double getResult(){
    return m_result;
  }

  public boolean compare(AutoboxingRunOnGpu rhs) {
    try {
      if(getResult() != rhs.getResult()){
        System.out.println("m_result");
        System.out.println("lhs: "+getResult());
        System.out.println("rhs: "+rhs.getResult());
        return false;
      }
      return true;
    } catch(Exception ex){
      System.out.println("exception thrown");
      return false;
    }
  }

}

package edu.syr.pcpratts.rootbeer.testcases.rootbeertest.serialization;

import edu.syr.pcpratts.rootbeer.runtime.Kernel;

public class AutoboxingRunOnGpu implements Kernel {

  private Double m_double_result;
  private Integer m_integer_result;
  public void gpuMethod() {
    m_double_result = returnDouble();
    m_integer_result = returnInteger();
  }

  private double returnDouble() {
    return 10;
  }

  private int returnInteger() {
    return 0;
    // values between -128 and 0 will fail because of problems in
    // static_getter_java_lang_Integer$IntegerCache_high or
    // static_getter_java_lang_Integer$IntegerCache_cache
    /*
       if ( i0  <  -128   ) goto label0;
       $i1  = static_getter_java_lang_Integer$IntegerCache_high(gc_info, exception);
       if ( i0  >  $i1   ) goto label0;
       $r0  = static_getter_java_lang_Integer$IntegerCache_cache(gc_info, exception);
       $i2  =  i0  +  128  ;
       $r1  = java_lang_Integer__array_get(gc_info, $r0, $i2, exception);
       if(*exception != 0) {
       return 0; }
       return  $r1 ;
     */
  }

  public double getDoubleResult(){
    return m_double_result;
  }

  public double getIntegerResult(){
    return m_integer_result;
  }

  public boolean compare(AutoboxingRunOnGpu rhs) {
    try {
      if(getDoubleResult() != rhs.getDoubleResult()){
        System.out.println("m_double_result");
        System.out.println("lhs: "+getDoubleResult());
        System.out.println("rhs: "+rhs.getDoubleResult());
        return false;
      }
      if(getIntegerResult() != rhs.getIntegerResult()){
        System.out.println("m_integer_result");
        System.out.println("lhs: "+getIntegerResult());
        System.out.println("rhs: "+rhs.getIntegerResult());
        return false;
      }
      return true;
    } catch(Exception ex){
      System.out.println("exception thrown");
      return false;
    }
  }

}

Update AutoboxingTest (Add Integer check)


package com.aware.plugin.term_collector;

import android.content.Context;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by wmb on 08.01.14.
 */
public class StopWords {
    private List<String> stopwords;

    public StopWords(Context context){
        this.stopwords = new ArrayList<String>();

        //GERMAN STOPWORDS by  Marco Götze, Steffen Geyer: http://solariz.de/649/deutsche-stopwords.htm;
        this.stopwords = new ArrayList<String>();

        InputStream buildinginfo = context.getResources().openRawResource(R.raw.stopwords);
        DataInputStream myDIS = new DataInputStream(buildinginfo);
        String myLine;

        //now loop through and check if we have input, if so append it to list
        try{
            while((myLine=myDIS.readLine())!=null) stopwords.add(myLine);
        } catch(IOException e){
            e.printStackTrace();
        }
    }

    public String[] filteredArray(String[] arrayToFilter) {
    ArrayList<String> resultList = new ArrayList<String>();
        for(String token : arrayToFilter ){
            if(!stopwords.contains(token.toLowerCase())){
                resultList.add(token);
            }
        }
    String[] result = new String[resultList.size()];
    return(resultList.toArray(result));
    }

    public boolean isStopWord(String token){
        return stopwords.contains(token.toLowerCase());
    }
}

package com.aware.plugin.term_collector;

import android.content.Context;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashSet;

/**
 * Created by wmb on 08.01.14.
 */
public class StopWords {
    private HashSet<String> stopwords;

    public StopWords(Context context){
        //GERMAN STOPWORDS by  Marco Götze, Steffen Geyer: http://solariz.de/649/deutsche-stopwords.htm;
        this.stopwords = new HashSet<String>();

        InputStream buildinginfo = context.getResources().openRawResource(R.raw.stopwords);
        DataInputStream myDIS = new DataInputStream(buildinginfo);
        String myLine;

        //now loop through and check if we have input, if so append it to list
        try{
            while((myLine=myDIS.readLine())!=null) stopwords.add(myLine);
        } catch(IOException e){
            e.printStackTrace();
        }
    }

    public String[] filteredArray(String[] arrayToFilter) {
    ArrayList<String> resultList = new ArrayList<String>();
        for(String token : arrayToFilter ){
            if(!stopwords.contains(token.toLowerCase())){
                resultList.add(token);
            }
        }
    String[] result = new String[resultList.size()];
    return(resultList.toArray(result));
    }

    public boolean isStopWord(String token){
        return stopwords.contains(token.toLowerCase());
    }
}

Use HashSet instead of List

Use HashSet instead of List


package blue.mesh;

import android.util.Log;

public class ReadWriteThread extends Thread {

    private final RouterObject    router;
    private final Connection      connection;
    private static final String   TAG = "ReadWriteThread";

    protected ReadWriteThread(RouterObject a_router, Connection a_connection){
        Log.d(TAG, "RWTHREAD CONNECTED!");

        router = a_router;
        connection = a_connection;
    }

    public void run() {
        byte[] buffer = null;

        // Keep listening to the InputStream while connected
        while (true) {

            if (this.isInterrupted()) {
                break;
            }

            int bytes = connection.read( buffer );
            if( bytes > 0 ){
                router.route(buffer, Constants.SRC_OTHER);
            }
        }

        disconnect();

        return;
    }

    private int disconnect(){
        // On exit close the in and out sockets and the Bluetooth socket
        router.notifyDisconnected(connection.getID(), this);
        connection.close();

        Log.d(TAG, "ReadWriteThread returned");
        return Constants.SUCCESS;
    }

    protected int write(byte[] buffer) {
        Log.d(TAG, "Writing bytes");
        connection.write( buffer );
        return Constants.SUCCESS;
    }

}

package blue.mesh;

import android.util.Log;

public class ReadWriteThread extends Thread {

    private final RouterObject    router;
    private final Connection      connection;
    private static final String   TAG = "ReadWriteThread";

    protected ReadWriteThread(RouterObject a_router, Connection a_connection){
        Log.d(TAG, "RWTHREAD CONNECTED!");

        router = a_router;
        connection = a_connection;
    }

    public void run() {
        byte[] buffer = new byte[Constants.MAX_MESSAGE_LEN];

        // Keep listening to the InputStream while connected
        while (true) {

            if (this.isInterrupted()) {
                break;
            }

            int bytes = connection.read( buffer );
            if( bytes > 0 ){
                Log.d(TAG, "Got something");
            }
            if( bytes > 0 && buffer != null ){
                Log.d(TAG, buffer.toString());
                byte[] returnBuffer = new byte[bytes];
                for( int i = 0; i < bytes; i++ ){
                    returnBuffer[i] = buffer[i];
                }
                router.route(returnBuffer, Constants.SRC_OTHER);
            }
        }

        disconnect();

        return;
    }

    private int disconnect(){
        // On exit close the in and out sockets and the Bluetooth socket
        router.notifyDisconnected(connection.getID(), this);
        connection.close();

        Log.d(TAG, "ReadWriteThread returned");
        return Constants.SUCCESS;
    }

    protected int write(byte[] buffer) {
        Log.d(TAG, "Writing bytes: " + buffer.toString() );
        connection.write( buffer );
        return Constants.SUCCESS;
    }

}

Cut the message buffer down before forwarding


package com.benberi.cadesim.server.model.player.vessel.impl;

import com.benberi.cadesim.server.model.player.Player;
import com.benberi.cadesim.server.model.player.vessel.CannonType;
import com.benberi.cadesim.server.model.player.vessel.Vessel;

public class WarBrig extends Vessel {

    public WarBrig(Player p) {
        super(p);
    }

    @Override
    public int getID() {
        return 5;
    }

    @Override
    public int getSize() {
        return 2;
    }

    @Override
    public int getInfluenceDiameter() {
        return 4;
    }

    @Override
    public int getMaxCannons() {
        return 12;
    }

    @Override
    public boolean isDualCannon() {
        return false;
    }

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

    @Override
    public double getMaxDamage() {
        return 16.66;
    }

    @Override
    public double getRamDamage() {
        return 1;
    }

    @Override
    public CannonType getCannonType() {
        return CannonType.LARGE;
    }
}

package com.benberi.cadesim.server.model.player.vessel.impl;

import com.benberi.cadesim.server.model.player.Player;
import com.benberi.cadesim.server.model.player.vessel.CannonType;
import com.benberi.cadesim.server.model.player.vessel.Vessel;

public class Junk extends Vessel {

    public Junk(Player p) {
        super(p);
    }

    @Override
    public int getID() {
        return 5;
    }

    @Override
    public int getSize() {
        return 2;
    }

    @Override
    public int getInfluenceDiameter() {
        return 4;
    }

    @Override
    public int getMaxCannons() {
        return 12;
    }

    @Override
    public boolean isDualCannon() {
        return false;
    }

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

    @Override
    public double getMaxDamage() {
        return 16.66;
    }

    @Override
    public double getRamDamage() {
        return 1;
    }

    @Override
    public CannonType getCannonType() {
        return CannonType.LARGE;
    }
}

Fix for something that should've changed automatically..


package com.github.endoscope.basic.ds;

import com.github.endoscope.storage.jdbc.DataSourceProvider;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;

import javax.sql.DataSource;

import static org.slf4j.LoggerFactory.getLogger;

public class BasicDataSourceProvider implements DataSourceProvider {
    private static final Logger log = getLogger(BasicDataSourceProvider.class);

    public DataSource create(String initParam){
        if( StringUtils.isNotBlank(initParam) && initParam.startsWith("jdbc:postgresql") ){
            log.info("Detected jdbc:postgresql storage param for Endoscope - initializing BasicDataSource");
            try{
                BasicDataSource dataSource = new BasicDataSource();
                dataSource.setDriverClassName("org.postgresql.Driver");
                //DEBUG: loglevel=2
                //INFO: loglevel=1
                //dataSource.setUrl(initParam + "&loglevel=1");

                dataSource.setUrl(initParam);

                //We save statistics every 15min or even less often
                //There is no reason to keep connection open for so long unused
                dataSource.setMinEvictableIdleTimeMillis(55000);
                dataSource.setTimeBetweenEvictionRunsMillis(60000);

                return dataSource;
            }catch(Exception e){
                log.info("Failed to create custom Endoscope DataSource", e);
            }
        }
        return null;
    }
}

package com.github.endoscope.basic.ds;

import javax.sql.DataSource;

import com.github.endoscope.storage.jdbc.DataSourceProvider;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;

import static org.slf4j.LoggerFactory.getLogger;

public class BasicDataSourceProvider implements DataSourceProvider {
    private static final Logger log = getLogger(BasicDataSourceProvider.class);

    public DataSource create(String initParam){
        if( StringUtils.isNotBlank(initParam) && initParam.startsWith("jdbc:postgresql") ){
            log.info("Detected jdbc:postgresql storage param for Endoscope - initializing BasicDataSource");
            try{
                BasicDataSource dataSource = new BasicDataSource();
                dataSource.setDriverClassName("org.postgresql.Driver");
                //DEBUG: loglevel=2
                //INFO: loglevel=1
                //dataSource.setUrl(initParam + "&loglevel=1");

                dataSource.setUrl(initParam);

                //We save statistics every 15min or even less often
                //There is no reason to keep connection open for so long unused
                dataSource.setMinEvictableIdleTimeMillis(55000);
                dataSource.setTimeBetweenEvictionRunsMillis(60000);

                dataSource.setMaxWaitMillis(60 * 60 * 1000);//1h
                dataSource.setDefaultQueryTimeout( 15 * 60 *  1000);//15min

                return dataSource;
            }catch(Exception e){
                log.info("Failed to create custom Endoscope DataSource", e);
            }
        }
        return null;
    }
}

Set DS default timeouts - don’t use inifnite values


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

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;

public class HttpHelloWorldServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    public void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline p = ch.pipeline();

        p.addLast("codec", new HttpServerCodec());
        p.addLast("handler", new HttpHelloWorldServerHandler());
    }
}

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

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;

public class HttpHelloWorldServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    public void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline p = ch.pipeline();

        // Uncomment the following line if you want HTTPS
        //SSLEngine engine = SecureChatSslContextFactory.getServerContext().createSSLEngine();
        //engine.setUseClientMode(false);
        //p.addLast("ssl", new SslHandler(engine));

        p.addLast("codec", new HttpServerCodec());
        p.addLast("handler", new HttpHelloWorldServerHandler());
    }
}

Make clear how to use HTTPS in the helloworld example


package com.kickstarter.libs;

import android.os.Parcelable;
import android.support.annotation.Nullable;

import org.joda.time.DateTime;

import auto.parcel.AutoParcel;

@AutoParcel
public abstract class RelativeDateTimeOptions implements Parcelable {
  // Abbreviates string, e.g.: "in 1 hr"
  public abstract boolean abbreviated();

  // Don't output tense, e.g.: "1 hour" instead of "in 1 hour"
  public abstract boolean absolute();

  // Compare against this date instead of the current time
  public abstract @Nullable DateTime relativeToDateTime();

  // Number of seconds difference permitted before an attempt to describe the relative date is abandoned.
  // For example, "738 days ago" is not helpful to users. The threshold defaults to 30 days.
  public abstract int threshold();

  @AutoParcel.Builder
  public abstract static class Builder {
    public abstract Builder abbreviated(boolean __);
    public abstract Builder absolute(boolean __);
    public abstract Builder relativeToDateTime(DateTime __);
    public abstract Builder threshold(int __);
    public abstract RelativeDateTimeOptions build();
  }

  public static Builder builder() {
    return new AutoParcel_RelativeDateOptions.Builder()
      .abbreviated(false)
      .absolute(false)
      .threshold(THIRTY_DAYS_IN_SECONDS);
  }

  public abstract Builder toBuilder();

  private final static int THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30;
}

package com.kickstarter.libs;

import android.os.Parcelable;
import android.support.annotation.Nullable;

import org.joda.time.DateTime;

import auto.parcel.AutoParcel;

@AutoParcel
public abstract class RelativeDateTimeOptions implements Parcelable {
  // Abbreviates string, e.g.: "in 1 hr"
  public abstract boolean abbreviated();

  // Don't output tense, e.g.: "1 hour" instead of "in 1 hour"
  public abstract boolean absolute();

  // Compare against this date instead of the current time
  public abstract @Nullable DateTime relativeToDateTime();

  // Number of seconds difference permitted before an attempt to describe the relative date is abandoned.
  // For example, "738 days ago" is not helpful to users. The threshold defaults to 30 days.
  public abstract int threshold();

  @AutoParcel.Builder
  public abstract static class Builder {
    public abstract Builder abbreviated(boolean __);
    public abstract Builder absolute(boolean __);
    public abstract Builder relativeToDateTime(DateTime __);
    public abstract Builder threshold(int __);
    public abstract RelativeDateTimeOptions build();
  }

  public static Builder builder() {
    return new AutoParcel_RelativeDateTimeOptions.Builder()
      .abbreviated(false)
      .absolute(false)
      .threshold(THIRTY_DAYS_IN_SECONDS);
  }

  public abstract Builder toBuilder();

  private final static int THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30;
}

Fix autogen code that was missed in refactor


package org.synyx.urlaubsverwaltung.api;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

import static org.springframework.security.config.http.SessionCreationPolicy.NEVER;

@Configuration
@Order(1)
public class RestApiSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http
            .antMatcher("/api/**")
            .sessionManagement()
            .sessionCreationPolicy(NEVER)
            .and()
            .httpBasic()
            .and()
            .authorizeRequests()
            .antMatchers("/api/**").authenticated()
            .anyRequest().authenticated();
    }
}

package org.synyx.urlaubsverwaltung.api;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.synyx.urlaubsverwaltung.security.SecurityConfigurationProperties;

import static org.springframework.security.config.http.SessionCreationPolicy.NEVER;

@Configuration
@Order(1)
public class RestApiSecurityConfig extends WebSecurityConfigurerAdapter {

    private final boolean isOauth2Enabled;

    public RestApiSecurityConfig(SecurityConfigurationProperties properties) {
        isOauth2Enabled = "oidc".equalsIgnoreCase(properties.getAuth().name());
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http
            .antMatcher("/api/**")
            .sessionManagement()
              .sessionCreationPolicy(NEVER)
            .and()
            .authorizeRequests()
              .antMatchers("/api/**").authenticated()
              .anyRequest().authenticated();

        if (isOauth2Enabled) {
            http.oauth2Login();
        } else {
            http.httpBasic();
        }
    }
}

Add oidc for /api (swagger-ui)

Add oidc for /api (swagger-ui)


package org.realityforge.replicant.client;

/**
 * The interface representing the set of changes to be applied to the EntityRepository.
 *
 *
The change set may represent several transactions but may be merged when transmitted to the client.
 * The sequence number identifies the last transaction to be included in the set.

 */
public interface ChangeSet
{
  /**
   * @return the sequence representing the last transaction in the change set.
   */
  int getSequence();

  /**
   * @return the number of change in set. Must be > 0.
   */
  int getChangeCount();

  /**
   * Return the change with specific index.
   *
   * @param index the index of the change.
   * @return the change.
   */
  Change getChange( int index );
}

package org.realityforge.replicant.client;

/**
 * The interface representing the set of changes to be applied to the EntityRepository.
 *
 *
The change set may represent several transactions but may be merged when transmitted to the client.
 * The sequence number identifies the last transaction to be included in the set.

 */
public interface ChangeSet
{
  /**
   * @return the sequence representing the last transaction in the change set.
   */
  int getSequence();

  /**
   * @return the number of changes in the set. Must be > 0.
   */
  int getChangeCount();

  /**
   * Return the change with specific index.
   *
   * @param index the index of the change.
   * @return the change.
   */
  Change getChange( int index );
}

Fix some language in javadocs

Fix some language in javadocs


package se.jaitco.queueticketapi.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedisConfig {

    @Value("${redis.url}")
    private String redisUrl;

    @Value("${redis.password}")
    private String redisPassword;

    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        SingleServerConfig singleServerConfig = config.useSingleServer()
                .setAddress(redisUrl);

        if (!redisPassword.isEmpty()) {
            singleServerConfig.setPassword(redisPassword);
        }
        return Redisson.create(config);
    }

}

package se.jaitco.queueticketapi.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedisConfig {

    @Value("${redis.url}")
    private String redisUrl;

    @Value("${redis.password}")
    private String redisPassword;

    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        SingleServerConfig singleServerConfig = config.useSingleServer()
                .setAddress(redisUrl)
                .setConnectionPoolSize(20);

        if (!redisPassword.isEmpty()) {
            singleServerConfig.setPassword(redisPassword);
        }
        return Redisson.create(config);
    }

}

Upgrade to spring boot 2 and java 9

Upgrade to spring boot 2 and java 9


package com.jakewharton.resourcefs;

import java.io.IOException;
import java.net.URI;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.util.Collections;
import java.util.Map;

import static com.jakewharton.resourcefs.ResourceFileSystemProvider.SCHEME;

public final class ResourceFileSystems {
  public static FileSystem create() {
    try {
      URI uri = URI.create(SCHEME + ":none");
      Map<String, ?> env = Collections.emptyMap();
      return FileSystems.newFileSystem(uri, env);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  private ResourceFileSystems() {
    throw new AssertionError("No instances.");
  }
}

package com.jakewharton.resourcefs;

import java.io.IOException;
import java.net.URI;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.util.Collections;
import java.util.Map;

import static com.jakewharton.resourcefs.ResourceFileSystemProvider.SCHEME;

public final class ResourceFileSystems {
  public static FileSystem create() {
    try {
      URI uri = URI.create(SCHEME + ":none");
      Map<String, ?> env = Collections.emptyMap();
      return FileSystems.newFileSystem(uri, env, ResourceFileSystem.class.getClassLoader());
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  private ResourceFileSystems() {
    throw new AssertionError("No instances.");
  }
}

Use current classloader for service loading fallback.


package com.leevilehtonen.cookagram.domain;

import org.springframework.data.jpa.domain.AbstractPersistable;

import javax.persistence.Entity;
import javax.persistence.Lob;

@Entity
public class ImageEntity extends AbstractPersistable<Long> {

    private String name;
    private String mediaType;
    private Long size;

    @Lob
    private byte[] content;

    public byte[] getContent() {
        return content;
    }

    public void setContent(byte[] content) {
        this.content = content;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMediaType() {
        return mediaType;
    }

    public void setMediaType(String mediaType) {
        this.mediaType = mediaType;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }
}

package com.leevilehtonen.cookagram.domain;

import org.hibernate.annotations.Type;
import org.springframework.data.jpa.domain.AbstractPersistable;

import javax.persistence.Entity;

@Entity
public class ImageEntity extends AbstractPersistable<Long> {

    private String name;
    private String mediaType;
    private Long size;

    @Type(type = "org.hibernate.type.BinaryType")
    private byte[] content;

    public byte[] getContent() {
        return content;
    }

    public void setContent(byte[] content) {
        this.content = content;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMediaType() {
        return mediaType;
    }

    public void setMediaType(String mediaType) {
        this.mediaType = mediaType;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }
}

Update image content type for Postgres

Update image content type for Postgres


package ch.fadre.sandhills;

import java.awt.image.BufferedImage;
import java.io.IOException;

public class Main {

    public static final int width = 750;
    public static final int height = 750;
    public static final int ITERATIONS = 1000_000;

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

        SandSimulation sandSimulation = new SandSimulation(width, height, ITERATIONS);
        short[][] result = sandSimulation.performSimulation();

        ImageWriter imageWriter = new ImageWriter();
        BufferedImage bufferedImage = imageWriter.generateImage(result, width, height);
        imageWriter.writeToFile(bufferedImage, "test");
        imageWriter.displayInFrame(bufferedImage);
    }

}

package ch.fadre.sandhills;

import java.awt.image.BufferedImage;
import java.io.IOException;

public class Main {

    public static int width = 100;
    public static int height = 200;
    public static long iterationCount = 100_000;

    public static void main(String[] args) throws IOException, InterruptedException {
        if(args == null || args.length == 0) {
            System.out.println("Warning: No parameters set, using defaults");
            showUsage();
        } else if (args.length == 3){
            width = Integer.parseInt(args[0]);
            height = Integer.parseInt(args[1]);
            iterationCount = Long.parseLong(args[2]);
            System.out.println("Starting simulation with grid (" + width+"w/" + height +"h) and " + iterationCount + " iterations...");
        } else {
            System.out.println("Too many parameters given! Using defaults");
            showUsage();
        }

        SandSimulation sandSimulation = new SandSimulation(width, height, iterationCount);
        short[][] result = sandSimulation.performSimulation();

        ImageWriter imageWriter = new ImageWriter();
        BufferedImage bufferedImage = imageWriter.generateImage(result, width, height);
        imageWriter.writeToFile(bufferedImage, "test");
        imageWriter.displayInFrame(bufferedImage);
    }

    private static void showUsage() {
        System.out.println("Usage: gradle run 500 500 10000");
    }

}

Allow to pass parameters as programm arguments


/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * 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.
 */

// Use this package so that we can access package-private fields of TextInputLayout.
package com.google.android.material.textfield;

import android.content.Context;
import android.view.View;

public class MountableTextInputLayout extends TextInputLayout {

  private View.OnFocusChangeListener onFocusChangeListener = null;

  public MountableTextInputLayout(Context context) {
    super(context, null);
  }

  // Delegate the focus listener to the EditText
  @Override
  public void setOnFocusChangeListener(View.OnFocusChangeListener l) {
    onFocusChangeListener = l;
    if (editText == null) {
      return;
    }
    editText.setOnFocusChangeListener(l);
  }

  @Override
  public View.OnFocusChangeListener getOnFocusChangeListener() {
    return onFocusChangeListener;
  }
}

/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * 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.
 */

// Use this package so that we can access package-private fields of TextInputLayout.
package com.google.android.material.textfield;

import android.content.Context;
import android.view.View;

public class MountableTextInputLayout extends TextInputLayout {

  private View.OnFocusChangeListener onFocusChangeListener = null;

  public MountableTextInputLayout(Context context) {
    super(context, null);
  }

  // Delegate the focus listener to the EditText
  @Override
  public void setOnFocusChangeListener(View.OnFocusChangeListener l) {
    onFocusChangeListener = l;
    if (editText == null) {
      return;
    }
    editText.setOnFocusChangeListener(l);
  }

  @Override
  public View.OnFocusChangeListener getOnFocusChangeListener() {
    return onFocusChangeListener;
  }

  @Override
  public void setOnClickListener(View.OnClickListener l) {
    if (editText != null) {
      editText.setOnClickListener(l);
    }
  }
}

Fix click handler in MaterialTextInputSpec

Summary: For litho component click event handler to work in this case, we need to pass the clickhandler to the underling EditTextWithEventHandlers from TextInputSpec.

Reviewed By: adityasharat

Differential Revision: D25946471

fbshipit-source-id: 07e5b5455ed2a736f030aedc8dce8c078b9d2d1f


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

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache license, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the license for the specific language governing permissions and
 * limitations under the license.
 */
/**
 * SLF4J support. Note that this does indeed share the same package namespace as the one found in log4j-to-slf4j;
 * this is intentional. The two JARs should not be used at the same time! Thus, in an OSGi environment
 * where split packages are not allowed, this error is prevented due to both JARs sharing an exported package name.
 */
package org.apache.logging.slf4j;

Clarify split package in docs.

Clarify split package in docs.

git-svn-id: de5ce936019686f47409c93bcc5e202a9739563b@1588800 13f79535-47bb-0310-9956-ffa450edef68


/*
 * Copyright 2000-2015 JetBrains s.r.o.
 *
 * 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.intellij.vcs.log.impl;

import com.intellij.vcs.log.Hash;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * @author erokhins
 */
public class HashEqualsTest {
  @Test
  public void testEqualsSelf() {
    Hash hash = HashImpl.build("adf");
    //noinspection EqualsWithItself
    assertTrue(hash.equals(hash));
  }

  @Test
  public void testEqualsNull() {
    Hash hash = HashImpl.build("adf");
    assertFalse(hash.equals(null));
  }

  @Test
  public void testEquals() {
    Hash hash1 = HashImpl.build("adf");
    Hash hash2 = HashImpl.build("adf");
    assertTrue(hash1.equals(hash2));
  }

  @Test
  public void testEqualsNone() {
    Hash hash1 = HashImpl.build("");
    Hash hash2 = HashImpl.build("");
    assertTrue(hash1.equals(hash2));
  }
}

/*
 * Copyright 2000-2015 JetBrains s.r.o.
 *
 * 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.intellij.vcs.log.impl;

import com.intellij.vcs.log.Hash;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * @author erokhins
 */
public class HashEqualsTest {
  @Test
  public void testEqualsSelf() {
    Hash hash = HashImpl.build("adf");
    assertThat(hash).isEqualTo(hash);
  }

  @Test
  public void testEqualsNull() {
    Hash hash = HashImpl.build("adf");
    assertThat(hash).isNotNull();
  }

  @Test
  public void testEquals() {
    Hash hash1 = HashImpl.build("adf");
    Hash hash2 = HashImpl.build("adf");
    assertThat(hash1).isEqualTo(hash2);
  }

  @Test
  public void testEqualsNone() {
    Hash hash1 = HashImpl.build("");
    Hash hash2 = HashImpl.build("");
    assertThat(hash1).isEqualTo(hash2);
  }
}

Test Hash comparisons using assertThat

Test Hash comparisons using assertThat

which makes failure messages and assertion code more readable,
and avoids http://errorprone.info/bugpattern/SelfEquals.


package org.pdxfinder.dao;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.util.Set;

/**
 * TreatmentSummary represents a summary of the application of a treatment protocol to a sample (either Human or Xenograft)
 */

@NodeEntity
public class TreatmentSummary {

    @GraphId
    Long id;

    @Relationship(type = "TREATMENT_PROTOCOL")
    Set<TreatmentProtocol> treatmentProtocols;

    @Relationship(type = "SUMMARY_OF_TREATMENT")
    ModelCreation modelCreation;

    @Relationship(type = "SUMMARY_OF_TREATMENT")
    PatientSnapshot patientSnapshot;

    public TreatmentSummary() {
    }

    public Set<TreatmentProtocol> getTreatmentProtocols() {
        return treatmentProtocols;
    }

    public void setTreatmentProtocols(Set<TreatmentProtocol> treatmentProtocols) {
        this.treatmentProtocols = treatmentProtocols;
    }

    public ModelCreation getModelCreation() {
        return modelCreation;
    }

    public void setModelCreation(ModelCreation modelCreation) {
        this.modelCreation = modelCreation;
    }

    public PatientSnapshot getPatientSnapshot() {
        return patientSnapshot;
    }

    public void setPatientSnapshot(PatientSnapshot patientSnapshot) {
        this.patientSnapshot = patientSnapshot;
    }
}

package org.pdxfinder.dao;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

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

/**
 * TreatmentSummary represents a summary of the application of a treatment protocol to a sample (either Human or Xenograft)
 */

@NodeEntity
public class TreatmentSummary {

    @GraphId
    Long id;

    @Relationship(type = "TREATMENT_PROTOCOL")
    Set<TreatmentProtocol> treatmentProtocols;

    @Relationship(type = "SUMMARY_OF_TREATMENT")
    ModelCreation modelCreation;

    @Relationship(type = "SUMMARY_OF_TREATMENT")
    PatientSnapshot patientSnapshot;

    public TreatmentSummary() {
    }

    public Set<TreatmentProtocol> getTreatmentProtocols() {
        return treatmentProtocols;
    }

    public void setTreatmentProtocols(Set<TreatmentProtocol> treatmentProtocols) {
        this.treatmentProtocols = treatmentProtocols;
    }

    public ModelCreation getModelCreation() {
        return modelCreation;
    }

    public void setModelCreation(ModelCreation modelCreation) {
        this.modelCreation = modelCreation;
    }

    public PatientSnapshot getPatientSnapshot() {
        return patientSnapshot;
    }

    public void setPatientSnapshot(PatientSnapshot patientSnapshot) {
        this.patientSnapshot = patientSnapshot;
    }

    public void addTreatmentProtocol(TreatmentProtocol tp){
        if(this.treatmentProtocols == null){
            this.treatmentProtocols = new HashSet<>();
        }
        this.treatmentProtocols.add(tp);
    }

}

Implement add method for TreatmentProtocols


package zmaster587.advancedRocketry.world.biome;

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

import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.world.biome.BiomeGenBase;

public class BiomeGenSpace extends BiomeGenBase {
	public BiomeGenSpace(int biomeId, boolean register) {
		super(biomeId, register);

		//cold and dry
		enableRain = false;
		enableSnow = false;
		rootHeight=-2f;
		heightVariation=0.00f;
		rainfall = 0f;
		temperature = 0.0f;
		this.theBiomeDecorator.generateLakes=false;
		this.theBiomeDecorator.flowersPerChunk=0;
		this.theBiomeDecorator.grassPerChunk=0;
		this.theBiomeDecorator.treesPerChunk=0;
		this.fillerBlock = this.topBlock = Blocks.air;
		this.biomeName="Space";
	}

	@Override
	public List getSpawnableList(EnumCreatureType p_76747_1_) {
		return new LinkedList<>();
	}

	@Override
	public float getSpawningChance() {
		return 0f; //Nothing spawns
	}
}

package zmaster587.advancedRocketry.world.biome;

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

import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.world.biome.BiomeGenBase;

public class BiomeGenSpace extends BiomeGenBase {
	public BiomeGenSpace(int biomeId, boolean register) {
		super(biomeId, register);

		//cold and dry
		enableRain = false;
		enableSnow = false;
		rootHeight=-2f;
		heightVariation=0.00f;
		rainfall = 0f;
		temperature = 1.0f;
		this.theBiomeDecorator.generateLakes=false;
		this.theBiomeDecorator.flowersPerChunk=0;
		this.theBiomeDecorator.grassPerChunk=0;
		this.theBiomeDecorator.treesPerChunk=0;
		this.fillerBlock = this.topBlock = Blocks.air;
		this.biomeName="Space";
	}

	@Override
	public List getSpawnableList(EnumCreatureType p_76747_1_) {
		return new LinkedList<>();
	}

	@Override
	public float getSpawningChance() {
		return 0f; //Nothing spawns
	}
}

Raise Temperature of space stations so snow stops forming everywhere


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

package uk.org.cinquin.mutinack.misc_util.collections;

import java.util.stream.Collector;

import gnu.trove.list.TIntList;
import gnu.trove.list.array.TIntArrayList;

public class TIntListCollector {

	public static<T> Collector<Integer, TIntList, TIntList> tIntListCollector() {
		return Collector.of(
				TIntArrayList::new,
				TIntList::add,
				(list1, list2) -> {
					list1.addAll(list2);
					return list1;
				},
				list -> list
				);
	}
}

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

package uk.org.cinquin.mutinack.misc_util.collections;

import java.util.stream.Collector;

import org.eclipse.jdt.annotation.NonNull;

import gnu.trove.list.TIntList;
import gnu.trove.list.array.TIntArrayList;

public class TIntListCollector {

	//Unused
	public static<T> Collector<@NonNull Integer, TIntList, TIntList> tIntListCollector() {
		return Collector.of(
				TIntArrayList::new,
				TIntList::add,
				(list1, list2) -> {
					list1.addAll(list2);
					return list1;
				},
				list -> list
				);
	}
}

Fix warning and mark method as unused.

Fix warning and mark method as unused.


package com.netflix.astyanax.serializers;

import java.nio.ByteBuffer;

import junit.framework.Assert;

import org.junit.Test;

public class SerializerPackageImplTest {
    @Test
    public void test() {
        SerializerPackageImpl serializers = new SerializerPackageImpl();
        try {
            serializers.setColumnType("CompositeType(UTF8Type, LongType)");
        } catch (UnknownComparatorException e) {
            e.printStackTrace();
            Assert.fail();
        }

        String input = "abc:123";
        ByteBuffer buffer = serializers.columnAsByteBuffer(input);
        String str = serializers.columnAsString(buffer);
        Assert.assertEquals(input, str);
    }
}

package com.netflix.astyanax.serializers;

import java.nio.ByteBuffer;

import junit.framework.Assert;

import org.junit.Test;

public class SerializerPackageImplTest {
    @Test
    public void test() {
        SerializerPackageImpl serializers = new SerializerPackageImpl();
        try {
            serializers.setColumnType("CompositeType(UTF8Type, LongType)");
        } catch (UnknownComparatorException e) {
            e.printStackTrace();
            Assert.fail();
        }

        String input = "abc:123";
        ByteBuffer buffer = serializers.columnAsByteBuffer(input);
        String str = serializers.columnAsString(buffer);
        Assert.assertEquals(input, str);
    }

    @Test
    public void testSetCompositeKeyType()
    {
        SerializerPackageImpl serializers = new SerializerPackageImpl();

        try {
            serializers.setKeyType( "CompositeType(UTF8Type, LongType)" );
        }
        catch ( UnknownComparatorException e ) {
            e.printStackTrace();
            Assert.fail();
        }
    }

    @Test
    public void testSetStandardKeyType()
    {
        SerializerPackageImpl serializers = new SerializerPackageImpl();

        try {
            serializers.setKeyType( "LongType" );
        }
        catch ( UnknownComparatorException e ) {
            e.printStackTrace();
            Assert.fail();
        }
    }
}

Add unit tests for set key type of SerializerPackageImpl