package arez.spytools;

import arez.spy.ComponentInfo;
import arez.spy.ComputedValueInfo;
import arez.spy.ObservableInfo;
import arez.spy.ObserverInfo;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.realityforge.guiceyloops.shared.ValueUtil;

final class NullObserverInfo
  implements ObserverInfo
{
  @Override
  public boolean isRunning()
  {
    return false;
  }

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

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

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

  @Override
  public ComputedValueInfo asComputedValue()
  {
    return null;
  }

  @Nonnull
  @Override
  public List<ObservableInfo> getDependencies()
  {
    return Collections.emptyList();
  }

  @Nullable
  @Override
  public ComponentInfo getComponent()
  {
    return null;
  }

  @Nonnull
  @Override
  public String getName()
  {
    return ValueUtil.randomString();
  }

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

package arez.spytools;

import arez.Priority;
import arez.spy.ComponentInfo;
import arez.spy.ComputedValueInfo;
import arez.spy.ObservableInfo;
import arez.spy.ObserverInfo;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.realityforge.guiceyloops.shared.ValueUtil;

final class NullObserverInfo
  implements ObserverInfo
{
  @Override
  public boolean isRunning()
  {
    return false;
  }

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

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

  @Nonnull
  @Override
  public Priority getPriority()
  {
    return Priority.NORMAL;
  }

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

  @Override
  public ComputedValueInfo asComputedValue()
  {
    return null;
  }

  @Nonnull
  @Override
  public List<ObservableInfo> getDependencies()
  {
    return Collections.emptyList();
  }

  @Nullable
  @Override
  public ComponentInfo getComponent()
  {
    return null;
  }

  @Nonnull
  @Override
  public String getName()
  {
    return ValueUtil.randomString();
  }

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

Update to the latest API

Update to the latest API


/*
 * Copyright (c) 2011-2019 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
 * Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.
 */
package com.terracottatech.dynamic_config.nomad;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.terracottatech.nomad.client.change.MultipleNomadChanges;
import com.terracottatech.nomad.client.change.NomadChange;
import com.terracottatech.nomad.client.change.SimpleNomadChange;
import com.terracottatech.utilities.Json;

/**
 * @author Mathieu Carbou
 */
public class NomadJson {

  public static ObjectMapper buildObjectMapper() {
    ObjectMapper objectMapper = Json.copyObjectMapper(true);
    objectMapper.registerSubtypes(
        NomadChange.class,
        FilteredNomadChange.class,
        ConfigMigrationNomadChange.class,
        ConfigRepairNomadChange.class,
        ClusterActivationNomadChange.class,
        SettingNomadChange.class,
        MultipleNomadChanges.class,
        SimpleNomadChange.class);
    return objectMapper;
  }

}

/*
 * Copyright (c) 2011-2019 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
 * Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.
 */
package com.terracottatech.dynamic_config.nomad;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.terracottatech.nomad.client.change.MultipleNomadChanges;
import com.terracottatech.nomad.client.change.NomadChange;
import com.terracottatech.nomad.client.change.SimpleNomadChange;
import com.terracottatech.utilities.Json;

/**
 * @author Mathieu Carbou
 */
public class NomadJson {

  public static ObjectMapper buildObjectMapper() {
    ObjectMapper objectMapper = Json.copyObjectMapper(true);
    objectMapper.registerSubtypes(
        NomadChange.class,
        FilteredNomadChange.class,
        ConfigMigrationNomadChange.class,
        ConfigRepairNomadChange.class,
        ClusterActivationNomadChange.class,
        SettingNomadChange.class,
        MultipleNomadChanges.class,
        SimpleNomadChange.class);
    return objectMapper.copy();
  }

}

TDB-4594: Return a copy of Nomad object mappper for protection


/**
    Copyright 2017 Andrea "Stock" Stocchero

    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.pepstock.charba.client.enums;

import org.pepstock.charba.client.commons.Key;

/**
 * Property to set if the line is shown as a stepped line.
 *
 * @author Andrea "Stock" Stocchero
 */
public enum SteppedLine implements Key
{

	/**
	 * Step-before Interpolation
	 */
	before,
	/**
	 * Step-after Interpolation
	 */
	after,
	/**
	 * No Step Interpolation (default)
	 */
	nosteppedline;

}

/**
    Copyright 2017 Andrea "Stock" Stocchero

    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.pepstock.charba.client.enums;

import org.pepstock.charba.client.commons.Key;

/**
 * Property to set if the line is shown as a stepped line.
 *
 * @author Andrea "Stock" Stocchero
 */
public enum SteppedLine implements Key
{

	/**
	 * Step-before Interpolation
	 */
	before,
	/**
	 * Step-after Interpolation
	 */
	after,
	/**
	 * Step-middle Interpolation
	 */
	middle,
	/**
	 * No Step Interpolation (default)
	 */
	nosteppedline;

}

Add midpoint interpolation to stepped line


package org.scalaxb.maven.it;

import org.junit.Test;

public class ITP03WSDL extends AbstractIT {

    private String[] expected = new String[] {
            "generated/stockquote.scala",
            "generated/xmlprotocol.scala",
            "scalaxb/httpclients_dispatch.scala",
            "scalaxb/scalaxb.scala",
            "scalaxb/soap.scala",
            "soapenvelope12/soapenvelope12.scala",
            "soapenvelope12/soapenvelope12_xmlprotocol.scala"
    };

    @Test
    public void filesAreGeneratedInCorrectLocation() {
        assertFilesGenerated("itp03-wsdl", expected);
    }

}

package org.scalaxb.maven.it;

import org.junit.Test;

public class ITP03WSDL extends AbstractIT {

    private String[] expected = new String[] {
            "generated/stockquote.scala",
            "generated/xmlprotocol.scala",
            "scalaxb/httpclients_dispatch.scala",
            "scalaxb/scalaxb.scala",
            "scalaxb/soap12.scala",
            "soapenvelope12/soapenvelope12.scala",
            "soapenvelope12/soapenvelope12_xmlprotocol.scala"
    };

    @Test
    public void filesAreGeneratedInCorrectLocation() {
        assertFilesGenerated("itp03-wsdl", expected);
    }

}

Update WSDL integration test for 0.6.7

Update WSDL integration test for 0.6.7

The generated soap.scala file is now named soap12.scala.


/*
 * Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
 * and other contributors as indicated by the @author tags.
 *
 * 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.hawkular.metrics.core.impl.mapper;

import org.hawkular.metrics.core.api.NumericMetric;

import com.google.common.base.Function;

/**
 * @author John Sanda
 */
public abstract class MetricMapper<T> implements Function<NumericMetric, T> {

    @Override
    public T apply(NumericMetric metric) {
        if (metric == null) {
            throw new NoResultsException();
        }
        return doApply(metric);
    }

    abstract T doApply(NumericMetric metric);
}

/*
 * Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
 * and other contributors as indicated by the @author tags.
 *
 * 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.hawkular.metrics.core.impl.mapper;

import org.hawkular.metrics.core.api.NumericMetric;

import com.google.common.base.Function;

/**
 * @author John Sanda
 */
public abstract class MetricMapper<T> implements Function<NumericMetric, T> {

    @Override
    public T apply(NumericMetric metric) {
        if (metric == null) {
            throw new NoResultsException();
        }
        return doApply(metric);
    }

    public abstract T doApply(NumericMetric metric);
}

Fix method visibility after refactoring.


package com.tterrag.blur.config;

import javax.annotation.Nonnull;

import com.tterrag.blur.Blur;

import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.Tessellator;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.GuiConfigEntries;

public class BlurConfigGui extends GuiConfig {

    public BlurConfigGui(GuiScreen parentScreen) {
        super(parentScreen, new ConfigElement(Blur.instance.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Blur.MODID, false, false, Blur.MODID + ".config.title");
    }

    @Override
    public void initGui() {
        super.initGui();
        this.entryList = new GuiConfigEntries(this, mc) {
            @SuppressWarnings({ "unused", "null" })
            @Override
            protected void drawContainerBackground(@Nonnull Tessellator tessellator) {
                if (mc.world == null) {
                    super.drawContainerBackground(tessellator);
                }
            }
        };
    }

    @Override
    public void drawDefaultBackground() {
        drawWorldBackground(0);
    }
}

package com.tterrag.blur.config;

import javax.annotation.Nonnull;

import com.tterrag.blur.Blur;

import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.Tessellator;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.GuiConfigEntries;

public class BlurConfigGui extends GuiConfig {

    public BlurConfigGui(GuiScreen parentScreen) {
        super(parentScreen, new ConfigElement(Blur.instance.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Blur.MODID, false, false, Blur.MODID + ".config.title");
    }

    @Override
    public void initGui() {
        if (this.entryList == null || this.needsRefresh)
        {
            this.entryList = new GuiConfigEntries(this, mc) {
                @SuppressWarnings({ "unused", "null" })
                @Override
                protected void drawContainerBackground(@Nonnull Tessellator tessellator) {
                    if (mc.world == null) {
                        super.drawContainerBackground(tessellator);
                    }
                }
            };
            this.needsRefresh = false;
        }
        super.initGui();
    }

    @Override
    public void drawDefaultBackground() {
        drawWorldBackground(0);
    }
}

Fix array configs not saving in config GUI


package info.u_team.u_team_test.init;

import info.u_team.u_team_core.util.TagUtil;
import info.u_team.u_team_test.TestMod;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.tags.ITag.INamedTag;

public class TestTags {

	public static class Blocks {

		public static INamedTag<Block> TEST_TAG_1 = TagUtil.createBlockTag(TestMod.MODID, "test_1");
		public static INamedTag<Block> TEST_TAG_2 = TagUtil.createBlockTag(TestMod.MODID, "test_2");
	}

	public static class Items {

		public static INamedTag<Item> TEST_TAG_1 = TagUtil.fromBlockTag(Blocks.TEST_TAG_1);
		public static INamedTag<Item> TEST_TAG_2 = TagUtil.fromBlockTag(Blocks.TEST_TAG_2);
		public static INamedTag<Item> TEST_TAG_3 = TagUtil.createItemTag(TestMod.MODID, "test_3");
	}

}

package info.u_team.u_team_test.init;

import info.u_team.u_team_core.util.TagUtil;
import info.u_team.u_team_test.TestMod;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.tags.ITag.INamedTag;

public class TestTags {

	public static class Blocks {

		public static INamedTag<Block> TEST_TAG_1 = TagUtil.createBlockTag(TestMod.MODID, "test_1");
		public static INamedTag<Block> TEST_TAG_2 = TagUtil.createBlockTag(TestMod.MODID, "test_2");
	}

	public static class Items {

		public static INamedTag<Item> TEST_TAG_1 = TagUtil.fromBlockTag(Blocks.TEST_TAG_1);
		public static INamedTag<Item> TEST_TAG_2 = TagUtil.fromBlockTag(Blocks.TEST_TAG_2);
		public static INamedTag<Item> TEST_TAG_3 = TagUtil.createItemTag(TestMod.MODID, "test_3");
		public static INamedTag<Item> TEST_TAG_4 = TagUtil.createItemTag(TestMod.MODID, "test_4");
	}

}

Add test test tag 4 to the item tags

Add test test tag 4 to the item tags


package de.simonscholz.nonjavadoc.handlers;

import javax.inject.Named;

import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.viewers.IStructuredSelection;

import de.simonscholz.nonjavadoc.jobs.NonJavaDocJob;

public class NonJavaDocRemoverHandler {

	@Execute
	public Object execute(
			@Optional @Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection) {
		if (selection != null && !selection.isEmpty()) {
			NonJavaDocJob job = new NonJavaDocJob(selection.toList());
			job.schedule();
		}

		return null;
	}

}

package de.simonscholz.nonjavadoc.handlers;

import javax.inject.Named;

import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.viewers.IStructuredSelection;

import de.simonscholz.nonjavadoc.jobs.NonJavaDocJob;

public class NonJavaDocRemoverHandler {

	@Execute
	public void execute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection) {
		if (selection != null && !selection.isEmpty()) {
			NonJavaDocJob job = new NonJavaDocJob(selection.toList());
			job.schedule();
		}

	}

}

Clean up of handler code

Clean up of handler code

return is not required


package hudson.plugins.git.extensions.impl;

import hudson.Extension;
import hudson.Util;
import hudson.plugins.git.extensions.FakeGitSCMExtension;
import hudson.plugins.git.extensions.GitSCMExtensionDescriptor;
import org.kohsuke.stapler.DataBoundConstructor;

/**
 * The Git plugin checks code out to a detached head.  Configure
 * LocalBranch to force checkout to a specific local branch.
 * Configure this extension as null or as "**" to signify that
 * the local branch name should be the same as the remote branch
 * name sans the remote repository prefix (origin for example).
 *
 * @author Kohsuke Kawaguchi
 */
public class LocalBranch extends FakeGitSCMExtension {
    private String localBranch;

    @DataBoundConstructor
    public LocalBranch(String localBranch) {
        this.localBranch = Util.fixEmptyAndTrim(localBranch);
    }

    public String getLocalBranch() {
        return localBranch;
    }

    @Extension
    public static class DescriptorImpl extends GitSCMExtensionDescriptor {
        @Override
        public String getDisplayName() {
            return "Check out to specific local branch, null to use remote branch name.";
        }
    }
}

package hudson.plugins.git.extensions.impl;

import hudson.Extension;
import hudson.Util;
import hudson.plugins.git.extensions.FakeGitSCMExtension;
import hudson.plugins.git.extensions.GitSCMExtensionDescriptor;
import org.kohsuke.stapler.DataBoundConstructor;

/**
 * The Git plugin checks code out to a detached head.  Configure
 * LocalBranch to force checkout to a specific local branch.
 * Configure this extension as null or as "**" to signify that
 * the local branch name should be the same as the remote branch
 * name sans the remote repository prefix (origin for example).
 *
 * @author Kohsuke Kawaguchi
 */
public class LocalBranch extends FakeGitSCMExtension {
    private String localBranch;

    @DataBoundConstructor
    public LocalBranch(String localBranch) {
        this.localBranch = Util.fixEmptyAndTrim(localBranch);
    }

    public String getLocalBranch() {
        return localBranch;
    }

    @Extension
    public static class DescriptorImpl extends GitSCMExtensionDescriptor {
        @Override
        public String getDisplayName() {
            return "Check out to specific local branch";
        }
    }
}

Remove extra text per pull request comment.


package org.mwc.cmap.naturalearth.preferences;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;

import org.mwc.cmap.naturalearth.Activator;

/**
 * Class used to initialize default preference values.
 */
public class PreferenceInitializer extends AbstractPreferenceInitializer
{

	/*
	 * (non-Javadoc)
	 *
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
	 * initializeDefaultPreferences()
	 */
	public void initializeDefaultPreferences()
	{
		IPreferenceStore store = Activator.getDefault().getPreferenceStore();
		store.setDefault(PreferenceConstants.DATA_FOLDER, "");
		store.setDefault(PreferenceConstants.MEMORY_MAPPED, true);
	}

}

package org.mwc.cmap.naturalearth.preferences;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;

import org.mwc.cmap.naturalearth.Activator;

/**
 * Class used to initialize default preference values.
 */
public class PreferenceInitializer extends AbstractPreferenceInitializer
{

	/*
	 * (non-Javadoc)
	 *
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
	 * initializeDefaultPreferences()
	 */
	public void initializeDefaultPreferences()
	{
		IPreferenceStore store = Activator.getDefault().getPreferenceStore();
		store.setDefault(PreferenceConstants.DATA_FOLDER, "NaturalEarth");
		store.setDefault(PreferenceConstants.MEMORY_MAPPED, true);
	}

}

Set the default path for NE to be in the project folder.


package android.widget;

import com.google.gwt.user.client.Element;

import android.view.ViewGroup;

public class LinearLayout extends ViewGroup {

	public LinearLayout(Element element) {
		super(element);
	}

}

package android.widget;

import com.google.gwt.dom.client.Element;

import android.view.ViewGroup;

public class LinearLayout extends ViewGroup {

	public LinearLayout(Element element) {
		super(element);
	}

}

Use not deprecated Element Object

Use not deprecated Element Object


package com.novoda.downloadmanager;

/**
 * Builds instances of {@link Batch} using a fluent API.
 */
public interface BatchBuilder {

    /**
     * Sets {@link BatchFileBuilder} to build a {@link Batch} that will download a {@link BatchFile}
     * from a given  networkAddress.
     *
     * @param networkAddress to download file from.
     * @return {@link BatchFileBuilder}.
     */
    BatchFileBuilder downloadFrom(String networkAddress);

    /**
     * Build a new {@link Batch} instance.
     *
     * @return an instance of {@link Batch}.
     */
    Batch build();

    static BatchBuilder from(Batch batch) {
        InternalBatchBuilder builder = (InternalBatchBuilder) Batch.with(batch.storageRoot(), batch.downloadBatchId(), batch.title());
        for (BatchFile batchFile : batch.batchFiles()) {
            builder.withFile(batchFile);
        }
        return builder;
    }
}

package com.novoda.downloadmanager;

/**
 * Builds instances of {@link Batch} using a fluent API.
 */
public interface BatchBuilder {

    /**
     * Sets {@link BatchFileBuilder} to build a {@link Batch} that will download a {@link BatchFile}
     * from a given  networkAddress.
     *
     * @param networkAddress to download file from.
     * @return {@link BatchFileBuilder}.
     */
    BatchFileBuilder downloadFrom(String networkAddress);

    /**
     * Build a new {@link Batch} instance.
     *
     * @return an instance of {@link Batch}.
     */
    Batch build();

    /**
     * Creates a {@link BatchBuilder} from a {@link Batch}.
     *
     * @param batch to create the {@link BatchBuilder} from.
     * @return {@link BatchBuilder}.
     */
    static BatchBuilder from(Batch batch) {
        InternalBatchBuilder builder = (InternalBatchBuilder) Batch.with(batch.storageRoot(), batch.downloadBatchId(), batch.title());
        for (BatchFile batchFile : batch.batchFiles()) {
            builder.withFile(batchFile);
        }
        return builder;
    }
}

Add javadoc to batch builder.

Add javadoc to batch builder.


package com.github.timeu.dygraphsgwt.client.callbacks;

import com.google.gwt.event.dom.client.MouseEvent;
import jsinterop.annotations.JsFunction;

/**
 * Created by uemit.seren on 7/30/15.
 */
@FunctionalInterface
@JsFunction
public interface PointClickCallback {
    /**
     * A function to call when a data point is clicked. and the point that was clicked.
     *
     * @param event Mousevent
     * @param point Point that was clicked
     */
    void onClick(MouseEvent event,Point point);
}

package com.github.timeu.dygraphsgwt.client.callbacks;

import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.MouseEvent;
import jsinterop.annotations.JsFunction;

/**
 * Created by uemit.seren on 7/30/15.
 */
@FunctionalInterface
@JsFunction
public interface PointClickCallback {
    /**
     * A function to call when a data point is clicked. and the point that was clicked.
     *
     * @param event Mousevent
     * @param point Point that was clicked
     */
    void onClick(NativeEvent event, Point point);
}

Use NativEvent instead of MouseEvent

Bugfix: Use NativEvent instead of MouseEvent


package eu.lestard.advanced_bindings.api;

import javafx.beans.binding.Bindings;
import javafx.beans.binding.BooleanBinding;
import javafx.beans.value.ObservableStringValue;

/**
 * This class contains custom binding implementations for Strings.
 */
public class StringBindings {

    /**
     * Creates a boolean binding that is `true` when the given observable string matches the given
     * RegExp pattern.
     *
     * @param text the observable string that is verified.
     * @param pattern the RegExp pattern that is used.
     * @return a boolean binding instance.
     */
    public static BooleanBinding matches(final ObservableStringValue text, final String pattern) {
        return Bindings.createBooleanBinding(()->{
            final String textToVerify = text.get();
            return textToVerify != null && textToVerify.matches(pattern);
        }, text);
    }

    /**
     * Creates a boolean binding that is `true` when the given observable string matches the given
     * RegExp pattern (also given as observable string).
     *
     * @param text the observable string that is verified.
     * @param pattern the observable string with the RegExp pattern that is used.
     * @return a boolean binding instance.
     */
    public static BooleanBinding matches(final ObservableStringValue text, final ObservableStringValue pattern) {
        return Bindings.createBooleanBinding(()->{
            final String textToVerify = text.get();
            final String patternString = pattern.get();

            return textToVerify != null && patternString != null && textToVerify.matches(patternString);
        }, text, pattern);
    }
}

package eu.lestard.advanced_bindings.api;

import javafx.beans.binding.Bindings;
import javafx.beans.binding.BooleanBinding;
import javafx.beans.value.ObservableValue;

/**
 * This class contains custom binding implementations for Strings.
 */
public class StringBindings {

    /**
     * Creates a boolean binding that is `true` when the given observable string matches the given
     * RegExp pattern.
     *
     * @param text the observable string that is verified.
     * @param pattern the RegExp pattern that is used.
     * @return a boolean binding instance.
     */
    public static BooleanBinding matches(final ObservableValue<String> text, final String pattern) {
        return Bindings.createBooleanBinding(()->{
            final String textToVerify = text.getValue();
            return textToVerify != null && textToVerify.matches(pattern);
        }, text);
    }

    /**
     * Creates a boolean binding that is `true` when the given observable string matches the given
     * RegExp pattern (also given as observable string).
     *
     * @param text the observable string that is verified.
     * @param pattern the observable string with the RegExp pattern that is used.
     * @return a boolean binding instance.
     */
    public static BooleanBinding matches(final ObservableValue<String> text, final ObservableValue<String> pattern) {
        return Bindings.createBooleanBinding(()->{
            final String textToVerify = text.getValue();
            final String patternString = pattern.getValue();

            return textToVerify != null && patternString != null && textToVerify.matches(patternString);
        }, text, pattern);
    }
}

Change argument type of regexp binding to ObservableValue<String>


package com.intellij.codeInsight.completion.impl;

import com.intellij.codeInsight.completion.CompletionService;
import com.intellij.codeInsight.completion.PrefixMatcher;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementWeigher;
import com.intellij.codeInsight.lookup.WeighingContext;
import org.jetbrains.annotations.NotNull;

/**
* @author Peter
*/
public class RealPrefixMatchingWeigher extends LookupElementWeigher {

  public RealPrefixMatchingWeigher() {
    super("prefix", false, true);
  }

  @Override
  public Comparable weigh(@NotNull LookupElement element, @NotNull WeighingContext context) {
    return getBestMatchingDegree(element, CompletionService.getItemMatcher(element, context));
  }

  public static int getBestMatchingDegree(LookupElement element, PrefixMatcher matcher) {
    int max = Integer.MIN_VALUE;
    for (String lookupString : element.getAllLookupStrings()) {
      max = Math.max(max, matcher.matchingDegree(lookupString));
    }
    return -max;
  }
}

package com.intellij.codeInsight.completion.impl;

import com.intellij.codeInsight.completion.CompletionService;
import com.intellij.codeInsight.completion.PrefixMatcher;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementWeigher;
import com.intellij.codeInsight.lookup.WeighingContext;
import org.jetbrains.annotations.NotNull;

/**
* @author Peter
*/
public class RealPrefixMatchingWeigher extends LookupElementWeigher {

  public RealPrefixMatchingWeigher() {
    super("prefix", false, true);
  }

  @Override
  public Comparable weigh(@NotNull LookupElement element, @NotNull WeighingContext context) {
    return getBestMatchingDegree(element, CompletionService.getItemMatcher(element, context));
  }

  public static int getBestMatchingDegree(LookupElement element, PrefixMatcher matcher) {
    int max = Integer.MIN_VALUE;
    for (String lookupString : element.getAllLookupStrings()) {
      max = Math.max(max, matcher.matchingDegree(lookupString));
    }
    return max == Integer.MIN_VALUE ? Integer.MAX_VALUE : -max;
  }
}

[completion] Fix sign overflow when comparing matchingDegree

GitOrigin-RevId: eab238ccd73bbb90590e64477d896cec3194c934


package uk.ac.bolton.spaws.model.impl;

import uk.ac.bolton.spaws.model.IParadata;

public abstract class Paradata implements IParadata{

	private String content;
	private String contextUrl;

	/* (non-Javadoc)
	 * @see uk.ac.bolton.spaws.model.IParadata#getContent()
	 */
	public String getContent() {
		return content;
	}

	public void setContent(String content){
		this.content = content;
	}

	/* (non-Javadoc)
	 * @see uk.ac.bolton.spaws.model.IParadata#getContextUrl()
	 */
	public String getContextUrl() {
		return contextUrl;
	}

	public void setContextUrl(String contextUrl){
		this.contextUrl = contextUrl;
	}

}

package uk.ac.bolton.spaws.model.impl;

import uk.ac.bolton.spaws.model.IParadata;

public abstract class Paradata implements IParadata{

	private String content;
	private String contextUrl;

	/* (non-Javadoc)
	 * @see uk.ac.bolton.spaws.model.IParadata#getContent()
	 */
	public String getContent() {
		//
		// We have to use empty string rather than null,
		// as otherwise this causes problems for signing a LR document
		//
		if (content == null) return "";

		return content;
	}

	public void setContent(String content){
		this.content = content;
	}

	/* (non-Javadoc)
	 * @see uk.ac.bolton.spaws.model.IParadata#getContextUrl()
	 */
	public String getContextUrl() {
		return contextUrl;
	}

	public void setContextUrl(String contextUrl){
		this.contextUrl = contextUrl;
	}

}

Return an empty string instead of null for getContent() as otherwise this messes up bencoding


/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
 */
package com.integralblue.hibernate.cache.springcache;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnProperty(name="spring.jpa.properties.hibernate.cache.region.factory_class", havingValue="com.integralblue.hibernate.cache.springcache.SpringCacheRegionFactory")
public class SpringCacheRegionFactoryAutoConfigure {
	@Bean
	protected SpringCacheRegionFactoryBeanPostProcessor springCacheRegionFactoryBeanPostProcessor(){
		return new SpringCacheRegionFactoryBeanPostProcessor();
	}
}

/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
 */
package com.integralblue.hibernate.cache.springcache;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnProperty(name="spring.jpa.properties.hibernate.cache.region.factory_class", havingValue="com.integralblue.hibernate.cache.springcache.SpringCacheRegionFactory")
public class SpringCacheRegionFactoryAutoConfigure {
	@Bean
	protected static SpringCacheRegionFactoryBeanPostProcessor springCacheRegionFactoryBeanPostProcessor(){
		return new SpringCacheRegionFactoryBeanPostProcessor();
	}
}

Make the springCacheRegionFactoryBeanPostProcessor bean definition static so CacheManager beans are eligible for getting processed by all BeanPostProcessors


/*
 * Copyright 2015 herd contributors
 *
 * 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.finra.herd.tools.common.oauth2;

import io.restassured.RestAssured;
import org.apache.http.HttpStatus;

public class AccessToken
{
    public static String getAccessToken(AuthKey authKey)
    {
        return RestAssured.given().auth().preemptive().basic(authKey.getUsername(), authKey.getPassword()).formParam("grant_type", "client_credentials").when()
            .post(authKey.getAuthUrl()).then().log().all().statusCode(HttpStatus.SC_OK).extract().response().jsonPath().getString("access_token");
    }
}

/*
 * Copyright 2015 herd contributors
 *
 * 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.finra.herd.tools.common.oauth2;

import com.jayway.restassured.RestAssured;
import org.apache.http.HttpStatus;

public class AccessToken
{
    public static String getAccessToken(AuthKey authKey)
    {
        return RestAssured.given().auth().preemptive().basic(authKey.getUsername(), authKey.getPassword()).formParam("grant_type", "client_credentials").when()
            .post(authKey.getAuthUrl()).then().log().all().statusCode(HttpStatus.SC_OK).extract().response().jsonPath().getString("access_token");
    }
}

CATDM-1350: Access Validator - Use service calls authenticated by OAuth
- Undo restassured update


package io.quarkus.gradle.devmode;

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

import com.google.common.collect.ImmutableMap;

@org.junit.jupiter.api.Tag("failsOnJDK18")
public class MultiModuleKotlinProjectDevModeTest extends QuarkusDevGradleTestBase {

    @Override
    protected String projectDirectoryName() {
        return "multi-module-kotlin-project";
    }

    @Override
    protected String[] buildArguments() {
        return new String[] { "clean", ":web:quarkusDev", "-s" };
    }

    protected void testDevMode() throws Exception {

        assertThat(getHttpResponse())
                .contains("ready")
                .contains("quarkusmm")
                .contains("org.acme")
                .contains("1.0.0-SNAPSHOT");

        assertThat(getHttpResponse("/hello")).contains("howdy");

        replace("domain/src/main/kotlin/com/example/quarkusmm/domain/CustomerServiceImpl.kt",
                ImmutableMap.of("return \"howdy\"", "return \"modified\""));

        assertUpdatedResponseContains("/hello", "modified");
    }
}

package io.quarkus.gradle.devmode;

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

import org.junit.jupiter.api.Disabled;

import com.google.common.collect.ImmutableMap;

@Disabled
@org.junit.jupiter.api.Tag("failsOnJDK18")
public class MultiModuleKotlinProjectDevModeTest extends QuarkusDevGradleTestBase {

    @Override
    protected String projectDirectoryName() {
        return "multi-module-kotlin-project";
    }

    @Override
    protected String[] buildArguments() {
        return new String[] { "clean", ":web:quarkusDev", "-s" };
    }

    protected void testDevMode() throws Exception {

        assertThat(getHttpResponse())
                .contains("ready")
                .contains("quarkusmm")
                .contains("org.acme")
                .contains("1.0.0-SNAPSHOT");

        assertThat(getHttpResponse("/hello")).contains("howdy");

        replace("domain/src/main/kotlin/com/example/quarkusmm/domain/CustomerServiceImpl.kt",
                ImmutableMap.of("return \"howdy\"", "return \"modified\""));

        assertUpdatedResponseContains("/hello", "modified");
    }
}

Disable failing kotlin-multi-module gradle test


package guitests;

import static seedu.ezdo.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import java.io.IOException;

import org.junit.Test;

import seedu.ezdo.logic.commands.SaveCommand;

public class SaveCommandTest extends EzDoGuiTest {

    private final String validDirectory = "data/test.xml";
    private final String inexistentDirectory = "data/COWABUNGA/";

    @Test
    public void save_validDirectory_success() {
      commandBox.runCommand("save " + validDirectory);
      assertResultMessage(String.format(SaveCommand.MESSAGE_SAVE_TASK_SUCCESS, validDirectory));
    }

    @Test
    public void save_invalidFormat_failure() {
        commandBox.runCommand("save");
        assertResultMessage(String.format(MESSAGE_INVALID_COMMAND_FORMAT, SaveCommand.MESSAGE_USAGE));
    }

    @Test
    public void save_inexistentDirectory_failure() {
        commandBox.runCommand("save " + inexistentDirectory);
        assertResultMessage(String.format(SaveCommand.MESSAGE_DIRECTORY_PATH_DOES_NOT_EXIST));
    }

}

package guitests;

import static seedu.ezdo.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import org.junit.Test;

import seedu.ezdo.logic.commands.SaveCommand;

public class SaveCommandTest extends EzDoGuiTest {

    private final String validDirectory = "data/test.xml";
    private final String inexistentDirectory = "data/COWABUNGA/";

    @Test
    public void save_validDirectory_success() {
        commandBox.runCommand("save " + validDirectory);
        assertResultMessage(String.format(SaveCommand.MESSAGE_SAVE_TASK_SUCCESS, validDirectory));
    }

    @Test
    public void save_invalidFormat_failure() {
        commandBox.runCommand("save");
        assertResultMessage(String.format(MESSAGE_INVALID_COMMAND_FORMAT, SaveCommand.MESSAGE_USAGE));
    }

    @Test
    public void save_inexistentDirectory_failure() {
        commandBox.runCommand("save " + inexistentDirectory);
        assertResultMessage(String.format(SaveCommand.MESSAGE_DIRECTORY_PATH_DOES_NOT_EXIST));
    }

}

Remove unused imports Fix indentation

Remove unused imports
Fix indentation


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

import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportFactory;

public class FramedTransportFactory extends TTransportFactory
{
    public TTransport getTransport(TTransport base)
    {
        return new TFramedTransport(base);
    }
}

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

import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportFactory;

public class FramedTransportFactory extends TTransportFactory
{

    public static final int DEFAULT_MAX_FRAME_SIZE = 15 * 1024 * 1024; // 15 MiB

    public TTransport getTransport(TTransport base)
    {
        return new TFramedTransport(base, DEFAULT_MAX_FRAME_SIZE);
    }
}

Set max frame size to 15MB in the cli to avoid OOM. Patch by Tyler Hobbs, reviewed by brandonwilliams for CASSANDRA-4969


/*
 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
 *
 * This program and the accompanying materials are made available under the terms of the Eclipse
 * Public License v1.0 which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.yangtools.yang.data.codec.gson;

import com.google.gson.stream.JsonWriter;
import java.io.IOException;

final class JSONEmptyCodec implements JSONCodec<Object> {

    static final JSONEmptyCodec INSTANCE = new JSONEmptyCodec();

    private JSONEmptyCodec() {

    }

    @Override
    public Object deserialize(final String input) {
        return null;
    }

    @Override
    public String serialize(final Object input) {
        return null;
    }

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

    @Override
    public void serializeToWriter(final JsonWriter writer, final Object value) throws IOException {
        writer.beginArray();
        writer.value((String) null);
        writer.endArray();
    }

}

/*
 * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.yangtools.yang.data.codec.gson;

import com.google.gson.stream.JsonWriter;
import java.io.IOException;

final class JSONEmptyCodec implements JSONCodec<Object> {

    static final JSONEmptyCodec INSTANCE = new JSONEmptyCodec();

    private JSONEmptyCodec() {

    }

    @Override
    public Object deserialize(final String input) {
        return null;
    }

    @Override
    public String serialize(final Object input) {
        return null;
    }

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

    @Override
    public void serializeToWriter(final JsonWriter writer, final Object value) throws IOException {
        writer.beginArray();
        writer.value((String) null);
        writer.endArray();
    }

}

Fix license header violations in yang-data-codec-gson

Change-Id: Ia5f799e64b213f20230c2eb03ad572a1c51bd092
Signed-off-by: Thanh Ha <09ea4d3a79c8bee41a16519f6a431f6bc0fd8d6f@linuxfoundation.org>


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

package org.gradle.performance.results;

import org.gradle.performance.fixture.CrossBuildPerformanceResults;

public class BuildScanResultsStore extends BaseCrossBuildResultsStore<CrossBuildPerformanceResults> {

    public BuildScanResultsStore() {
        super("build-receipt-results");
    }

}

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

package org.gradle.performance.results;

import org.gradle.performance.fixture.CrossBuildPerformanceResults;

public class BuildScanResultsStore extends BaseCrossBuildResultsStore<CrossBuildPerformanceResults> {

    public BuildScanResultsStore() {
        super("build-scan-results");
    }

}

Use a fresh results store for build scan performance results.


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

package org.optaplanner.benchmark.impl.ranking;

import java.io.Serializable;
import java.util.Comparator;

import org.optaplanner.benchmark.impl.result.SubSingleBenchmarkResult;

public class SubSingleBenchmarkRankBasedComparator implements Comparator<SubSingleBenchmarkResult>, Serializable {

    @Override
    public int compare(SubSingleBenchmarkResult a, SubSingleBenchmarkResult b) {
        return Comparator
                // Reverse, less is better (redundant: failed benchmarks don't get ranked at all)
                .comparing(SubSingleBenchmarkResult::hasAnyFailure, Comparator.reverseOrder())
                .thenComparing(SubSingleBenchmarkResult::getRanking, Comparator.naturalOrder())
                .compare(a, b);
    }

}

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

package org.optaplanner.benchmark.impl.ranking;

import java.io.Serializable;
import java.util.Comparator;

import org.optaplanner.benchmark.impl.result.SubSingleBenchmarkResult;

public class SubSingleBenchmarkRankBasedComparator implements Comparator<SubSingleBenchmarkResult>, Serializable {

    private static final Comparator<SubSingleBenchmarkResult> COMPARATOR =
            Comparator.nullsLast(Comparator
                    // Reverse, less is better (redundant: failed benchmarks don't get ranked at all)
                    .comparing(SubSingleBenchmarkResult::hasAnyFailure, Comparator.reverseOrder())
                    .thenComparing(SubSingleBenchmarkResult::getRanking, Comparator.naturalOrder()));

    @Override
    public int compare(SubSingleBenchmarkResult a, SubSingleBenchmarkResult b) {
        return COMPARATOR.compare(a, b);
    }

}

Fix NPE when benchmark result is null

Fix NPE when benchmark result is null


package io.cryptolens.models;

import com.google.gson.annotations.SerializedName;

public class DataObject {
    @SerializedName(value = "id", alternate = {"Id"})
    public int Id;
    @SerializedName(value = "name", alternate = {"Name"})
    public String Name;
    @SerializedName(value = "stringValue", alternate = {"StringValue"})
    public String StringValue;
    @SerializedName(value = "intValue", alternate = {"IntValue"})
    public int IntValue;
}

package io.cryptolens.models;

import com.google.gson.annotations.SerializedName;

public class DataObject {
    /**
     * The unique identifier of the data object.
     */
    @SerializedName(value = "id", alternate = {"Id"})
    public int Id;

    /**
     * The name of the data object (max 10 chars).
     */
    @SerializedName(value = "name", alternate = {"Name"})
    public String Name;

    /**
     * A string value associated with the data object (max 10,000 chars).
     */
    @SerializedName(value = "stringValue", alternate = {"StringValue"})
    public String StringValue;

    /**
     * An int32 value associated with the data object.
     */
    @SerializedName(value = "intValue", alternate = {"IntValue"})
    public int IntValue;
}

Update docs for Data object

Update docs for Data object


package edu.chl.proton.model;

import org.junit.Test;

import static org.junit.Assert.assertTrue;

/**
 * @author Stina Werme
 * Created by stinawerme on 11/05/17.
 */
public class FolderTest {

    @Test
    public void removeFolderTest() {

        Folder parent = new Folder("parent");
        Folder child = new Folder("child", parent);

        parent.removeFolder(child);

        assertTrue("The folder parent should not be null", parent != null);
        assertTrue("The folder child should not be null", child != null);
        assertTrue("ParentFolder should be null", child.getParentFolder() == null);
    }

    @Test
    public void removeFileTest() {

        File file = new File("file");
        Folder folder = new Folder("folder");

        folder.removeFile(file);

        assertTrue("The file file should not be null", file != null);
        assertTrue("The folder folder should not be null", folder != null);
        assertTrue("ParentFolder should be null", file.getParentFolder() == null);
    }
    }
}

package edu.chl.proton.model;

import org.junit.Test;

import static org.junit.Assert.assertTrue;

/**
 * @author Stina Werme
 * Created by stinawerme on 11/05/17.
 */
public class FolderTest {

    @Test
    public void removeFolderTest() {

        Folder parent = new Folder("parent");
        Folder child = new Folder("child", parent);

        parent.removeFolder(child);

        assertTrue("The folder parent should not be null", parent != null);
        assertTrue("The folder child should not be null", child != null);
        assertTrue("ParentFolder should be null", child.getParentFolder() == null);
    }

    @Test
    public void removeFileTest() {

        File file = new File("file");
        Folder folder = new Folder("folder");

        folder.removeFile(file);

        assertTrue("The file file should not be null", file != null);
        assertTrue("The folder folder should not be null", folder != null);
        assertTrue("ParentFolder should be null", file.getParentFolder() == null);
    }

    @Test
    public void addFileTest() {

        Folder parent = new Folder("parent");
        File childFile = new File("childFile", parent);
        Folder newParent = new Folder("newParent");

        newParent.addFile(childFile);

        assertTrue("The folder parent should not be null", parent != null);
        assertTrue("The file childFile should not be null", childFile != null);
        assertTrue("The folder newParent should not be null", newParent != null);
        assertTrue("ParentFolder should be newParent", childFile.getParentFolder() == newParent);
    }

    @Test
    public void addFolderTest() {

        Folder one = new Folder("one");
        Folder two = new Folder("two", one);
        Folder three = new Folder("three");

        two.addFolder(three);

        assertTrue("The folder one should not be null", one != null);
        assertTrue("The folder two should not be null", two != null);
        assertTrue("The folder three should not be null", three != null);
        assertTrue("ParentFolder should be three", two.getParentFolder() == three);
    }
}

Add test for addFile and addFolder

Add test for addFile and addFolder


package org.metaborg.meta.lang.dynsem.interpreter.nodes.rules;

import org.metaborg.meta.lang.dynsem.interpreter.DynSemLanguage;
import org.metaborg.meta.lang.dynsem.interpreter.nodes.DynSemRootNode;

import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;

public abstract class Rule extends DynSemRootNode {

	private final DynSemLanguage lang;

	public Rule(DynSemLanguage lang, SourceSection source, FrameDescriptor fd) {
		super(lang, source, fd);
		this.lang = lang;
	}

	public Rule(DynSemLanguage lang, SourceSection source) {
		this(lang, source, null);
	}

	protected DynSemLanguage language() {
		return lang;
	}

	@Override
	public abstract RuleResult execute(VirtualFrame frame);

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

	@Override
	protected boolean isCloneUninitializedSupported() {
		return false;
	}

	@Override
	protected abstract Rule cloneUninitialized();

	public Rule makeUninitializedClone() {
		return cloneUninitialized();
	}
}

package org.metaborg.meta.lang.dynsem.interpreter.nodes.rules;

import org.metaborg.meta.lang.dynsem.interpreter.DynSemLanguage;
import org.metaborg.meta.lang.dynsem.interpreter.nodes.DynSemRootNode;

import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;

public abstract class Rule extends DynSemRootNode {

	private final DynSemLanguage lang;

	public Rule(DynSemLanguage lang, SourceSection source, FrameDescriptor fd) {
		super(lang, source, fd);
		this.lang = lang;
	}

	public Rule(DynSemLanguage lang, SourceSection source) {
		this(lang, source, null);
	}

	protected DynSemLanguage language() {
		return lang;
	}

	@Override
	public abstract RuleResult execute(VirtualFrame frame);

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

	@Override
	protected boolean isCloneUninitializedSupported() {
		return true;
	}

	@Override
	protected abstract Rule cloneUninitialized();

	public Rule makeUninitializedClone() {
		return cloneUninitialized();
	}
}

Revert "Temporarily disallow rule cloning (for benchmarks)"

This reverts commit 15c01bdcc559e04fad09f19672e7306b3e316f2a.


package net.safedata.springboot.training.d02.s05.repository;

import net.safedata.springboot.training.d02.s05.model.Product;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * A simple Spring Data {@link CrudRepository} for the {@link Product} entity
 *
 * @author bogdan.solga
 */
@Repository
@SuppressWarnings("unused")
public interface ProductRepository extends CrudRepository<Product, Integer> {

    List<Product> findByName(final String name);

    @Query(value =  "SELECT product " +
                    "FROM Product product " +
                    "WHERE product.name LIKE :name"
    )
    List<Product> findProductsWhichIncludeName(final @Param(value = "name") String name);
}

package net.safedata.springboot.training.d02.s05.repository;

import net.safedata.springboot.training.d02.s05.model.Product;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * A simple Spring Data {@link CrudRepository} for the {@link Product} entity
 *
 * @author bogdan.solga
 */
@Repository
@SuppressWarnings("unused")
public interface ProductRepository extends CrudRepository<Product, Integer> {

    Optional<List<Product>> findByName(final String name);

    @Query(value =  "SELECT product " +
                    "FROM Product product " +
                    "WHERE product.name LIKE :name"
    )
    Optional<List<Product>> findProductsWhichIncludeName(@Param(value = "name") final String name);

    Optional<Product> findById(int id);
}

[improve] Use Optional return values for all the queries


package com.fatico.winthing;

import com.fatico.winthing.gui.WindowGUI;
import com.fatico.winthing.messaging.Engine;
import com.google.inject.Guice;
import com.google.inject.Injector;

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

public class Application {
	public static boolean APPDEBUG = false;
    private static final Logger logger = LoggerFactory.getLogger(Application.class);

    public static void main(final String[] args) {
        try {
        	parseArgs(args);

        	WindowGUI gui = WindowGUI.getInstance();
        	gui.tray();

        	final Injector injector = Guice.createInjector(new ApplicationModule());
        	final Engine engine = injector.getInstance(Engine.class);
        	engine.run();

        } catch (final Throwable throwable) {
            logger.error("Critical error.", throwable);
            System.exit(1);
        }
    }

    public static void parseArgs(String[] args) {
    	for (String arg : args) {
    		if (arg.equals("-debug")) {
    			APPDEBUG = true;
    		}
    	}
    }
}

package com.fatico.winthing;

import com.fatico.winthing.gui.WindowGUI;
import com.fatico.winthing.messaging.Engine;
import com.google.inject.Guice;
import com.google.inject.Injector;

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

public class Application {
	private boolean debug = false;
	private static Application app = new Application();
    private static final Logger logger = LoggerFactory.getLogger(Application.class);

    private void parseArgs(String[] args) {
    	for (String arg : args) {
    		if (arg.equals("-debug")) {
    			debug = true;
    		}
    	}
    }

    public static boolean debug() {
    	return app.debug;
    }

    public static void quit() {
    	logger.info("Application terminated.");
    	System.exit(0);
    }

    public static void main(final String[] args) {
        try {
        	app.parseArgs(args);

        	WindowGUI gui = WindowGUI.getInstance();
        	gui.tray();

        	final Injector injector = Guice.createInjector(new ApplicationModule());
        	final Engine engine = injector.getInstance(Engine.class);
        	engine.run();

        } catch (final Throwable throwable) {
            logger.error("Critical error.", throwable);
            System.exit(1);
        }
    }
}

Change how we provide if debug parameter has been passed. Add function to quit application - we call simply system.exit, proper thread cleanup would be perhaps better.


package hu.elte.txtuml.api.model.execution.impl.seqdiag.fragments.execstrats;

import java.util.Queue;

import hu.elte.txtuml.api.model.seqdiag.BaseCombinedFragmentWrapper;
import hu.elte.txtuml.api.model.seqdiag.BaseFragmentWrapper;
import hu.elte.txtuml.api.model.seqdiag.BaseMessageWrapper;

public class ExecutionStrategySeq implements ExecutionStrategy {

	@Override
	public boolean containsMessage(Queue<BaseFragmentWrapper> containedFragments, BaseMessageWrapper message) {
		BaseFragmentWrapper wrapper = containedFragments.peek();
		if (wrapper instanceof BaseCombinedFragmentWrapper) {
			return ((BaseCombinedFragmentWrapper) wrapper).containsMessage(message);
		} else {
			return wrapper.equals(message);
		}
	}

	@Override
	public boolean checkMessageSendToPattern(Queue<BaseFragmentWrapper> containedFragments,
			BaseMessageWrapper message) {
		BaseFragmentWrapper fragment = containedFragments.peek();
		if (fragment instanceof BaseCombinedFragmentWrapper) {
			return ((BaseCombinedFragmentWrapper) fragment).checkMessageSendToPattern(message);
		} else {
			BaseMessageWrapper required = (BaseMessageWrapper) fragment;
			if (!required.equals(message)) {
				return false;
			}
			containedFragments.remove();
			return true;
		}
	}

}

package hu.elte.txtuml.api.model.execution.impl.seqdiag.fragments.execstrats;

import java.util.Queue;

import hu.elte.txtuml.api.model.seqdiag.BaseCombinedFragmentWrapper;
import hu.elte.txtuml.api.model.seqdiag.BaseFragmentWrapper;
import hu.elte.txtuml.api.model.seqdiag.BaseMessageWrapper;

public class ExecutionStrategySeq implements ExecutionStrategy {

	@Override
	public boolean containsMessage(Queue<BaseFragmentWrapper> containedFragments, BaseMessageWrapper message) {
		BaseFragmentWrapper wrapper = containedFragments.peek();
		if (wrapper instanceof BaseCombinedFragmentWrapper) {
			return ((BaseCombinedFragmentWrapper) wrapper).containsMessage(message);
		} else {
			return wrapper.equals(message);
		}
	}

	@Override
	public boolean checkMessageSendToPattern(Queue<BaseFragmentWrapper> containedFragments,
			BaseMessageWrapper message) {
		BaseFragmentWrapper fragment = containedFragments.peek();
		if (fragment instanceof BaseCombinedFragmentWrapper) {
			boolean result = ((BaseCombinedFragmentWrapper) fragment).checkMessageSendToPattern(message);

			if (result && fragment.size() == 0) {
				containedFragments.remove();
			}

			return result;
		} else {
			BaseMessageWrapper required = (BaseMessageWrapper) fragment;
			if (!required.equals(message)) {
				return false;
			}
			containedFragments.remove();
			return true;
		}
	}

}

Fix a bug with normal execution mode

Fix a bug with normal execution mode

If all of the messages of a CombinedFragment got processed and deleted
from the queue during the execution, null pointer exceptions where thrown
because the fragment itself wasn't deleted from the queue and the method tried to process the next message of the empty fragment.


package ch.tkuhn.nanopub.validator;

import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.request.resource.IResource;
import org.nanopub.Nanopub;
import org.nanopub.NanopubUtils;
import org.openrdf.rio.RDFFormat;

import net.trustyuri.rdf.TransformNanopub;

public class DownloadTrustyResource implements IResource {

	private static final long serialVersionUID = -4558302923207618223L;

	private RDFFormat format;
	private ValidatorPage mainPage;

	public DownloadTrustyResource(RDFFormat format, ValidatorPage mainPage) {
		this.format = format;
		this.mainPage = mainPage;
	}

	@Override
	public void respond(Attributes attributes) {
		if (mainPage.getNanopub() == null) return;
		WebResponse resp = (WebResponse) attributes.getResponse();
		resp.setContentType(format.getMIMETypes().get(0));
		resp.setAttachmentHeader("nanopub." + format.getDefaultFileExtension());
		try {
			Nanopub np = mainPage.getNanopub();
			Nanopub trustyNp = TransformNanopub.transform(np, np.getUri().toString());
			NanopubUtils.writeToStream(trustyNp, resp.getOutputStream(), format);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		resp.close();
	}

}

package ch.tkuhn.nanopub.validator;

import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.request.resource.IResource;
import org.nanopub.Nanopub;
import org.nanopub.NanopubUtils;
import org.openrdf.rio.RDFFormat;

import net.trustyuri.rdf.TransformNanopub;

public class DownloadTrustyResource implements IResource {

	private static final long serialVersionUID = -4558302923207618223L;

	private RDFFormat format;
	private ValidatorPage mainPage;

	public DownloadTrustyResource(RDFFormat format, ValidatorPage mainPage) {
		this.format = format;
		this.mainPage = mainPage;
	}

	@Override
	public void respond(Attributes attributes) {
		if (mainPage.getNanopub() == null) return;
		WebResponse resp = (WebResponse) attributes.getResponse();
		resp.setContentType(format.getMIMETypes().get(0));
		resp.setAttachmentHeader("nanopub." + format.getDefaultFileExtension());
		try {
			Nanopub np = mainPage.getNanopub();
			Nanopub trustyNp = TransformNanopub.transform(np);
			NanopubUtils.writeToStream(trustyNp, resp.getOutputStream(), format);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		resp.close();
	}

}

Update to latest version of trusty-URI

Update to latest version of trusty-URI


/*
 * Copyright (C) 2011 Thomas Akehurst
 *
 * 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.tomakehurst.wiremock.common;

import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
import com.google.common.primitives.Bytes;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;

public class BinaryFile {

    private URI uri;

    public BinaryFile(URI uri) {
        this.uri = uri;
    }

	public byte[] readContents() {
		try {
            return ByteStreams.toByteArray(uri.toURL().openStream());
        } catch (final IOException ioe) {
			throw new RuntimeException(ioe);
		}
	}

	public String name() {
		return uri.toString();
	}

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

/*
 * Copyright (C) 2011 Thomas Akehurst
 *
 * 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.tomakehurst.wiremock.common;

import com.google.common.io.ByteStreams;

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;

public class BinaryFile {

    private URI uri;

    public BinaryFile(URI uri) {
        this.uri = uri;
    }

    public byte[] readContents() {
        InputStream stream = null;
        try {
            stream = uri.toURL().openStream();
            return ByteStreams.toByteArray(stream);
        } catch (final IOException ioe) {
            throw new RuntimeException(ioe);
        } finally {
            closeStream(stream);
        }
    }

    /**
     * @param stream Stream to close, may be null
     */
    private void closeStream(InputStream stream) {
        if (stream != null) {
            try {
                stream.close();
            } catch (IOException ioe) {
                throw new RuntimeException(ioe);
            }
        }
    }

    public String name() {
        return uri.toString();
    }

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

Make sure we close files after having read them (causes tests to fail otherwise and is generally good practice)


/**
 * Copyright (c) 2015 Intel Corporation
 *
 * 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.trustedanalytics.les;

import com.mangofactory.swagger.plugin.EnableSwagger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.security.oauth2.resource.EnableOAuth2Resource;

@EnableOAuth2Resource
@SpringBootApplication
@EnableSwagger
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

/**
 * Copyright (c) 2015 Intel Corporation
 *
 * 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.trustedanalytics.les;

import com.mangofactory.swagger.plugin.EnableSwagger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoDataAutoConfiguration;
import org.springframework.cloud.security.oauth2.resource.EnableOAuth2Resource;

@EnableOAuth2Resource
@SpringBootApplication
@EnableSwagger
@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class, MongoDataAutoConfiguration.class})
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

Fix MongoDB auto configuration issue in integration tests


package org.jboss.da.common.json;

import lombok.Getter;
import lombok.Setter;

public class DAConfig extends AbstractModuleConfig {

    @Getter
    @Setter
    private String keycloakServer;

    @Getter
    @Setter
    private String keycloakClientid;

    @Getter
    @Setter
    private String keycloakUsername;

    @Getter
    @Setter
    private String keycloakPassword;

    @Getter
    @Setter
    private String pncServer;

    @Getter
    @Setter
    private String keycloakRealm;

    @Getter
    @Setter
    private String aproxServer;

    @Getter
    @Setter
    private String aproxGroup;

    @Getter
    @Setter
    private String backupScmUrl;

    @Getter
    @Setter
    private String backupScmBranch;

    @Getter
    @Setter
    private String repourUrl;

}

package org.jboss.da.common.json;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

import lombok.Getter;
import lombok.Setter;

@JsonIgnoreProperties(ignoreUnknown = true)
public class DAConfig extends AbstractModuleConfig {

    @Getter
    @Setter
    private String keycloakServer;

    @Getter
    @Setter
    private String keycloakClientid;

    @Getter
    @Setter
    private String keycloakUsername;

    @Getter
    @Setter
    private String keycloakPassword;

    @Getter
    @Setter
    private String pncServer;

    @Getter
    @Setter
    private String keycloakRealm;

    @Getter
    @Setter
    private String aproxServer;

    @Getter
    @Setter
    private String aproxGroup;

    @Getter
    @Setter
    private String backupScmUrl;

    @Getter
    @Setter
    private String backupScmBranch;

    @Getter
    @Setter
    private String repourUrl;

}

Add ignore for unknown json properties in config file


package lintcode.bst;

import fundamentals.tree.TreeNode;

/**
 */
public class MyBst {

    // 85-Insert Node in a Binary Search Tree
    public TreeNode insertNode(TreeNode root, TreeNode node) {
        if (root == null) return node;
        if (node.val < root.val) {
            root.left = insertNode(root.left, node);
        } else {
            root.right = insertNode(root.right, node);
        }
        return root;
    }

}

package lintcode.bst;

import fundamentals.tree.TreeNode;

/**
 */
public class MyBst {

    // 85-Insert Node in a Binary Search Tree
    public TreeNode insertNode(TreeNode root, TreeNode node) {
        if (root == null) return node;
        if (node.val < root.val) {
            root.left = insertNode(root.left, node);
        } else {
            root.right = insertNode(root.right, node);
        }
        return root;
    }

    public TreeNode insertNode_iterative(TreeNode root, TreeNode node) {
        TreeNode cur = root, par = null;
        while (cur != null) {
            par = cur;
            cur = (node.val < cur.val) ? cur.left : cur.right;
        }
        if (par == null) { // root is empty
            root = node;
        } else if (node.val < par.val) {
            par.left = node;
        } else {
            par.right = node;
        }
        return root;
    }

}

Implement my binary search tree

Implement my binary search tree


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

import java.util.Collection;

import org.apache.logging.log4j.ThreadContext;

/**
 *
 */
public interface ThreadContextStack extends ThreadContext.ContextStack,
        Collection<String> {
}

Format (up to 120 line length).

Format (up to 120 line length).

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


package fr.ourten.brokkgui.wrapper;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import fr.ourten.brokkgui.BrokkGuiPlatform;

/**
 * @author Ourten 5 oct. 2016
 */
@Mod(modid = BrokkGuiWrapperMod.MODID, version = BrokkGuiWrapperMod.VERSION, name = BrokkGuiWrapperMod.MODNAME)
public class BrokkGuiWrapperMod
{
    public static final String MODID   = "brokkguiwrapper";
    public static final String MODNAME = "BrokkGui Wrapper";
    public static final String VERSION = "0.1.0";

    @EventHandler
    public void onPreInit(final FMLPreInitializationEvent event)
    {
        BrokkGuiPlatform.getInstance().setPlatformName("MC1.7.10");
        BrokkGuiPlatform.getInstance().setKeyboardUtil(new KeyboardUtil());
        BrokkGuiPlatform.getInstance().setMouseUtil(new MouseUtil());
        BrokkGuiPlatform.getInstance().setGuiHelper(new GuiHelper());
    }
}

package fr.ourten.brokkgui.wrapper;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import fr.ourten.brokkgui.BrokkGuiPlatform;

/**
 * @author Ourten 5 oct. 2016
 */
@Mod(modid = BrokkGuiWrapperMod.MODID, version = BrokkGuiWrapperMod.VERSION, name = BrokkGuiWrapperMod.MODNAME)
public class BrokkGuiWrapperMod
{
    public static final String MODID   = "brokkguiwrapper";
    public static final String MODNAME = "BrokkGui Wrapper";
    public static final String VERSION = "0.1.0";

    @EventHandler
    public void onPreInit(final FMLPreInitializationEvent event)
    {
        BrokkGuiPlatform.getInstance().setPlatformName("MC1.7.10");
        BrokkGuiPlatform.getInstance().setKeyboardUtil(new KeyboardUtil());
        BrokkGuiPlatform.getInstance().setMouseUtil(new MouseUtil());

        if (event.getSide().isClient())
            BrokkGuiPlatform.getInstance().setGuiHelper(new GuiHelper());
    }
}

Fix 1.7 wrapper instancing minecraft client class


package com.grayben.riskExtractor.htmlScorer;

import org.jsoup.nodes.Attribute;
import org.jsoup.parser.Tag;

public class TagAndAttribute {
	private final Tag tag;
	private final Attribute attribute;

    public Tag getTag() {
        return tag;
    }

    public Attribute getAttribute() {
        return attribute;
    }

    public TagAndAttribute(Tag tag, Attribute attribute) {
		super();
		this.tag = tag;
		this.attribute = attribute;
	}
}

package com.grayben.riskExtractor.htmlScorer;

import org.jsoup.nodes.Attribute;
import org.jsoup.parser.Tag;

public class TagAndAttribute {
	private final Tag tag;
	private final Attribute attribute;

    public Tag getTag() {
        return tag;
    }

    public Attribute getAttribute() {
        return attribute;
    }

    public TagAndAttribute(Tag tag, Attribute attribute) {
		super();
        if (tag == null) {
            throw new NullPointerException(
                    "Attempted to pass in null tag:Tag"
            );
        }
        if (attribute == null) {
            throw new NullPointerException(
                    "Attempted to pass in null attribute:Attribute"
            );
        }

        this.tag = tag;
		this.attribute = attribute;
	}
}

Make throw E on null constructor arguments


package com.mixpanel.android.viewcrawler;

/**
* Created by joe on 8/29/14.
*/
/* package */ class PropertyDescription {
    public PropertyDescription(String name, Class targetClass, Caller accessor, String mutatorName) {
        this.name = name;
        this.targetClass = targetClass;
        this.accessor = accessor;

        mMutatorName = mutatorName;
    }

    public Caller makeMutator(Object[] methodArgs) {
        if (null == mMutatorName) {
            return null;
        }

        return new Caller(mMutatorName, methodArgs, Void.TYPE);
    }

    public final String name;
    public final Class targetClass;
    public final Caller accessor;

    private final String mMutatorName;
}

package com.mixpanel.android.viewcrawler;

/* package */ class PropertyDescription {
    public PropertyDescription(String name, Class targetClass, Caller accessor, String mutatorName) {
        this.name = name;
        this.targetClass = targetClass;
        this.accessor = accessor;

        mMutatorName = mutatorName;
    }

    public Caller makeMutator(Object[] methodArgs) {
        if (null == mMutatorName) {
            return null;
        }

        return new Caller(mMutatorName, methodArgs, Void.TYPE);
    }

    public final String name;
    public final Class targetClass;
    public final Caller accessor;

    private final String mMutatorName;
}

Remove annoying "Created by" comment

Remove annoying "Created by" comment


package me.devsaki.hentoid.parsers.images;

import androidx.annotation.NonNull;

import org.jsoup.nodes.Document;

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

import me.devsaki.hentoid.database.domains.Content;

import static me.devsaki.hentoid.util.network.HttpHelper.getOnlineDocument;

public class ASMHentaiParser extends BaseParser {

    @Override
    protected List<String> parseImages(@NonNull Content content) throws IOException {
        List<String> result = new ArrayList<>();

        // Fetch the reader page
        Document doc = getOnlineDocument(content.getReaderUrl());
        if (doc != null) {
            String imgUrl = "https:" +
                    doc.select("div.full_image")
                            .select("a")
                            .select("img")
                            .attr("src");

            String ext = imgUrl.substring(imgUrl.lastIndexOf('.'));

            for (int i = 0; i < content.getQtyPages(); i++) {
                String img = imgUrl.substring(0, imgUrl.lastIndexOf('/') + 1) + (i + 1) + ext;
                result.add(img);
            }
        }

        return result;
    }
}

package me.devsaki.hentoid.parsers.images;

import androidx.annotation.NonNull;

import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

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

import me.devsaki.hentoid.database.domains.Content;

import static me.devsaki.hentoid.util.network.HttpHelper.getOnlineDocument;

public class ASMHentaiParser extends BaseParser {

    @Override
    protected List<String> parseImages(@NonNull Content content) throws IOException {
        List<String> result = new ArrayList<>();

        // Fetch the reader page
        Document doc = getOnlineDocument(content.getReaderUrl());
        if (doc != null) {
            Elements imgContainer = doc.select("div.full_image"); // New ASM layout
            if (imgContainer.isEmpty())
                imgContainer = doc.select("div.full_gallery"); // Old ASM layout; current ASM Comics layout
            String imgUrl = "https:" +
                    imgContainer
                            .select("a")
                            .select("img")
                            .attr("src");

            String ext = imgUrl.substring(imgUrl.lastIndexOf('.'));

            for (int i = 0; i < content.getQtyPages(); i++) {
                String img = imgUrl.substring(0, imgUrl.lastIndexOf('/') + 1) + (i + 1) + ext;
                result.add(img);
            }
        }

        return result;
    }
}

Align with ASM Comics layout (which is the old ASM Hentai Layout...)


/*
 * #%L
 * ACS AEM Commons Bundle
 * %%
 * Copyright (C) 2016 Adobe
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
@aQute.bnd.annotation.Version("1.0.0")
package com.adobe.acs.commons.fam.actions;

/*
 * #%L
 * ACS AEM Commons Bundle
 * %%
 * Copyright (C) 2016 Adobe
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
@aQute.bnd.annotation.Version("1.1.0")
package com.adobe.acs.commons.fam.actions;

Increase package version for ActionBatch addition


package com.thoughtworks.acceptance.someobjects;

import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter;

public class ZConverter extends AbstractSingleValueConverter {

    public boolean canConvert(Class type) {
        return type.equals(Z.class);
    }

    public Object fromString(String str) {
        return new Z("z");
    }

}

package com.thoughtworks.acceptance.someobjects;

import com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;

public class ZConverter extends AbstractBasicConverter {

    public boolean canConvert(Class type) {
        return type.equals(Z.class);
    }

    protected Object fromString(String str) {
        return new Z("z");
    }

}

Revert to 1.1.1 converter ... it is part of compatibility test.


/*
 * Copyright (c) 2017 CMPUT301F17T15. This project is distributed under the MIT license.
 */

package com.cmput301.cia.activities;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;

import com.cmput301.cia.R;

/**
 * created by Tinghui
 */

public class HabitEventViewActivity extends AppCompatActivity {

    private TextView habitEventName;
    private TextView habitEventType;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_habit_event_view);
        habitEventName = (EditText) findViewById(R.id.EditHabitEventName);
        habitEventType = (EditText) findViewById(R.id.EditHabitEventType);
        Bundle bundle = getIntent().getExtras();
        habitEventType.setText(bundle.getString("HabitEventType"));
        habitEventName.setText(bundle.getString("HabitEventName"));

    }
}

/*
 * Copyright (c) 2017 CMPUT301F17T15. This project is distributed under the MIT license.
 */

package com.cmput301.cia.activities;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;

import com.cmput301.cia.R;

/**
 * created by Tinghui.
 * on 11/8/2017.
 */

public class HabitEventViewActivity extends AppCompatActivity {

    private TextView habitEventName;
    private TextView habitEventType;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_habit_event_view);
        habitEventName = (EditText) findViewById(R.id.EditHabitEventName);
        habitEventType = (EditText) findViewById(R.id.EditHabitEventType);

        Bundle bundle = getIntent().getExtras();
        habitEventType.setText(bundle.getString("HabitEventType"));
        habitEventName.setText(bundle.getString("HabitEventName"));

    }
}

Add habit event view list activity

Add habit event view list activity


/*
 * Copyright (C) 2014 Archie L. Cobbs. All rights reserved.
 *
 * $Id$
 */

package org.jsimpledb.parse.expr;

import org.jsimpledb.parse.ParseSession;

/**
 * {@link Node} representing a parsed {@link ParseSession} variable.
 *
 * @see ParseSession#getVars
 */
public class VarNode extends ConstNode {

    /**
     * Constructor.
     *
     * @param name variable name
     * @throws IllegalArgumentException if name is null
     * @throws IllegalArgumentException if name is not a valid Java identifier
     */
    public VarNode(String name) {
        super(new VarValue(name));
    }

    @Override
    public VarValue evaluate(ParseSession session) {
        return (VarValue)super.evaluate(session);
    }

    /**
     * Get the variable name.
     */
    public String getName() {
        return ((VarValue)this.evaluate(null)).getName();
    }
}

/*
 * Copyright (C) 2014 Archie L. Cobbs. All rights reserved.
 *
 * $Id$
 */

package org.jsimpledb.parse.expr;

import org.jsimpledb.parse.ParseSession;

/**
 * {@link Node} representing a parsed {@link ParseSession} variable.
 *
 * @see ParseSession#getVars
 */
public class VarNode extends ConstNode {

    /**
     * Constructor.
     *
     * @param name variable name
     * @throws IllegalArgumentException if name is null
     * @throws IllegalArgumentException if name is not a valid Java identifier
     */
    public VarNode(String name) {
        super(new VarValue(name));
    }

    @Override
    public VarValue evaluate(ParseSession session) {
        return (VarValue)super.evaluate(session);
    }

    /**
     * Get the variable name.
     */
    public String getName() {
        return this.evaluate(null).getName();
    }
}

Remove cast made redundant by r780.

Remove cast made redundant by r780.


/*                                                                      *\
**                    SICU Stress Measurement System                    **
**                      Project P04  |  C380 Team A                     **
**          EBME 380: Biomedical Engineering Design Experience          **
**                    Case Western Reserve University                   **
**                          2016 Fall Semester                          **
\*                                                                      */

package edu.cwru.sicu_sms;

/**
 * This class is dedicated to storing various constants that might otherwise clutter other source files in this package.
 *
 * @since December 3, 2016
 * @author Ted Frohlich <ttf10@case.edu>
 * @author Abby Walker <amw138@case.edu>
 */
public class Constants {

    public static final int TIME_WINDOW = 10;

}

/*                                                                      *\
**                    SICU Stress Measurement System                    **
**                      Project P04  |  C380 Team A                     **
**          EBME 380: Biomedical Engineering Design Experience          **
**                    Case Western Reserve University                   **
**                          2016 Fall Semester                          **
\*                                                                      */

package edu.cwru.sicu_sms;

/**
 * This class is dedicated to storing various constants that might otherwise clutter other source files in this package.
 *
 * @since December 3, 2016
 * @author Ted Frohlich <ttf10@case.edu>
 * @author Abby Walker <amw138@case.edu>
 */
public class Constants {

    @Deprecated
    public static final int TIME_WINDOW = 10;

}

Mark 'TIME_WINDOW' field as deprecated

Mark 'TIME_WINDOW' field as deprecated


package beaform.dao;

import org.apache.commons.collections.ListUtils;
import org.junit.Before;
import org.junit.Test;

import beaform.debug.DebugUtils;
import beaform.entities.TransactionSetupException;
import junit.framework.TestCase;

/**
 * Test for the formula DA.
 *
 * @author Steven Post
 *
 */
public class FormlaDAOTest extends TestCase {

	/**
	 * {@inheritDoc}
	 */
	@Override
	@Before
	public void setUp() {
		GraphDbHandlerForJTA.initInstance("test");
		DebugUtils.clearDb();
	}

	/**
	 * Test for adding a new formula.
	 * @throws TransactionSetupException
	 */
	@Test
	public void testAddFormula() throws TransactionSetupException {
		FormulaDAO.addFormula("Testform", "Description", "100g", ListUtils.EMPTY_LIST, ListUtils.EMPTY_LIST);
		assertEquals("This isn't the expected formula", null,  null);

	}

}

package beaform.dao;

import org.apache.commons.collections.ListUtils;
import org.junit.Before;
import org.junit.Test;

import beaform.debug.DebugUtils;
import beaform.entities.TransactionSetupException;
import junit.framework.TestCase;

/**
 * Test for the formula DA.
 *
 * @author Steven Post
 *
 */
public class FormlaDAOTest extends TestCase {

	/**
	 * {@inheritDoc}
	 */
	@Override
	@Before
	public void setUp() {
		GraphDbHandlerForJTA.initInstance("test");
		DebugUtils.clearDb();
	}

	/**
	 * Test for adding a new formula.
	 * @throws TransactionSetupException
	 */
	@Test
	public void testAddFormula() throws TransactionSetupException {
		FormulaDAO.addFormula("Testform", "Description", "100g", ListUtils.EMPTY_LIST, ListUtils.EMPTY_LIST);
		assertEquals("This isn't the expected formula", null,  null);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	@After
	public void tearDown() {
		DebugUtils.clearDb();
	}

}

Add a teardown method for the formulaDAO tests


package io.searchbox.indices;

import io.searchbox.action.Action;
import org.junit.Test;

import java.net.URLDecoder;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

public class StatsTest {

    @Test
    public void testBasicUriGeneration() {
        Stats stats = new Stats.Builder().addIndex("twitter").build();

        assertEquals("GET", stats.getRestMethodName());
        assertEquals("twitter/_stats", stats.getURI());
    }

    @Test
    public void equalsReturnsTrueForSameIndex() {
        Stats stats1 = new Stats.Builder().addIndex("twitter").build();
        Stats stats1Duplicate = new Stats.Builder().addIndex("twitter").build();

        assertEquals(stats1, stats1Duplicate);
    }

    @Test
    public void equalsReturnsFalseForDifferentIndex() {
        Stats stats1 = new Stats.Builder().addIndex("twitter").build();
        Stats stats2 = new Stats.Builder().addIndex("myspace").build();

        assertNotEquals(stats1, stats2);
    }

    @Test
    public void testUriGenerationWithStatsFields() throws Exception {
        Action action = new Stats.Builder()
                .flush(true)
                .indexing(true)
                .search(true, "group1", "group2")
                .build();
        assertEquals("_all/_stats/flush,indexing,search?groups=group1,group2", URLDecoder.decode(action.getURI()));
    }

}

package io.searchbox.indices;

import io.searchbox.action.Action;
import org.junit.Test;

import java.net.URLDecoder;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

public class StatsTest {

    @Test
    public void testBasicUriGeneration() {
        Stats stats = new Stats.Builder().addIndex("twitter").build();

        assertEquals("GET", stats.getRestMethodName());
        assertEquals("twitter/_stats", stats.getURI());
    }

    @Test
    public void equalsReturnsTrueForSameIndex() {
        Stats stats1 = new Stats.Builder().addIndex("twitter").build();
        Stats stats1Duplicate = new Stats.Builder().addIndex("twitter").build();

        assertEquals(stats1, stats1Duplicate);
    }

    @Test
    public void equalsReturnsFalseForDifferentIndex() {
        Stats stats1 = new Stats.Builder().addIndex("twitter").build();
        Stats stats2 = new Stats.Builder().addIndex("myspace").build();

        assertNotEquals(stats1, stats2);
    }

    @Test
    public void testUriGenerationWithStatsFields() throws Exception {
        Action action = new Stats.Builder()
                .flush(true)
                .indexing(true)
                .search(true, "group1", "group2")
                .build();
        assertEquals("_all/_stats/flush,indexing,search?groups=group1,group2", URLDecoder.decode(action.getURI()));
    }

    @Test
    public void testUriGenerationWhenRemovingStatsFields() throws Exception {
        Action action = new Stats.Builder()
                .flush(true)
                .indexing(true)
                .indexing(false)
                .build();
        assertEquals("_all/_stats/flush", URLDecoder.decode(action.getURI()));
    }

}

Add test to removeCleanApiParameter method


package com.simplenote.android;

public class Constants {
	/** Name of stored preferences */
	public static final String PREFS_NAME = "SimpleNotePrefs";
	/** Logging tag prefix */
	public static final String TAG = "SimpleNote:";

	// Message Codes
	public static final int MESSAGE_UPDATE_NOTE = 12398;

	// API Base URL
	public static final String API_BASE_URL   = "https://simple-note.appspot.com/api";
	public static final String API_LOGIN_URL  = API_BASE_URL + "/login";					// POST
	public static final String API_NOTES_URL  = API_BASE_URL + "/index";					// GET
	public static final String API_NOTE_URL   = API_BASE_URL + "/note";						// GET
	public static final String API_UPDATE_URL = API_BASE_URL + "/note";						// POST
	public static final String API_DELETE_URL = API_BASE_URL + "/delete";					// GET
	public static final String API_SEARCH_URL = API_BASE_URL + "/search";					// GET
}

package com.simplenote.android;

public class Constants {
	/** Name of stored preferences */
	public static final String PREFS_NAME = "SimpleNotePrefs";
	/** Logging tag prefix */
	public static final String TAG = "SimpleNote:";
	// Message Codes
	public static final int MESSAGE_UPDATE_NOTE = 12398;
	// Activity for result request Codes
	public static final int REQUEST_LOGIN = 32568;
	// API Base URL
	public static final String API_BASE_URL   = "https://simple-note.appspot.com/api";
	public static final String API_LOGIN_URL  = API_BASE_URL + "/login";					// POST
	public static final String API_NOTES_URL  = API_BASE_URL + "/index";					// GET
	public static final String API_NOTE_URL   = API_BASE_URL + "/note";						// GET
	public static final String API_UPDATE_URL = API_BASE_URL + "/note";						// POST
	public static final String API_DELETE_URL = API_BASE_URL + "/delete";					// GET
	public static final String API_SEARCH_URL = API_BASE_URL + "/search";					// GET
}

Add Constant for Loging request (used with startActivityForResult)