/**
 * Copyright © 2011-2013 EMBL - European Bioinformatics Institute
 *
 * 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 uk.ac.ebi.phenotype.dao;

/**
 *
 * Parent data access manager interface.
 *
 * @author Gautier Koscielny (EMBL-EBI) <koscieln@ebi.ac.uk>
 * @since February 2012
 */

import java.sql.SQLException;
import java.util.Collection;

import org.hibernate.Session;

/**
 * Please add a description about HibernateDAO.java
 */

public interface HibernateDAO {

	public Session getSession();

	@SuppressWarnings("rawtypes")
	public Collection executeNativeQuery(String sql) throws SQLException;

}

/**
 * Copyright © 2011-2013 EMBL - European Bioinformatics Institute
 *
 * 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 uk.ac.ebi.phenotype.dao;

/**
 *
 * Parent data access manager interface.
 *
 * @author Gautier Koscielny (EMBL-EBI) <koscieln@ebi.ac.uk>
 * @since February 2012
 */

import java.sql.SQLException;
import java.util.Collection;

import org.hibernate.Session;

/**
 * Please add a description about HibernateDAO.java
 */

public interface HibernateDAO {

	public Session getSession();

	public void flushAndClearSession();

	@SuppressWarnings("rawtypes")
	public Collection executeNativeQuery(String sql) throws SQLException;

}

Add a flush and clear method for batch upload.


package uk.me.mjt.ch.status;

public enum MonitoredProcess {
    LOAD_NODES, LOAD_WAYS, INDEX_MAP_DATA, VALIDATE_DATA
}

package uk.me.mjt.ch.status;

public enum MonitoredProcess {
    LOAD_NODES, LOAD_WAYS, INDEX_MAP_DATA, VALIDATE_DATA, EXTRA_PROCESS_1, EXTRA_PROCESS_2
}

Add some extra process names in case someone using the library needs to perform/monitor extra loading processes.


package com.popalay.cardme.ui.base;

import android.app.Activity;
import android.support.annotation.NonNull;

import com.arellomobile.mvp.MvpAppCompatFragment;

public abstract class BaseFragment extends MvpAppCompatFragment implements BaseView {

    @NonNull
    public BaseActivity getBaseActivity() {
        final Activity activity = getActivity();
        if (activity != null && activity instanceof BaseActivity) {
            return (BaseActivity) activity;
        }
        throw new RuntimeException("BaseActivity is null");
    }

    protected void showLoadingDialog() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showLoadingDialog();
    }

    protected void hideLoadingDialog() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.hideLoadingDialog();
    }

    @Override
    public void showError(String error) {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showError(error);
    }

    @Override
    public void showMessage(String message) {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showMessage(message);
    }

    @Override
    public void hideError() {

    }

    @Override
    public void hideMessage() {

    }

    @Override
    public void showProgress() {
        showLoadingDialog();
    }

    @Override
    public void hideProgress() {
        hideLoadingDialog();
    }

    @Override
    public void hideKeyboard() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.hideKeyboard();
    }

    @Override
    public void close() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.close();
    }
}

package com.popalay.cardme.ui.base;

import android.app.Activity;
import android.support.annotation.NonNull;

import com.arellomobile.mvp.MvpAppCompatFragment;

public abstract class BaseFragment extends MvpAppCompatFragment implements BaseView {

    @NonNull
    public BaseActivity getBaseActivity() {
        final Activity activity = getActivity();
        if (activity != null && activity instanceof BaseActivity) {
            return (BaseActivity) activity;
        }
        throw new RuntimeException("BaseActivity is null");
    }

    protected void showLoadingDialog() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showLoadingDialog();
    }

    protected void hideLoadingDialog() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.hideLoadingDialog();
    }

    @Override
    public void showError(String error) {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showError(error);
    }

    @Override
    public void showMessage(String message) {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.showMessage(message);
    }

    @Override
    public void hideError() {

    }

    @Override
    public void hideMessage() {

    }

    @Override
    public void showProgress() {
        showLoadingDialog();
    }

    @Override
    public void hideProgress() {
        hideLoadingDialog();
    }

    @Override
    public void hideKeyboard() {
        final BaseActivity baseActivity = getBaseActivity();
        baseActivity.hideKeyboard();
    }

    @Override
    public void close() {
        throw new UnsupportedOperationException("You can not close the fragment");
    }
}

Throw exception when call close() on fragment


import org.junit.Rule;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testcontainers.containers.BrowserWebDriverContainer;

import java.io.File;

import static org.rnorth.visibleassertions.VisibleAssertions.assertTrue;
import static org.testcontainers.containers.BrowserWebDriverContainer.VncRecordingMode.RECORD_ALL;

/**
 * Simple example of plain Selenium usage.
 */
public class SeleniumContainerTest {

    @Rule
    public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer()
                                                    .withDesiredCapabilities(DesiredCapabilities.chrome())
                                                    .withRecordingMode(RECORD_ALL, new File("target"));

    @Test
    public void simplePlainSeleniumTest() {
        RemoteWebDriver driver = chrome.getWebDriver();

        driver.get("https://wikipedia.org");
        WebElement searchInput = driver.findElementByName("search");

        searchInput.sendKeys("Rick Astley");
        searchInput.submit();

        WebElement otherPage = driver.findElementByPartialLinkText("Rickrolling");
        otherPage.click();

        boolean expectedTextFound = driver.findElementsByCssSelector("p")
                .stream()
                .anyMatch(element -> element.getText().contains("meme"));

        assertTrue("The word 'meme' is found on a page about rickrolling", expectedTextFound);
    }
}

import org.junit.Rule;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testcontainers.containers.BrowserWebDriverContainer;

import java.io.File;
import java.util.List;

import static org.rnorth.visibleassertions.VisibleAssertions.assertTrue;
import static org.testcontainers.containers.BrowserWebDriverContainer.VncRecordingMode.RECORD_ALL;

/**
 * Simple example of plain Selenium usage.
 */
public class SeleniumContainerTest {

    @Rule
    public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer()
                                                    .withDesiredCapabilities(DesiredCapabilities.chrome())
                                                    .withRecordingMode(RECORD_ALL, new File("target"));

    @Test
    public void simplePlainSeleniumTest() {
        RemoteWebDriver driver = chrome.getWebDriver();

        driver.get("https://wikipedia.org");
        List<WebElement> searchInput = driver.findElementsByName("search");

        assertTrue("The search input box is found", searchInput != null && searchInput.size() > 0);
    }
}

Simplify selenium example Previous test relied on the content/layout of wikipedia remaining the same, which led to unexpected failures


package io.burt.jmespath.ast;

public class FlattenListNode extends JmesPathNode {
  public FlattenListNode() {
    super();
  }

  public FlattenListNode(JmesPathNode source) {
    super(source);
  }

  @Override
  protected boolean internalEquals(Object o) {
    return true;
  }

  @Override
  protected int internalHashCode() {
    return 19;
  }
}

package io.burt.jmespath.ast;

public class FlattenListNode extends JmesPathNode {
  public FlattenListNode(JmesPathNode source) {
    super(source);
  }

  @Override
  protected boolean internalEquals(Object o) {
    return true;
  }

  @Override
  protected int internalHashCode() {
    return 19;
  }
}

Remove the no-args constructor from FlattenNode

It is not used.


package net.dean.jraw.models;

import net.dean.jraw.models.meta.JsonProperty;
import net.dean.jraw.models.meta.Model;
import com.fasterxml.jackson.databind.JsonNode;

/**
 * Represents an account with additional information visible only to the logged-in user.
 */
@Model(kind = Model.Kind.ACCOUNT)
public final class LoggedInAccount extends Account {
    /** Instantiates a new LoggedInAccount */
    public LoggedInAccount(JsonNode data) {
        super(data);
    }

    /** Checks if the user has unread mail. */
    @JsonProperty
    public Boolean hasMail() {
        return data("has_mail", Boolean.class);
    }

    /** Checks if the user has moderator mail */
    @JsonProperty(nullable = true)
    public Boolean hasModMail() {
        return data("has_mod_mail", Boolean.class);
    }

    /** Checks if the user has a verified email */
    @JsonProperty
    public Boolean hasVerifiedEmail() {
        return data("has_verified_email", Boolean.class);
    }

    /** Gets the amount of non-moderator mail the user has. */
    @JsonProperty
    public Integer getInboxCount() {
        return data("inbox_count", Integer.class);
    }

    /** Gets the amount of gold creddits (one month worth of reddit gold) the user has. */
    @JsonProperty
    public Integer getCreddits() {
        return data("gold_creddits", Integer.class);
    }
}

package net.dean.jraw.models;

import com.fasterxml.jackson.databind.JsonNode;

import net.dean.jraw.models.meta.JsonProperty;
import net.dean.jraw.models.meta.Model;

import java.text.NumberFormat;

/**
 * Represents an account with additional information visible only to the logged-in user.
 */
@Model(kind = Model.Kind.ACCOUNT)
public final class LoggedInAccount extends Account {
    /** Instantiates a new LoggedInAccount */
    public LoggedInAccount(JsonNode data) {
        super(data);
    }

    /** Checks if the user has unread mail. */
    @JsonProperty
    public Boolean hasMail() {
        return data("has_mail", Boolean.class);
    }

    /** Checks if the user has moderator mail */
    @JsonProperty(nullable = true)
    public Boolean hasModMail() {
        return data("has_mod_mail", Boolean.class);
    }

    /** Checks if the user has a verified email */
    @JsonProperty
    public Boolean hasVerifiedEmail() {
        return data("has_verified_email", Boolean.class);
    }

    /** Gets the amount of non-moderator mail the user has. */
    @JsonProperty
    public Integer getInboxCount() {
        return data("inbox_count", Integer.class);
    }

    /** Gets the localized amount of non-moderator mail the user has. */
    public String getLocalizedInboxCount() {
        try {
            return NumberFormat.getInstance().format(getInboxCount());
        } catch (final IllegalArgumentException ex) {
            return null;
        }
    }

    /** Gets the amount of gold creddits (one month worth of reddit gold) the user has. */
    @JsonProperty
    public Integer getCreddits() {
        return data("gold_creddits", Integer.class);
    }
}

Add ability to get localized inbox count


package org.jutils.jprocesses.util;

import org.junit.Test;

import java.text.ParseException;
import java.util.Locale;

import static org.junit.Assert.*;

@SuppressWarnings("Since15")
public class ProcessesUtilsTest {
  @Test
  public void getCustomDateFormat() throws Exception {
      assertEquals("10/23/2016 08:30:00", ProcessesUtils.parseUnixLongTimeToFullDate("23 okt 08:30:00 2016"));
      try {
        ProcessesUtils.parseUnixLongTimeToFullDate("23 okt 2016 08:30:00");
        fail();
      } catch (ParseException e) {}
      ProcessesUtils.setCustomDateFormat("dd MMM yyyy HH:mm:ss");
      ProcessesUtils.setCustomLocale(Locale.forLanguageTag("no"));
      assertEquals("10/23/2016 08:30:00", ProcessesUtils.parseUnixLongTimeToFullDate("23 okt 2016 08:30:00"));
  }

}

package org.jutils.jprocesses.util;

import org.junit.Test;

import java.text.ParseException;
import java.util.Locale;

import static org.junit.Assert.*;

@SuppressWarnings("Since15")
public class ProcessesUtilsTest {
  @Test
  public void getCustomDateFormat() throws Exception {
      assertEquals("10/23/2016 08:30:00", ProcessesUtils.parseUnixLongTimeToFullDate("oct 23 08:30:00 2016"));
      try {
        ProcessesUtils.parseUnixLongTimeToFullDate("23 okt 2016 08:30:00");
        fail();
      } catch (ParseException e) {}
      ProcessesUtils.setCustomDateFormat("dd MMM yyyy HH:mm:ss");
      ProcessesUtils.setCustomLocale(Locale.forLanguageTag("no"));
      assertEquals("10/23/2016 08:30:00", ProcessesUtils.parseUnixLongTimeToFullDate("23 okt 2016 08:30:00"));
  }

}

Make the first date test so that it passes with the default hardcoded ENGLISH locale


/**
 * FIRST Team 1699
 *
 * Abstract Command Class
 *
 * @author squirlemaster42, FIRST Team 1699
 *
 * @version v0.2-norobot
 */
package org.usfirst.frc.team1699.utils.command;

public abstract class Command {

	private String name;
	private int id;

	// id is used for commands run in auto. It should be set to an integer
	// value that corresponds to
	// the value used when wanting to call the command from the autonomous file.
	public Command(String name, int id) {
		this.name = name;
		this.id = id;

		//Add code to add name and id to respective lists
	}

	public abstract void init();
	public abstract void run();
	public abstract void outputToDashBoard(); //Output all data to dash board
	public abstract void zeroAllSensors(); // zeroAllSensors may need to be looked at and changed
	//public abstract boolean isFinished(); Not used at this time may change in the future.

	public String getName() {
		return name;
	}

	public int getId() {
		return id;
	}

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

/**
 * FIRST Team 1699
 *
 * Abstract Command Class
 *
 * @author squirlemaster42, FIRST Team 1699
 *
 * @version v0.2-norobot
 */
package org.usfirst.frc.team1699.utils.command;

public abstract class Command {

	private String name;
	private int id;

	// id is used for commands run in auto. It should be set to an integer
	// value that corresponds to
	// the value used when wanting to call the command from the autonomous file.
	public Command(String name, int id) {
		this.name = name;
		this.id = id;

		// Add code to add name and id to respective lists
	}

	public abstract void init();

	public abstract void run();

	public abstract void outputToDashBoard(); // Output all data to dash board

	public abstract void zeroAllSensors(); // zeroAllSensors may need to be
											// looked at and changed
	// public abstract boolean isFinished(); Not used at this time may change in
	// the future.

	public String getName() {
		return name;
	}

	public int getId() {
		return id;
	}

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

Make sure everything is correct version

Make sure everything is correct version


package simizer.laws;

import org.junit.*;

/**
 * Basic tests that should be run on all Law subclasses.
 */
@Ignore
public class LawTest {
  protected Law law;

  /**
   * Outputs values from the law to evaluate their distribution.
   */
  @Test
  public void testOutput() {
    for (int i = 0; i < 10000; i++) {
      System.out.println(law.nextValue());
    }
  }
}

package simizer.laws;

import java.lang.reflect.Field;
import org.junit.*;

/**
 * Basic tests that should be run on all Law subclasses.
 */
@Ignore
public class LawTest {
  protected Law law;

  /**
   * Outputs values from the law to evaluate their distribution.
   */
  @Test
  public void testOutput() {
    for (int i = 0; i < 10000; i++) {
      System.out.println(law.nextValue());
    }
  }

  /**
   * Tests whether or not the theoretically maximum value can be achieved.
   *
   * @throws Exception if there is a problem with the reflection
   */
  @Test
  public void testMaximum() throws Exception {
    Field upperBound = Law.class.getDeclaredField("upperBound");
    upperBound.setAccessible(true);
    int bound = (Integer) upperBound.get(law);

    long target = System.currentTimeMillis() + 4*1000;

    boolean found = false;
    while (System.currentTimeMillis() < target) {
      int value = law.nextValue();
      Assert.assertTrue("generated a value that was too large", value < bound);
      Assert.assertTrue("generated a value that was too small", value >= 0);

      if (value == (bound - 1)) {
        found = true;
        break;
      }
    }
    Assert.assertTrue("could not generate the maximum value", found);
  }

  /**
   * Tests whether or not the theoretically minimum value can be achieved.
   */
  @Test
  public void testMinimum() {
    long target = System.currentTimeMillis() + 4*1000;

    boolean found = false;
    while (System.currentTimeMillis() < target) {
      int value = law.nextValue();
      Assert.assertTrue("generated a value that was too small", value >= 0);

      if (value == 0) {
        found = true;
        break;
      }
    }
    Assert.assertTrue("could not generate the minimum value", found);
  }
}

Add unit tests to check the min/max range values.

The unit tests for the Law subclasses will now check whether or not the minimum
value (0) and maximum value (upperBound - 1) can be generated by the
distribution.

Because of the random nature of the laws, the tests will try to generate the
values for four seconds.  If they cannot generate a value in that time, they
will consider it a failure.


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

package org.mutabilitydetector.locations;

import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;

@Immutable
public abstract class ClassName {
    private final String asString;

    public ClassName(@Nonnull String className) {
        this.asString = className;
    }

    public String asString() {
        return asString;
    }

    @Override
    public String toString() {
        return asString();
    }

    @Override
    public int hashCode() {
        return asString.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) { return true; }
        if (obj == null) { return false; }
        if (getClass() != obj.getClass()) { return false; }
        ClassName other = (ClassName) obj;
        return asString.equals(other.asString);
    }

}

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

package org.mutabilitydetector.locations;

import javax.annotation.Nonnull;

public abstract class ClassName {
    private final String asString;

    public ClassName(@Nonnull String className) {
        this.asString = className;
    }

    public String asString() {
        return asString;
    }

    @Override
    public String toString() {
        return asString();
    }

    @Override
    public int hashCode() {
        return asString.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) { return true; }
        if (obj == null) { return false; }
        if (getClass() != obj.getClass()) { return false; }
        ClassName other = (ClassName) obj;
        return asString.equals(other.asString);
    }

}

Remove @Immutable annotation from abstract class.


package com.commit451.gitlab.model.api;

import com.google.gson.annotations.SerializedName;

import org.parceler.Parcel;

import android.net.Uri;

@Parcel
public class Group {
    @SerializedName("id")
    long mId;
    @SerializedName("name")
    String mName;
    @SerializedName("path")
    String mPath;
    @SerializedName("description")
    String mDescription;
    @SerializedName("avatar_url")
    Uri mAvatarUrl;
    @SerializedName("web_url")
    Uri mWebUrl;

    public Group() {}

    public long getId() {
        return mId;
    }

    public String getName() {
        return mName;
    }

    public String getPath() {
        return mPath;
    }

    public String getDescription() {
        return mDescription;
    }

    public Uri getAvatarUrl() {
        return mAvatarUrl;
    }

    public Uri getWebUrl() {
        return mWebUrl;
    }

    public Uri getFeedUrl() {
        return Uri.parse(mWebUrl.toString() + ".atom");
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Group)) {
            return false;
        }

        Group group = (Group) o;
        return mId == group.mId;
    }

    @Override
    public int hashCode() {
        return (int) (mId ^ (mId >>> 32));
    }
}

package com.commit451.gitlab.model.api;

import com.google.gson.annotations.SerializedName;

import org.parceler.Parcel;

import android.net.Uri;

@Parcel
public class Group {
    @SerializedName("id")
    long mId;
    @SerializedName("name")
    String mName;
    @SerializedName("path")
    String mPath;
    @SerializedName("description")
    String mDescription;
    @SerializedName("avatar_url")
    Uri mAvatarUrl;
    @SerializedName("web_url")
    Uri mWebUrl;

    public Group() {}

    public long getId() {
        return mId;
    }

    public String getName() {
        return mName;
    }

    public String getPath() {
        return mPath;
    }

    public String getDescription() {
        return mDescription;
    }

    public Uri getAvatarUrl() {
        return mAvatarUrl;
    }

    public Uri getWebUrl() {
        return mWebUrl;
    }

    public Uri getFeedUrl() {
        if (mWebUrl == null) {
            return null;
        }

        return Uri.parse(mWebUrl.toString() + ".atom");
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Group)) {
            return false;
        }

        Group group = (Group) o;
        return mId == group.mId;
    }

    @Override
    public int hashCode() {
        return (int) (mId ^ (mId >>> 32));
    }
}

Check webUrl of groups for null to prevent NullPointerException


package org.wikipedia.page;

import androidx.annotation.NonNull;

import org.wikipedia.history.HistoryEntry;
import org.wikipedia.model.BaseModel;

public class PageBackStackItem extends BaseModel {
    @NonNull private PageTitle title;
    @NonNull private HistoryEntry historyEntry;

    private int scrollY;

    public PageBackStackItem(@NonNull PageTitle title, @NonNull HistoryEntry historyEntry) {
        this.title = title;
        this.historyEntry = historyEntry;
    }

    @NonNull
    public PageTitle getTitle() {
        return title;
    }

    public void setTitle(@NonNull PageTitle title) {
        this.title = title;
    }

    @NonNull
    public HistoryEntry getHistoryEntry() {
        return historyEntry;
    }

    public int getScrollY() {
        return scrollY;
    }

    public void setScrollY(int scrollY) {
        this.scrollY = scrollY;
    }
}

package org.wikipedia.page;

import androidx.annotation.NonNull;

import org.wikipedia.history.HistoryEntry;
import org.wikipedia.model.BaseModel;

public class PageBackStackItem extends BaseModel {
    @NonNull private PageTitle title;
    @NonNull private HistoryEntry historyEntry;

    private int scrollY;

    public PageBackStackItem(@NonNull PageTitle title, @NonNull HistoryEntry historyEntry) {

        // TODO: remove this crash probe upon fixing
        if (title == null || historyEntry == null) {
            throw new IllegalArgumentException("Nonnull parameter is in fact null.");
        }

        this.title = title;
        this.historyEntry = historyEntry;
    }

    @NonNull
    public PageTitle getTitle() {
        return title;
    }

    public void setTitle(@NonNull PageTitle title) {
        this.title = title;
    }

    @NonNull
    public HistoryEntry getHistoryEntry() {
        return historyEntry;
    }

    public int getScrollY() {
        return scrollY;
    }

    public void setScrollY(int scrollY) {
        this.scrollY = scrollY;
    }
}

Set up probe to investigate possible crash(es) with null PageTitle.

Change-Id: I96f01582b239d84182cb7926371bdb6e7ca54cd3


/**
 * This package provides an object model and parser for Java class files.
 */
@Version("1." + ClassFile.MAJOR_VERSION + ".0")
package aQute.bnd.classfile;

import org.osgi.annotation.versioning.Version;

/**
 * This package provides an object model and parser for Java class files.
 */
@Version("1." + ClassFile.MAJOR_VERSION + "0.0")
package aQute.bnd.classfile;

import org.osgi.annotation.versioning.Version;

classfile: Add space in package version number for enhancements

We may need to add function to the package while retaining the same
class file major version number.

Signed-off-by: BJ Hargrave <3d26bb3930946e3370762d769a073cece444c2d8@bjhargrave.com>


package net.ssehub.kernel_haven.config;

import static net.ssehub.kernel_haven.config.Setting.Type.BOOLEAN;

import java.util.Properties;

import org.junit.Assert;
import org.junit.Test;

import net.ssehub.kernel_haven.SetUpException;

/**
 * Tests the {@link Configuration}.
 * @author El-Sharkawy
 *
 */
public class ConfigurationTest {

    /**
     * Tests that Boolean config values are handled correctly by the {@link Configuration}.
     * @throws SetUpException Must not occur, is not tested by this test.
     */
    @Test
    public void testBooleanValues() throws SetUpException {
        Setting<Boolean> falseValue = new Setting<>("value.false", BOOLEAN, false, "false", "");
        Setting<Boolean> trueValue = new Setting<>("value.true", BOOLEAN, false, "true", "");

        Configuration config = new Configuration(new Properties());
        config.registerSetting(falseValue);
        config.registerSetting(trueValue);

        boolean value = config.getValue(falseValue);
        Assert.assertFalse("False value is treated as true", value);

        value = config.getValue(trueValue);
        Assert.assertTrue("True value is treated as false", value);
    }
}

package net.ssehub.kernel_haven.config;

import static net.ssehub.kernel_haven.config.Setting.Type.BOOLEAN;

import java.util.Properties;

import org.junit.Assert;
import org.junit.Test;

import net.ssehub.kernel_haven.SetUpException;

/**
 * Tests the {@link Configuration}.
 * @author El-Sharkawy
 *
 */
public class ConfigurationTest {

    /**
     * Tests that Boolean config values are handled correctly by the {@link Configuration}.
     * @throws SetUpException Must not occur, is not tested by this test.
     */
    @Test
    public void testBooleanValues() throws SetUpException {
        Setting<Boolean> falseValue = new Setting<>("value.false", BOOLEAN, false, "false", "");
        Setting<Boolean> trueValue = new Setting<>("value.true", BOOLEAN, false, "true", "");
        Setting<Boolean> overwriteableValue = new Setting<>("value.x", BOOLEAN, false, "true", "");

        Properties prop = new Properties();
        prop.setProperty(overwriteableValue.getKey(), "false");
        Configuration config = new Configuration(prop);
        config.registerSetting(falseValue);
        config.registerSetting(trueValue);
        config.registerSetting(overwriteableValue);

        boolean value = config.getValue(falseValue);
        Assert.assertFalse("False value is treated as true", value);

        value = config.getValue(trueValue);
        Assert.assertTrue("True value is treated as false", value);

        value = config.getValue(overwriteableValue);
        Assert.assertFalse("False value is treated as true", value);
    }
}

Test case for the configuration

Test case for the configuration


package oasis.model.directory;

import javax.annotation.Nonnull;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.wordnik.swagger.annotations.ApiModelProperty;

import oasis.model.annotations.Id;

@JsonRootName("organization")
public class Organization {

  @Id
  @ApiModelProperty(required = true)
  private String id;

  @JsonProperty
  @ApiModelProperty(required = true)
  private String name;

  public Organization() {
  }

  /**
   * Copy constructor.
   * <p>
   * Does not copy {@link #id} field.
   */
  public Organization(@Nonnull Organization other) {
    this.name = other.getName();
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

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

}

package oasis.model.directory;

import javax.annotation.Nonnull;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.wordnik.swagger.annotations.ApiModelProperty;

import oasis.model.annotations.Id;

@JsonRootName("organization")
public class Organization {

  @Id
  @ApiModelProperty(required = true)
  private String id;

  @JsonProperty
  @ApiModelProperty(required = true)
  private String name;

  @JsonProperty
  @ApiModelProperty(required = true)
  private Type type;

  public Organization() {
  }

  /**
   * Copy constructor.
   * <p>
   * Does not copy {@link #id} field.
   */
  public Organization(@Nonnull Organization other) {
    this.name = other.getName();
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

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

  public Type getType() {
    return type;
  }

  public void setType(Type type) {
    this.type = type;
  }

  public enum Type {
    PUBLIC_BODY,
    COMPANY
  }
}

Add a "type" field to organizations

Add a "type" field to organizations

Change-Id: If86c88bfbf23cd3b2d2899168bfefd5888b09bd2


package org.amc.servlet.model;

public class PartSearchForm implements WebPageForm
{
	private String part;
	private String qSSNumber;
	private String company;
	/**
	 * @return the part
	 */
	public String getPart()
	{
		return part;
	}
	/**
	 * @return the qSSNumber
	 */
	public String getQSSNumber()
	{
		return qSSNumber;
	}
	/**
	 * @return the company
	 */
	public String getCompany()
	{
		return company;
	}
	/**
	 * @param part the part to set
	 */
	public void setPart(String part)
	{
		this.part = part;
	}

	/**
	 * @param qSSNumber the qSSNumber to set
	 */
	public void setQSSNumber(String qSSNumber)
	{
		this.qSSNumber = qSSNumber;
	}
	/**
	 * @param company the company to set
	 */
	public void setCompany(String company)
	{
		this.company = company;
	}
}

package org.amc.servlet.model;

public class PartSearchForm implements WebPageForm
{
	private String partName;
	private String qSSNumber;
	private String company;
	/**
	 * @return the part
	 */
	public String getPartName()
	{
		return partName;
	}
	/**
	 * @return the qSSNumber
	 */
	public String getQSSNumber()
	{
		return qSSNumber;
	}
	/**
	 * @return the company
	 */
	public String getCompany()
	{
		return company;
	}
	/**
	 * @param part the part to set
	 */
	public void setPartName(String part)
	{
		this.partName = part;
	}

	/**
	 * @param qSSNumber the qSSNumber to set
	 */
	public void setQSSNumber(String qSSNumber)
	{
		this.qSSNumber = qSSNumber;
	}
	/**
	 * @param company the company to set
	 */
	public void setCompany(String company)
	{
		this.company = company;
	}
}

Rename Part to PartName to mirror PartSearch getters/setters


package io.github.bobdesaunois.amazighvillagegame;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;

public class Render
{

    public Render ()
    {

        // Insert initialization code

    }

    public void render () {

        // Clear the screen
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        // Insert render code

    }

}

package io.github.bobdesaunois.amazighvillagegame;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class Render
{

    public Render ()
    {

        // Insert initialization code

    }

    public void render () {

        // Clear the screen
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        ///////////////////////////// TESTING CODE /////////////////////////////

        SpriteBatch testBatch = new SpriteBatch();
        Texture texture = new Texture ("badlogic.jpg");
        testBatch.begin();
        testBatch.draw (texture, 0, 0);
        testBatch.end();

        ///////////////////////////// TESTING CODE /////////////////////////////

        // Insert render code

    }

}

Test rendering for camera translation

Test rendering for camera translation


package com.minecraftedu.students;

import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class BlockBreakMessage {

	@SubscribeEvent
	public void sendMessage(BreakEvent event) {
		event.getPlayer()
				.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + getCustomMessage()));
	}

	public String getCustomMessage() {
		  String message = "My first minecraft mod";
		  return message;
	}

}

package com.minecraftedu.students;

import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class BlockBreakMessage {

	@SubscribeEvent
	public void sendMessage(BreakEvent event) {
		event.getPlayer()
				.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + getCustomMessage()));
	}

	public String getCustomMessage() {
		  String message = "My first minecraft mod again";
		  return message;
	}

}

Test changes to see if codeship builds

Test changes to see if codeship builds


package de.bettinggame.adapter;

import de.bettinggame.domain.Game;
import de.bettinggame.domain.TournamentLevel;
import de.bettinggame.domain.repository.GameRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Controller
public class GameController implements AbstractController {

    @Autowired
    private GameRepository gameRepository;

    @GetMapping("/game")
    public ModelAndView list() {
        ModelAndView mav = new ModelAndView("game/all-games");
        List<Game> games = gameRepository.findByOrderByStarttime();
        Map<TournamentLevel, List<Game>> matchesByLevel = games.stream()
                .collect(Collectors.groupingBy(Game::getLevel));
        mav.addObject("gamesByLevel", matchesByLevel);
        return mav;
    }
}

package de.bettinggame.adapter;

import de.bettinggame.domain.Game;
import de.bettinggame.domain.TournamentLevel;
import de.bettinggame.domain.repository.GameRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.function.Function;
import java.util.stream.Collectors;

@Controller
public class GameController implements AbstractController {

    @Autowired
    private GameRepository gameRepository;

    @GetMapping("/game")
    public ModelAndView list() {
        ModelAndView mav = new ModelAndView("game/all-games");
        List<Game> games = gameRepository.findByOrderByStarttime();
        Map<TournamentLevel, List<Game>> matchesByLevel = games.stream()
                .collect(Collectors.groupingBy(Game::getLevel, TreeMap::new,
                        Collectors.mapping(Function.identity(), Collectors.toList())));
        mav.addObject("gamesByLevel", matchesByLevel);
        return mav;
    }
}

Fix order of TournamentLevel on games site


package me.nallar.modpatcher;

import me.nallar.javatransformer.api.JavaTransformer;

class ModPatcherLoadHook {
	private static final int API_VERSION = 1; //Keep in sync with version in ModPatcher.java
	private static final String VERSION = "@MOD_VERSION@".replace("-SNAPSHOT", "");

	static void loadHook(ModPatcher.Version requiredVersion, String modPatcherRelease, int apiVersion) {
		PatcherLog.info("Loaded ModPatcher. Version: @MOD_VERSION@ API version: " + API_VERSION);

		if (API_VERSION != apiVersion) {
			PatcherLog.warn("API version mismatch. Expected " + API_VERSION + ", got " + apiVersion);
			PatcherLog.warn("API was loaded from: " + JavaTransformer.pathFromClass(ModPatcher.class));
		}

		ModPatcher.Version current = ModPatcher.Version.of(VERSION);

		if (requiredVersion != ModPatcher.Version.LATEST && current.compareTo(requiredVersion) < 0) {
			String autoUpdate = "\nWill auto-update on next start.";

			if (ModPatcher.neverUpdate())
				autoUpdate = "";
			else
				JavaTransformer.pathFromClass(ModPatcherTransformer.class).toFile().deleteOnExit();

			throw new RuntimeException("ModPatcher outdated. Have version: " + VERSION + ", requested version: " + requiredVersion + autoUpdate);
		}
	}
}

package me.nallar.modpatcher;

import me.nallar.javatransformer.api.JavaTransformer;

class ModPatcherLoadHook {
	private static final int API_VERSION = 1; //Keep in sync with version in ModPatcher.java
	private static final String VERSION = "@MOD_VERSION@";

	static void loadHook(ModPatcher.Version requiredVersion, String modPatcherRelease, int apiVersion) {
		PatcherLog.info("Loaded ModPatcher. Version: @MOD_VERSION@ API version: " + API_VERSION);

		if (API_VERSION != apiVersion) {
			PatcherLog.warn("API version mismatch. Expected " + API_VERSION + ", got " + apiVersion);
			PatcherLog.warn("API was loaded from: " + JavaTransformer.pathFromClass(ModPatcher.class));
		}

		ModPatcher.Version current = ModPatcher.Version.of(VERSION);

		if (requiredVersion != ModPatcher.Version.LATEST && current.compareTo(requiredVersion) < 0) {
			String autoUpdate = "\nWill auto-update on next start.";

			if (ModPatcher.neverUpdate())
				autoUpdate = "";
			else
				JavaTransformer.pathFromClass(ModPatcherTransformer.class).toFile().deleteOnExit();

			throw new RuntimeException("ModPatcher outdated. Have version: " + VERSION + ", requested version: " + requiredVersion + autoUpdate);
		}
	}
}

Fix LoadHook dropping snapshot incorrectly.


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

import model.job.PiazzaJobType;
import model.service.metadata.Service;

/**
 * Represents the JSON Model for ingesting service metadata into Piazza for subsequent query,
 * e.g. used when registering a service.  This ingest allows subsequent searches for services.
 *
 *

 *
 */
public class ServiceMetadataIngestJob  implements PiazzaJobType {

	public final String type = "servicemetadata-ingest";
	public Service data;

	public ServiceMetadataIngestJob() {

	}
	@Override
	public String getType() {
		return type;
	}
	public Service getData() {
		return data;
	}
	public void setData(Service data) {
		this.data = data;
	}

}

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

import model.job.PiazzaJobType;
import model.service.metadata.Service;

/**
 * Represents the JSON Model for ingesting service metadata into Piazza for
 * subsequent query, e.g. used when registering a service. This ingest allows
 * subsequent searches for services.
 *
 *
 *
 *
 */
public class ServiceMetadataIngestJob implements PiazzaJobType {

	public final String type = "servicemetadata-ingest";
	public Service data;

	public ServiceMetadataIngestJob() {

	}

	public String getType() {
		return type;
	}

	public Service getData() {
		return data;
	}

	public void setData(Service data) {
		this.data = data;
	}

}

Fix compilation error on interface method override tag


package org.hummingbirdlang.types.concrete;

import org.hummingbirdlang.nodes.builtins.BuiltinNodes;
import org.hummingbirdlang.types.MethodProperty;
import org.hummingbirdlang.types.Property;
import org.hummingbirdlang.types.PropertyNotFoundException;
import org.hummingbirdlang.types.UnknownType;
import org.hummingbirdlang.types.realize.Index.Module;

public final class IntegerType extends BootstrappableConcreteType {
  public static String BUILTIN_NAME = "Integer";

  private MethodType toString;

  @Override
  public String getBootstrapName() {
    return IntegerType.BUILTIN_NAME;
  }

  @Override
  public void bootstrapBuiltins(BuiltinNodes builtins) {
    this.toString = new MethodType(this, new UnknownType(), "toString", builtins.getCallTarget("Integer", "toString"));
  }

  @Override
  public void bootstrapTypes(Module indexModule) {
    this.toString = this.toString.cloneWithReturnType(indexModule.get(StringType.BUILTIN_NAME));
  }

  @Override
  public Property getProperty(String name) throws PropertyNotFoundException {
    switch (name) {
      case "toString":
        return MethodProperty.fromType(this.toString);
      default:
        throw new PropertyNotFoundException(this, name);
    }
  }
}

package org.hummingbirdlang.types.concrete;

import org.hummingbirdlang.nodes.builtins.BuiltinNodes;
import org.hummingbirdlang.types.MethodProperty;
import org.hummingbirdlang.types.Property;
import org.hummingbirdlang.types.PropertyNotFoundException;
import org.hummingbirdlang.types.UnknownType;
import org.hummingbirdlang.types.realize.Index.Module;

public final class IntegerType extends BootstrappableConcreteType {
  public static String BUILTIN_NAME = "Integer";

  private MethodType toString;

  @Override
  public String getBootstrapName() {
    return IntegerType.BUILTIN_NAME;
  }

  @Override
  public void bootstrapBuiltins(BuiltinNodes builtins) {
    this.toString = new MethodType(this, new UnknownType(), "toString", builtins.getCallTarget("Integer", "toString"));
  }

  @Override
  public void bootstrapTypes(Module indexModule) {
    this.toString = this.toString.cloneWithReturnType(indexModule.get(StringType.BUILTIN_NAME));
  }

  @Override
  public Property getProperty(String name) throws PropertyNotFoundException {
    switch (name) {
      case "toString":
        return MethodProperty.fromType(this.toString);
      default:
        throw new PropertyNotFoundException(this, name);
    }
  }

  @Override
  public String toString() {
    return "$Integer";
  }
}

Add debug string representation of integer concrete type


package com.netflix.recipes.rss;

public class RSSVersion {
	private static String version = "0.2";

	public static String getVersion() {
		return RSSVersion.version;
	}
}

package com.netflix.recipes.rss;

public class RSSVersion {
	private final static String RSS_VERSION = "0.3";

	public static String getVersion() {
		return RSSVersion.RSS_VERSION;
	}
}

Change version number from 0.2 to 0.3

Change version number from 0.2 to 0.3


package main.java.engine.objects.tower;

import main.java.engine.EnvironmentKnowledge;

abstract class TowerBehaviorDecorator implements ITower {
    /**
     * The base tower will have behaviors added to it ("decorations")
     */
    protected ITower baseTower;

    public TowerBehaviorDecorator (ITower baseTower) {
        this.baseTower = baseTower;
    }

    @Override
    public boolean atInterval (int intervalFrequency) {
        return baseTower.atInterval(intervalFrequency);
    }

    @Override
    public double getXCoordinate () {
        return baseTower.getXCoordinate();
    }

    @Override
    public double getYCoordinate () {
        return baseTower.getYCoordinate();
    }

    @Override
    public double getCost () {
        return baseTower.getCost();
    }

    @Override
    public void remove () {
        baseTower.remove();
    }

    @Override
    public boolean callTowerActions (EnvironmentKnowledge environ) {
        if (baseTower.callTowerActions(environ)) {
            // in addition to base tower's behavior, also do additional behavior
            doDecoratedBehavior(environ);
        }
        return true;
    }

    abstract void doDecoratedBehavior (EnvironmentKnowledge environ);
}

package main.java.engine.objects.tower;

import main.java.engine.EnvironmentKnowledge;

abstract class TowerBehaviorDecorator implements ITower {
    /**
     * The base tower will have behaviors added to it ("decorations")
     */
    protected ITower baseTower;

    public TowerBehaviorDecorator (ITower baseTower) {
        this.baseTower = baseTower;
    }

    @Override
    public boolean atInterval (int intervalFrequency) {
        return baseTower.atInterval(intervalFrequency);
    }

    @Override
    public double getXCoordinate () {
        return baseTower.getXCoordinate();
    }

    @Override
    public double getYCoordinate () {
        return baseTower.getYCoordinate();
    }

    @Override
    public double getCost () {
        return baseTower.getCost();
    }

    @Override
    public void remove () {
        baseTower.remove();
    }

    @Override
    public boolean callTowerActions (EnvironmentKnowledge environ) {
        if (baseTower.callTowerActions(environ)) {
            // in addition to base tower's behavior, also do additional behavior
            doDecoratedBehavior(environ);
            return true;
        }
        return false;
    }

    abstract void doDecoratedBehavior (EnvironmentKnowledge environ);
}

Make decorators obey base tower's build up time


package jamex.link;

import java.util.Collection;
import java.util.LinkedList;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import javax.jms.Message;
import javax.jms.MessageListener;
import static org.junit.Assert.*;

final class MessageCollector
  implements MessageListener
{
  private static final int MAX_MESSAGE_COUNT = 10;

  private final LinkedBlockingQueue<Message> m_messages = new LinkedBlockingQueue<Message>( MAX_MESSAGE_COUNT );

  @Override
  public void onMessage( final Message message )
  {
    m_messages.add( message );
  }

  Collection<Message> expectMessageCount( final int expectedMessageCount,
                                          final long maxWait )
    throws InterruptedException
  {
    final LinkedList<Message> results = new LinkedList<Message>();
    final long start = System.currentTimeMillis();
    long now;
    while( results.size() < expectedMessageCount &&
           ( ( now = System.currentTimeMillis() ) < start + maxWait ) )
    {
      final long waitTime = Math.max( 1, start + maxWait - now );
      final Message message = m_messages.poll( waitTime, TimeUnit.MILLISECONDS );
      results.add( message );
    }

    assertEquals( "Expected message count", expectedMessageCount, results.size() );
    return results;
  }
}

package jamex.link;

import java.util.Collection;
import java.util.LinkedList;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import javax.jms.Message;
import javax.jms.MessageListener;
import static org.junit.Assert.*;

final class MessageCollector
  implements MessageListener
{
  private static final int MAX_MESSAGE_COUNT = 10;
  private static final long DEFAULT_WAIT = 100L;

  private final LinkedBlockingQueue<Message> m_messages = new LinkedBlockingQueue<Message>( MAX_MESSAGE_COUNT );

  @Override
  public void onMessage( final Message message )
  {
    m_messages.add( message );
  }

  Collection<Message> expectMessageCount( final int expectedMessageCount )
    throws InterruptedException
  {
    return expectMessageCount( expectedMessageCount, DEFAULT_WAIT );
  }

  Collection<Message> expectMessageCount( final int expectedMessageCount, final long maxWait )
    throws InterruptedException
  {
    final LinkedList<Message> results = new LinkedList<Message>();
    final long start = System.currentTimeMillis();
    long now;
    while( results.size() < expectedMessageCount &&
           ( ( now = System.currentTimeMillis() ) < start + maxWait ) )
    {
      final long waitTime = Math.max( 1, start + maxWait - now );
      final Message message = m_messages.poll( waitTime, TimeUnit.MILLISECONDS );
      results.add( message );
    }

    assertEquals( "Expected message count", expectedMessageCount, results.size() );
    return results;
  }
}

Update so collector has a default wait if unspecified


package cucumber.runtime.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

class FileResource implements Resource {
    private final File root;
    private final File file;
    private final boolean classpathFileResource;

    static FileResource createFileResource(File root, File file) {
        return new FileResource(root, file, false);
    }

    static FileResource createClasspathFileResource(File root, File file) {
        return new FileResource(root, file, true);
    }

    private FileResource(File root, File file, boolean classpathFileResource) {
        this.root = root;
        this.file = file;
        this.classpathFileResource = classpathFileResource;
        if (!file.getAbsolutePath().startsWith(root.getAbsolutePath())) {
            throw new IllegalArgumentException(file.getAbsolutePath() + " is not a parent of " + root.getAbsolutePath());
        }
    }

    @Override
    public String getPath() {
        if (classpathFileResource) {
            return file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1);
        } else {
            return file.getPath();
        }
    }

    @Override
    public InputStream getInputStream() throws IOException {
        return new FileInputStream(file);
    }

}

package cucumber.runtime.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

class FileResource implements Resource {
    private final File root;
    private final File file;
    private final boolean classpathFileResource;

    static FileResource createFileResource(File root, File file) {
        return new FileResource(root, file, false);
    }

    static FileResource createClasspathFileResource(File root, File file) {
        return new FileResource(root, file, true);
    }

    private FileResource(File root, File file, boolean classpathFileResource) {
        this.root = root;
        this.file = file;
        this.classpathFileResource = classpathFileResource;
        if (!file.getAbsolutePath().startsWith(root.getAbsolutePath())) {
            throw new IllegalArgumentException(file.getAbsolutePath() + " is not a parent of " + root.getAbsolutePath());
        }
    }

    @Override
    public String getPath() {
        if (classpathFileResource) {
            String relativePath = file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1);
            return relativePath.replace(File.separatorChar, '/');
        } else {
            return file.getPath();
        }
    }

    @Override
    public InputStream getInputStream() throws IOException {
        return new FileInputStream(file);
    }

}

Fix class loading on Windows

[Core] Fix class loading on Windows

Fixes: #1540


package devopsdistilled.operp.client;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import devopsdistilled.operp.client.context.AppContext;
import devopsdistilled.operp.client.main.MainWindow;

public class ClientApp {

	public static void main(String[] args) {
		ApplicationContext context = new AnnotationConfigApplicationContext(
				AppContext.class);

		MainWindow window = context.getBean(MainWindow.class);
		window.init();

		System.out.println(context);
	}
}

package devopsdistilled.operp.client;

import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import devopsdistilled.operp.client.context.AppContext;
import devopsdistilled.operp.client.main.MainWindow;

public class ClientApp {

	public static void main(String[] args) {
		try {
			for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (Exception e) {
			System.err
					.println("Nimbus Look and Feel not available.\nReverting to default");
		}

		ApplicationContext context = new AnnotationConfigApplicationContext(
				AppContext.class);

		MainWindow window = context.getBean(MainWindow.class);
		window.init();

		System.out.println(context);
	}
}

Set Nimbus as LAF for Client-App

Set Nimbus as LAF for Client-App

Merge branch 'set-nimbux-laf' into develop


/*
 *
 * Copyright (c) 2006-2019, Speedment, Inc. 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. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.speedment.common.function;

import java.util.function.Consumer;

/**
 * Represents a consumer that accepts three arguments. This is the three-arity
 * specialization of {@link java.util.function.Consumer}.
 *
 * @param <T>  the type of the first argument to the consumer
 * @param <U>  the type of the second argument to the consumer
 * @param <V>  the type of the third argument to the consumer
 *
 * @see Consumer
 */
@FunctionalInterface
public interface TriConsumer<T, U, V> {

    /**
     * Performs this operation on the given argument.
     *
     * @param t  the first consumer argument
     * @param u  the second consumer argument
     * @param v  the third consumer argument
     */
    void apply(T t, U u, V v);
}

/*
 *
 * Copyright (c) 2006-2019, Speedment, Inc. 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. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.speedment.common.function;

import java.util.function.Consumer;

/**
 * Represents a consumer that accepts three arguments. This is the three-arity
 * specialization of {@link java.util.function.Consumer}.
 *
 * @param <T>  the type of the first argument to the consumer
 * @param <U>  the type of the second argument to the consumer
 * @param <V>  the type of the third argument to the consumer
 *
 * @see Consumer
 */
@FunctionalInterface
public interface TriConsumer<T, U, V> {

    /**
     * Performs this operation on the given argument.
     *
     * @param t  the first consumer argument
     * @param u  the second consumer argument
     * @param v  the third consumer argument
     */
    void accept(T t, U u, V v);
}

Rename method to std name

function: Rename method to std name


package bramble.webserver;

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.eclipse.jetty.http.HttpStatus;

public class TotalJobSlotsHandler extends HttpServlet {

	private static final long serialVersionUID = 5414855470057516723L;

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

		resp.addHeader("Access-Control-Allow-Origin", "*");
		resp.setStatus(HttpStatus.OK_200);
		resp.getWriter().println(WebAPI.getTotalJobSlots());
	}
}

package bramble.webserver;

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.eclipse.jetty.http.HttpStatus;

public class TotalJobSlotsHandler extends HttpServlet {

	private static final long serialVersionUID = 5414855470057516723L;

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

		resp.addHeader("Access-Control-Allow-Origin", "*");
		resp.setStatus(HttpStatus.OK_200);
		resp.getWriter().print(WebAPI.getTotalJobSlots());
	}
}

Change println() to print() to avoid superfluous newline


/**
 *
 */
package com.boundary.sdk;

import java.util.Date;

import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.component.syslog.SyslogMessage;
import org.apache.camel.component.syslog.SyslogSeverity;

import com.boundary.sdk.RawEvent;
import com.boundary.sdk.Severity;

/**
 * @author davidg
 *
 */
public class SNMPToEventProcessor implements Processor {

	private boolean debug = false;
	/**
	 *
	 */

	public SNMPToEventProcessor() {
		this(false);
	}
	public SNMPToEventProcessor(boolean debug) {
		// TODO Auto-generated constructor stub
	}

	private final String CAMEL_SYSLOG_HOSTNAME = "CamelSyslogHostname";
	private final String CAMEL_SYSLOG_SEVERITY = "CamelSyslogSeverity";

	@Override
	public void process(Exchange exchange) throws Exception {
		// Get the CamelContext and Message
		CamelContext context = exchange.getContext();
		Message message = exchange.getIn();

		// Create our event so that we can populate with the Syslog data
		RawEvent event = new RawEvent();
		event = event.getDefaultEvent();
		Date dt = new java.util.Date();
		event.setTitle("SNMP TRAP " + dt);
		event.setSeverity(Severity.CRITICAL);

		// Delegate to member method call to perform the translation
		//this.translateSyslogMessage(message, event);
		message.setBody(event, RawEvent.class);
	}
}

/**
 *
 */
package com.boundary.sdk;

import java.util.Date;

import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.boundary.sdk.RawEvent;
import com.boundary.sdk.Severity;

/**
 * @author davidg
 *
 */
public class SNMPToEventProcessor implements Processor {

    private static final Logger LOG = LoggerFactory.getLogger(SNMPToEventProcessor.class);

	public SNMPToEventProcessor() {
	}

	@Override
	public void process(Exchange exchange) throws Exception {
		Message message = exchange.getIn();
		LOG.debug("class: {}",message.getBody().getClass().toString());

		// Create our event so that we can populate with the Syslog data
		RawEvent event = new RawEvent();
		Date dt = new java.util.Date();

		event.setTitle("SNMP TRAP " + dt);
		event.setStatus(Status.OPEN);
		event.setSeverity(Severity.WARN);
		event.getSource().setRef("localhost");
		event.getSource().setType("host");
//		event.setMessage(message.getBody().toString());
//		event.putProperty("message",message.getBody().toString());
		event.putFingerprintField("@title");

		message.setBody(event, RawEvent.class);
	}
}

Remove dead code from SNMP event processing


package controllers;

import play.*;
import play.mvc.*;

import views.html.*;

public class Application extends Controller {

    public Result index() {
        return ok(index.render("Your new application is ready."));
    }

}

package controllers;

import play.*;
import play.mvc.*;

import views.html.*;

public class Application extends Controller {

    public Result index() {
        return ok("Welcome to Breakout API. Nothing to see here by now").as("text/plain");
    }

}

Add custom greeting for index

Add custom greeting for index


package at.ac.tuwien.inso.service;

import at.ac.tuwien.inso.entity.*;
import org.springframework.security.access.prepost.*;
import org.springframework.stereotype.*;

import java.util.*;

@Service
public interface GradeService {

    @PreAuthorize("hasRole('LECTURER')")
    Grade getDefaultGradeForStudentAndCourse(Long studentId, Long courseId);

    @PreAuthorize("hasRole('LECTURER')")
    Grade saveNewGradeForStudentAndCourse(Grade grade);

    @PreAuthorize("hasRole('LECTURER')")
    List<Grade> getGradesForCourseOfLoggedInLecturer(Long courseId);

    @PreAuthorize("hasRole('STUDENT')")
    List<Grade> getGradesForLoggedInStudent();

    Grade getForValidation(String identifier);

    @PreAuthorize("isAuthenticated()")
    List<Grade> findAllOfStudent(Student student);
}

package at.ac.tuwien.inso.service;

import at.ac.tuwien.inso.controller.lecturer.GradeAuthorizationDTO;
import at.ac.tuwien.inso.entity.*;
import org.springframework.security.access.prepost.*;
import org.springframework.stereotype.*;

import java.util.*;

@Service
public interface GradeService {

    @PreAuthorize("hasRole('LECTURER')")
    GradeAuthorizationDTO getDefaultGradeAuthorizationDTOForStudentAndCourse(Long studentId, Long courseId);

    @PreAuthorize("hasRole('LECTURER')")
    Grade saveNewGradeForStudentAndCourse(GradeAuthorizationDTO grade);

    @PreAuthorize("hasRole('LECTURER')")
    List<Grade> getGradesForCourseOfLoggedInLecturer(Long courseId);

    @PreAuthorize("hasRole('STUDENT')")
    List<Grade> getGradesForLoggedInStudent();

    Grade getForValidation(String identifier);

    @PreAuthorize("isAuthenticated()")
    List<Grade> findAllOfStudent(Student student);

    @PreAuthorize("isAuthenticated()")
    List<Mark> getMarkOptions();
}

Refactor for two factor authentification


package io.github.likcoras.asuka;

import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.pircbotx.User;
import lombok.Cleanup;

public class IgnoreManager {

	private Set<String> ignored;
	private Path ignoreFile;

	public IgnoreManager() {
		ignored = Collections.synchronizedSet(new HashSet<String>());
		ignoreFile = Paths.get("ignore.txt");
	}

	public void addIgnored(User user) {
		addIgnored(BotUtil.getId(user));
	}

	public void addIgnored(String user) {
		ignored.add(user);
	}

	public void removeIgnored(User user) {
		removeIgnored(BotUtil.getId(user));
	}

	public void removeIgnored(String user) {
		ignored.remove(user);
	}

	public boolean isIgnored(User user) {
		return ignored.contains(BotUtil.getId(user));
	}

	public void writeFile() throws IOException {
		@Cleanup
		BufferedWriter write = Files.newBufferedWriter(ignoreFile);
		synchronized(ignored) {
			for (String user : ignored)
				write.write(user + "\n");
		}
		write.flush();
	}

}

package io.github.likcoras.asuka;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.pircbotx.User;
import lombok.Cleanup;

public class IgnoreManager {

	private Set<String> ignored;

	public IgnoreManager() {
		ignored = Collections.synchronizedSet(new HashSet<String>());
	}

	public void addIgnored(User user) {
		addIgnored(BotUtil.getId(user));
	}

	public void addIgnored(String user) {
		ignored.add(user);
	}

	public void removeIgnored(User user) {
		removeIgnored(BotUtil.getId(user));
	}

	public void removeIgnored(String user) {
		ignored.remove(user);
	}

	public boolean isIgnored(User user) {
		return ignored.contains(BotUtil.getId(user));
	}

	public void readFile(Path ignoreFile) throws IOException {
		@Cleanup
		BufferedReader read = Files.newBufferedReader(ignoreFile);
		synchronized (ignored) {
			String line;
			while ((line = read.readLine()) != null)
				ignored.add(line);
		}
	}

	public void writeFile(Path ignoreFile) throws IOException {
		@Cleanup
		BufferedWriter write = Files.newBufferedWriter(ignoreFile);
		synchronized (ignored) {
			for (String user : ignored)
				write.write(user + "\n");
		}
		write.flush();
	}

}

Allow reading and writing from a specified Path


package pokefenn.totemic.ceremony;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import pokefenn.totemic.api.ceremony.CeremonyEffectContext;
import pokefenn.totemic.api.ceremony.CeremonyInstance;

public class CeremonyRain extends CeremonyInstance {
    private final boolean doRain;

    public CeremonyRain(boolean doRain) {
        this.doRain = doRain;
    }

    @Override
    public void effect(Level level, BlockPos pos, CeremonyEffectContext context) {
        if(level.isRaining() != doRain) {
            level.getLevelData().setRaining(doRain);
            level.setRainLevel(doRain ? 1.0F : 0.0F);
        }
    }
}

package pokefenn.totemic.ceremony;

import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;
import pokefenn.totemic.api.ceremony.CeremonyEffectContext;
import pokefenn.totemic.api.ceremony.CeremonyInstance;

public class CeremonyRain extends CeremonyInstance {
    private final boolean doRain;

    public CeremonyRain(boolean doRain) {
        this.doRain = doRain;
    }

    @Override
    public void effect(Level level, BlockPos pos, CeremonyEffectContext context) {
        if(level instanceof ServerLevel slevel && slevel.isRaining() != doRain) {
            slevel.setWeatherParameters(
                    doRain ? 0 : 6000, //Clear weather time
                    doRain ? 6000 : 0, //Rain time
                    doRain, //raining
                    false); //thundering
        }
    }
}

Fix rain ceremony not working correctly

Fix rain ceremony not working correctly


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

import static java.util.Locale.US;
import android.text.TextUtils;

/**
 * Utilities for dealing with Markdown files
 */
public class MarkdownUtils {

  private static final String[] MARKDOWN_EXTENSIONS = { ".md", ".mkdn",
          ".mdwn", ".mdown", ".markdown", ".mkd", ".mkdown", ".ron" };

  /**
   * Is the the given file name a Markdown file?
   *
   * @param name
   * @return true if the name has a markdown extension, false otherwise
   */
  public static boolean isMarkdown(String name) {
      if (TextUtils.isEmpty(name))
          return false;

      name = name.toLowerCase(US);
      for (String extension : MARKDOWN_EXTENSIONS)
          if (name.endsWith(extension))
              return true;

      return false;
  }
}

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

import static java.util.Locale.US;
import android.text.TextUtils;

/**
 * Utilities for dealing with Markdown files
 */
public class MarkdownUtils {

    // List of officially supported markup formats: https://github.com/github/markup
    private static final String[] MARKDOWN_EXTENSIONS = {
            ".markdown", ".mdown", ".mkdn", ".md",
            ".textile",
            ".rdoc",
            ".org",
            ".creole",
            ".mediawiki", ".wiki ",
            ".rst",
            ".asciidoc", ".adoc", ".asc",
            ".pod"
    };

    /**
     * Is the the given file name a Markdown file?
     *
     * @param name
     * @return true if the name has a markdown extension, false otherwise
     */
    public static boolean isMarkdown(String name) {
        if (TextUtils.isEmpty(name))
            return false;

        name = name.toLowerCase(US);
        for (String extension : MARKDOWN_EXTENSIONS)
            if (name.endsWith(extension))
                return true;

        return false;
    }
}

Update the list of supported markup formats

CC #75


package com.ternaryop.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.RelativeLayout;

/**
 * Used to select items in listView
 * @author dave
 *
 */
public class CheckableRelativeLayout extends RelativeLayout implements Checkable {
	private boolean isChecked;

	public CheckableRelativeLayout(Context context, AttributeSet attrs,
			int defStyle) {
		super(context, attrs, defStyle);
	}

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

	public CheckableRelativeLayout(Context context, int checkableId) {
		super(context);
	}

	public boolean isChecked() {
		return isChecked;
	}

	public void setChecked(boolean isChecked) {
		this.isChecked = isChecked;
		setSelected(isChecked);
	}

	public void toggle() {
		setChecked(!isChecked);
	}
}

package com.ternaryop.widget;

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

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Checkable;
import android.widget.RelativeLayout;

/**
 * Used to select items in listView
 *
 * @author dave
 *
 */
public class CheckableRelativeLayout extends RelativeLayout implements Checkable {
    private boolean isChecked;
    private List<Checkable> checkableViews;

    public CheckableRelativeLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
    }

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

    public CheckableRelativeLayout(Context context, int checkableId) {
        super(context);
        init();
    }

    private void init() {
        checkableViews = new ArrayList<Checkable>();
    }

    public boolean isChecked() {
        return isChecked;
    }

    public void setChecked(boolean checked) {
        isChecked = checked;
        setSelected(isChecked);
        for (Checkable c : checkableViews) {
            c.setChecked(checked);
        }
    }

    public void toggle() {
        isChecked = !isChecked;
        setSelected(isChecked);
        for (Checkable c : checkableViews) {
            c.toggle();
        }
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        final int childCount = this.getChildCount();
        for (int i = 0; i < childCount; ++i) {
            findCheckableChildren(this.getChildAt(i));
        }
    }

    private void findCheckableChildren(View v) {
        if (v instanceof Checkable) {
            checkableViews.add((Checkable) v);
        }
        if (v instanceof ViewGroup) {
            final ViewGroup vg = (ViewGroup) v;
            final int childCount = vg.getChildCount();
            for (int i = 0; i < childCount; ++i) {
                findCheckableChildren(vg.getChildAt(i));
            }
        }
    }
}

Set checked state for Checkable children


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

import java.io.Closeable;
import java.io.File;

import static com.google.common.io.Files.createTempDir;
import static io.airlift.testing.FileUtils.deleteRecursively;

class TempFile
        implements Closeable
{
    private final File tempDir;
    private final File file;

    public TempFile()
    {
        tempDir = createTempDir();
        tempDir.mkdirs();
        file = new File(tempDir, "data.rcfile");
    }

    public File getFile()
    {
        return file;
    }

    @Override
    public void close()
    {
        // hadoop creates crc files that must be deleted also, so just delete the whole directory
        deleteRecursively(tempDir);
    }
}

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

import java.io.Closeable;
import java.io.File;

import static com.google.common.io.Files.createTempDir;
import static io.airlift.testing.FileUtils.deleteRecursively;

class TempFile
        implements Closeable
{
    private final File tempDir;
    private final File file;

    public TempFile()
    {
        tempDir = createTempDir();
        tempDir.mkdirs();
        file = new File(tempDir, "data.orc");
    }

    public File getFile()
    {
        return file;
    }

    @Override
    public void close()
    {
        // hadoop creates crc files that must be deleted also, so just delete the whole directory
        deleteRecursively(tempDir);
    }
}

Fix typo in test ORC temp file name

Fix typo in test ORC temp file name


package com.ippon.jug.slip;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.file.Files;
import java.nio.file.Paths;

@RestController
public class SlipController {

    @RequestMapping(value = "/request")
    public String getRequest() throws InterruptedException, UnknownHostException {
        this.doSlip();

        StringBuilder builder = new StringBuilder()
                .append("Hello I'm ")
                .append(InetAddress.getLocalHost().getHostName())
                .append(". My little secret is ... ");
        try {
            Files.readAllLines(Paths.get("/run/secrets/bdx"))
                    .forEach(builder::append);
        } catch (IOException e) {
            // No secret here
            builder.append(" UNKNOWN !");
        }
        return builder.toString();
    }

    private static final int SLEEP_MILLIS = 50;

    private synchronized void doSlip() throws InterruptedException {
        Thread.sleep(SLEEP_MILLIS);
    }

    @RequestMapping(value = "/dockerHealth")
    public ResponseEntity<Void> getHealth() {
        return new ResponseEntity<Void>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
}

package com.ippon.jug.slip;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.file.Files;
import java.nio.file.Paths;

@RestController
public class SlipController {

    @RequestMapping(value = "/request")
    public String getRequest() throws InterruptedException, UnknownHostException {
        this.doSlip();

        StringBuilder builder = new StringBuilder()
                .append("Hello I'm ")
                .append(InetAddress.getLocalHost().getHostName())
                .append(". My little secret is ... ");
        try {
            Files.readAllLines(Paths.get("/run/secrets/bdx"))
                    .forEach(builder::append);
        } catch (IOException e) {
            // No secret here
            builder.append(" UNKNOWN !");
        }
        return builder.toString();
    }

    private static final int SLEEP_MILLIS = 50;

    private synchronized void doSlip() throws InterruptedException {
        Thread.sleep(SLEEP_MILLIS);
    }

    @RequestMapping(value = "/dockerHealth")
    public ResponseEntity<Void> getHealth() {
        return new ResponseEntity<Void>(HttpStatus.OK);
    }
}

Set to OK the answer of docker health endpoint


package com.github.solairerove.woodstock.domain;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

/**
 * Created by krivitski-no on 10/1/16.
 */
@Data
@Document
public class Task implements Serializable {

    @Id
    private String id;

    private String question;
    private Boolean enable;
    private Boolean correct;
    private Collection<? extends Ticket> tickets = new ArrayList<>();

    public Task() {
    }

    public Task(String question, Collection<? extends Ticket> tickets) {
        this.question = question;
        this.enable = true;
        this.correct = false;
        this.tickets = tickets;
    }

    public Task(String question, Boolean enable, Boolean correct, Collection<? extends Ticket> tickets) {
        this.question = question;
        this.enable = enable;
        this.correct = correct;
        this.tickets = tickets;
    }
}

package com.github.solairerove.woodstock.domain;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

/**
 * Created by krivitski-no on 10/1/16.
 */
@Data
@Document
public class Task implements Serializable {

    @Id
    private String id;

    private String question;
    private Boolean enable;
    private Boolean correct;
    private Collection<? extends Ticket> tickets = new ArrayList<>();

    public Task() {
    }

    public Task(String question, Collection<? extends Ticket> tickets) {
        this.question = question;
        this.enable = Boolean.TRUE;
        this.correct = Boolean.FALSE;
        this.tickets = tickets;
    }

    public Task(String question, Boolean enable, Boolean correct, Collection<? extends Ticket> tickets) {
        this.question = question;
        this.enable = enable;
        this.correct = correct;
        this.tickets = tickets;
    }
}

Change primitive to object in task model


package info.u_team.u_team_core.data;

import java.util.function.*;

import net.minecraft.data.*;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;

public class GenerationData {

	private final String modid;
	private final DataGenerator generator;
	private final ExistingFileHelper existingFileHelper;

	private CommonBlockTagsProvider blockTagsProvider;

	public GenerationData(String modid, GatherDataEvent event) {
		this(modid, event.getGenerator(), event.getExistingFileHelper());
	}

	public GenerationData(String modid, DataGenerator generator, ExistingFileHelper existingFileHelper) {
		this.modid = modid;
		this.generator = generator;
		this.existingFileHelper = existingFileHelper;
	}

	public String getModid() {
		return modid;
	}

	public DataGenerator getGenerator() {
		return generator;
	}

	public ExistingFileHelper getExistingFileHelper() {
		return existingFileHelper;
	}

	public void addProvider(Function<GenerationData, IDataProvider> function) {
		final IDataProvider provider = function.apply(this);
		if (provider instanceof CommonBlockTagsProvider) {
			blockTagsProvider = (CommonBlockTagsProvider) provider;
		}
		generator.addProvider(provider);
	}

	public void addProvider(BiFunction<GenerationData, CommonBlockTagsProvider, IDataProvider> function) {
		generator.addProvider(function.apply(this, blockTagsProvider));
	}

}

package info.u_team.u_team_core.data;

import java.util.function.*;

import net.minecraft.data.*;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;

public class GenerationData {

	private final String modid;
	private final DataGenerator generator;
	private final ExistingFileHelper existingFileHelper;

	private CommonBlockTagsProvider blockTagsProvider;

	public GenerationData(String modid, GatherDataEvent event) {
		this(modid, event.getGenerator(), new ExistingFileHelperWithForge(event.getExistingFileHelper()));
	}

	public GenerationData(String modid, DataGenerator generator, ExistingFileHelper existingFileHelper) {
		this.modid = modid;
		this.generator = generator;
		this.existingFileHelper = existingFileHelper;
	}

	public String getModid() {
		return modid;
	}

	public DataGenerator getGenerator() {
		return generator;
	}

	public ExistingFileHelper getExistingFileHelper() {
		return existingFileHelper;
	}

	public void addProvider(Function<GenerationData, IDataProvider> function) {
		final IDataProvider provider = function.apply(this);
		if (provider instanceof CommonBlockTagsProvider) {
			blockTagsProvider = (CommonBlockTagsProvider) provider;
		}
		generator.addProvider(provider);
	}

	public void addProvider(BiFunction<GenerationData, CommonBlockTagsProvider, IDataProvider> function) {
		generator.addProvider(function.apply(this, blockTagsProvider));
	}

}

Use the new existing file helper with forge in the generation data now


package com.mapswithme.maps.api;

import android.content.Context;
import android.content.Intent;

// TODO add javadoc for public interface
public class MWMResponse
{
  private MWMPoint mPoint;

  public MWMPoint getPoint()     { return mPoint; }
  public boolean  hasPoint()     { return mPoint != null; }

  @Override
  public String toString()
  {
    return "MWMResponse [mSelectedPoint=" + mPoint + "]";
  }

  static MWMResponse extractFromIntent(Context context, Intent intent)
  {
    final MWMResponse response = new MWMResponse();
    // parse status
    // parse point
    final double lat = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LAT, 0);
    final double lon = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LON, 0);
    final String name = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_NAME);
    final String id = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_ID);
    response.mPoint = new MWMPoint(lat, lon, name, id);

    return response;
  }

  private MWMResponse() {}
}

package com.mapswithme.maps.api;

import android.content.Context;
import android.content.Intent;

// TODO add javadoc for public interface
public class MWMResponse
{
  private MWMPoint mPoint;

  public MWMPoint getPoint()     { return mPoint; }
  public boolean  hasPoint()     { return mPoint != null; }

  @Override
  public String toString()
  {
    return "MWMResponse [mSelectedPoint=" + mPoint + "]";
  }

  public static MWMResponse extractFromIntent(Context context, Intent intent)
  {
    final MWMResponse response = new MWMResponse();
    // parse status
    // parse point
    final double lat = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LAT, 0);
    final double lon = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LON, 0);
    final String name = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_NAME);
    final String id = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_ID);
    response.mPoint = new MWMPoint(lat, lon, name, id);

    return response;
  }

  private MWMResponse() {}
}

Access modifier fix for android API

[android] Access modifier fix for android API


package org.irmacard.api.common;

public class ClientRequest<T> {
	private int timeout = 0;
	private String data;
	private T request;

	public ClientRequest() {}

	public ClientRequest(String data, T request) {
		this.request = request;
		this.data = data;
	}

	public ClientRequest(String data, T request, int timeout) {
		this.timeout = timeout;
		this.request = request;
		this.data = data;
	}

	public int getTimeout() {
		return timeout;
	}

	public void setTimeout(int timeout) {
		this.timeout = timeout;
	}

	public T getRequest() {
		return request;
	}

	public String getData() {
		return data;
	}
}

package org.irmacard.api.common;

public class ClientRequest<T> {
	private int timeout = 0;
	private String data;
	private T request;
	private String callbackUrl;

	public ClientRequest() {}

	public ClientRequest(String data, T request) {
		this.request = request;
		this.data = data;
	}

	public ClientRequest(String data, T request, int timeout) {
		this.timeout = timeout;
		this.request = request;
		this.data = data;
	}

	public ClientRequest(String data, T request, int timeout, String callbackUrl) {
		this(data, request, timeout);
		this.callbackUrl = callbackUrl;
	}

	public String getCallbackUrl() {
		return callbackUrl;
	}

	public int getTimeout() {
		return timeout;
	}

	public void setTimeout(int timeout) {
		this.timeout = timeout;
	}

	public T getRequest() {
		return request;
	}

	public String getData() {
		return data;
	}
}

Add support for callback urls

Add support for callback urls


// Copyright 2018 The Nomulus Authors. 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.
// See the License for the specific language governing permissions and
// limitations under the License.

package google.registry.tools;

import com.beust.jcommander.Parameters;
import google.registry.beam.spec11.Spec11Pipeline;
import javax.inject.Inject;

/** Nomulus command that deploys the {@link Spec11Pipeline} template. */
@Parameters(commandDescription = "Deploy the invoicing pipeline to GCS.")
public class DeploySpec11PipelineCommand implements Command {

  @Inject Spec11Pipeline spec11Pipeline;

  @Override
  public void run() {
    spec11Pipeline.deploy();
  }
}

// Copyright 2018 The Nomulus Authors. 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.
// See the License for the specific language governing permissions and
// limitations under the License.

package google.registry.tools;

import com.beust.jcommander.Parameters;
import google.registry.beam.spec11.Spec11Pipeline;
import javax.inject.Inject;

/** Nomulus command that deploys the {@link Spec11Pipeline} template. */
@Parameters(commandDescription = "Deploy the Spec11 pipeline to GCS.")
public class DeploySpec11PipelineCommand implements Command {

  @Inject Spec11Pipeline spec11Pipeline;

  @Override
  public void run() {
    spec11Pipeline.deploy();
  }
}

Correct wrong description of command

Correct wrong description of command

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=212641409


package org.bouncycastle.asn1;

import java.io.EOFException;
import java.io.InputStream;
import java.io.IOException;

class DefiniteLengthInputStream
        extends LimitedInputStream
{
    private int               _length;

    DefiniteLengthInputStream(
        InputStream in,
        int         length)
    {
        super(in);

        if (length < 0)
        {
            throw new IllegalArgumentException("negative lengths not allowed");
        }

        this._length = length;
    }

    public int read()
        throws IOException
    {
        if (_length > 0)
        {
            int b = _in.read();

            if (b < 0)
            {
                throw new EOFException();
            }

            --_length;
            return b;
        }

        setParentEofDetect(true);

        return -1;
    }

    byte[] toByteArray()
        throws IOException
    {
        byte[] bytes = new byte[_length];

        if (_length > 0)
        {
            int pos = 0;
            do
            {
                int read = _in.read(bytes, pos, _length - pos);

                if (read < 0)
                {
                    throw new EOFException();
                }

                pos += read;
            }
            while (pos < _length);

            _length = 0;
        }

        setParentEofDetect(true);

        return bytes;
    }
}

package org.bouncycastle.asn1;

import java.io.EOFException;
import java.io.InputStream;
import java.io.IOException;

class DefiniteLengthInputStream
        extends LimitedInputStream
{
    private int               _length;

    DefiniteLengthInputStream(
        InputStream in,
        int         length)
    {
        super(in);

        if (length < 0)
        {
            throw new IllegalArgumentException("negative lengths not allowed");
        }

        this._length = length;
    }

    public int read()
        throws IOException
    {
        if (_length > 0)
        {
            int b = _in.read();

            if (b < 0)
            {
                throw new EOFException();
            }

            --_length;
            return b;
        }

        setParentEofDetect(true);

        return -1;
    }

    public int read(byte[] buf, int off, int len)
        throws IOException
    {
        if (_length > 0)
        {
            int toRead = Math.min(len, _length);
            int numRead = _in.read(buf, off, toRead);

            if (numRead < 0)
                throw new EOFException();

            _length -= numRead;
            return numRead;
        }

        setParentEofDetect(true);

        return -1;
    }

    byte[] toByteArray()
        throws IOException
    {
        byte[] bytes = new byte[_length];

        if (_length > 0)
        {
            int pos = 0;
            do
            {
                int read = _in.read(bytes, pos, _length - pos);

                if (read < 0)
                {
                    throw new EOFException();
                }

                pos += read;
            }
            while (pos < _length);

            _length = 0;
        }

        setParentEofDetect(true);

        return bytes;
    }
}

Add extra read(...) method for performance


package org.myrobotlab.document.transformer;

import org.myrobotlab.document.transformer.StageConfiguration;

import java.util.List;

import org.myrobotlab.document.Document;

/**
 * This stage will rename the field on a document.
 * @author kwatters
 *
 */
public class RenameField extends AbstractStage {

	private String oldName = "fielda";
	private String newName = "fieldb";
	@Override
	public void startStage(StageConfiguration config) {
		// TODO Auto-generated method stub
		if (config != null) {
			oldName = config.getProperty("oldName");
			newName = config.getProperty("newName");
		}
	}

	@Override
	public List<Document> processDocument(Document doc) {
		if (!doc.hasField(oldName)) {
			return null;
		}
		doc.addToField(newName, doc.getField(oldName));
		doc.removeField(oldName);
		return null;
	}

	@Override
	public void stopStage() {
		// TODO Auto-generated method stub

	}

	@Override
	public void flush() {
		// TODO Auto-generated method stub

	}

}

package org.myrobotlab.document.transformer;

import org.myrobotlab.document.transformer.StageConfiguration;

import java.util.List;

import org.myrobotlab.document.Document;

/**
 * This stage will rename the field on a document.
 * @author kwatters
 *
 */
public class RenameField extends AbstractStage {

	private String oldName = "fielda";
	private String newName = "fieldb";
	@Override
	public void startStage(StageConfiguration config) {
		// TODO Auto-generated method stub
		if (config != null) {
			oldName = config.getProperty("oldName");
			newName = config.getProperty("newName");
		}
	}

	@Override
	public List<Document> processDocument(Document doc) {
		if (!doc.hasField(oldName)) {
			return null;
		}
		for (Object o : doc.getField(oldName)) {
			doc.addToField(newName, o);
		}
		doc.removeField(oldName);
		return null;
	}

	@Override
	public void stopStage() {
		// TODO Auto-generated method stub

	}

	@Override
	public void flush() {
		// TODO Auto-generated method stub

	}

}

Add values to new field one at a time to avoid adding an ArrayList object.