package de.danoeh.antennapod.core.util.playback;

import android.content.Context;
import android.view.SurfaceHolder;

import java.io.IOException;

public interface IPlayer {
	boolean canSetPitch();

	boolean canSetSpeed();

	boolean canDownmix();

	float getCurrentPitchStepsAdjustment();

	int getCurrentPosition();

	float getCurrentSpeedMultiplier();

	int getDuration();

	float getMaxSpeedMultiplier();

	float getMinSpeedMultiplier();

	boolean isLooping();

	boolean isPlaying();

	void pause();

	void prepare() throws IllegalStateException;

	void prepareAsync();

	void release();

	void reset();

	void seekTo(int msec);

	void setAudioStreamType(int streamtype);

	void setScreenOnWhilePlaying(boolean screenOn);

	void setDataSource(String path) throws IllegalStateException,
            IllegalArgumentException, SecurityException;

	void setDisplay(SurfaceHolder sh);

	void setEnableSpeedAdjustment(boolean enableSpeedAdjustment);

	void setLooping(boolean looping);

	void setPitchStepsAdjustment(float pitchSteps);

	void setPlaybackPitch(float f);

	void setPlaybackSpeed(float f);

	void setDownmix(boolean enable);

	void setVolume(float left, float right);

	void start();

	void stop();

    void setVideoScalingMode(int mode);

    void setWakeMode(Context context, int mode);
}

package de.danoeh.antennapod.core.util.playback;

import android.content.Context;
import android.view.SurfaceHolder;

import java.io.IOException;

public interface IPlayer {
	boolean canSetPitch();

	boolean canSetSpeed();

	boolean canDownmix();

	float getCurrentPitchStepsAdjustment();

	int getCurrentPosition();

	float getCurrentSpeedMultiplier();

	int getDuration();

	float getMaxSpeedMultiplier();

	float getMinSpeedMultiplier();

	boolean isLooping();

	boolean isPlaying();

	void pause();

	void prepare() throws IllegalStateException, IOException;

	void prepareAsync();

	void release();

	void reset();

	void seekTo(int msec);

	void setAudioStreamType(int streamtype);

	void setScreenOnWhilePlaying(boolean screenOn);

	void setDataSource(String path) throws IllegalStateException, IOException,
            IllegalArgumentException, SecurityException;

	void setDisplay(SurfaceHolder sh);

	void setEnableSpeedAdjustment(boolean enableSpeedAdjustment);

	void setLooping(boolean looping);

	void setPitchStepsAdjustment(float pitchSteps);

	void setPlaybackPitch(float f);

	void setPlaybackSpeed(float f);

	void setDownmix(boolean enable);

	void setVolume(float left, float right);

	void start();

	void stop();

    void setVideoScalingMode(int mode);

    void setWakeMode(Context context, int mode);
}

Add throws to avoid interface clash

Add throws to avoid interface clash


/*
 * Copyright 2016-2017 Steinar Bang
 *
 * 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 no.priv.bang.ukelonn.impl;

import org.apache.karaf.shell.api.action.Action;
import org.apache.karaf.shell.api.action.Command;
import org.apache.karaf.shell.api.action.lifecycle.Reference;
import org.apache.karaf.shell.api.action.lifecycle.Service;

import no.priv.bang.ukelonn.UkelonnDatabase;

@Command(scope="ukelonn", name="release-liquibase-lock", description = "Forcibly release the Liquibase changelog lock")
@Service
public class KarafReleaseLiquibaseLockCommand implements Action {
    @Reference
    UkelonnDatabase database;

    @Override
    public Object execute() throws Exception {
        database.forceReleaseLocks();
        System.out.println("Forcibly unlocked the Liquibase changelog lock");
        return null;
    }
}

/*
 * Copyright 2016-2017 Steinar Bang
 *
 * 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 no.priv.bang.ukelonn.impl;

import org.apache.karaf.shell.api.action.Action;
import org.apache.karaf.shell.api.action.Command;
import org.apache.karaf.shell.api.action.lifecycle.Reference;
import org.apache.karaf.shell.api.action.lifecycle.Service;

import no.priv.bang.ukelonn.UkelonnDatabase;

@Command(scope="ukelonn", name="release-liquibase-lock", description = "Forcibly release the Liquibase changelog lock")
@Service
public class KarafReleaseLiquibaseLockCommand implements Action {
    @Reference
    UkelonnDatabase database;

    @Override
    public Object execute() throws Exception {
        database.forceReleaseLocks();
        System.out.println("Forcibly unlocked the Liquibase changelog lock"); // NOSONAR
        return null;
    }
}

Make Sonar stop insisting that a console command should output messages using a log framework.


package com.formulasearchengine.mathosphere.mlp.cli;

import org.junit.Test;

import static org.junit.Assert.*;

public class CliParamsTest {

  @Test
  public void help() {
    String[] args = {"help"};
    CliParams params = CliParams.from(args);
    assertEquals("help", params.getCommand());
  }

  @Test
  public void useTex() {
    String[] args = {"mlp", "--tex"};
    CliParams params = CliParams.from(args);
    assertEquals("mlp", params.getCommand());
    assertTrue(params.getMlpCommandConfig().getUseTeXIdentifiers());
  }

  @Test
  public void notUseTex() {
    String[] args = {"mlp"};
    CliParams params = CliParams.from(args);
    assertEquals("mlp", params.getCommand());
    assertFalse(params.getMlpCommandConfig().getUseTeXIdentifiers());
  }

  @Test
  public void count() {
    String[] args = {"count", "--formulae", "-in", "c:/tmp/mlp/input/"};
    CliParams params = CliParams.from(args);
    assertEquals("count", params.getCommand());

    CountCommandConfig count = params.getCount();

    assertTrue(count.isFormulas());
    assertFalse(count.isDefinitions());
    assertFalse(count.isIdentifiers());
    assertEquals("c:/tmp/mlp/input/", count.getInput());
  }

}

package com.formulasearchengine.mathosphere.mlp.cli;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class CliParamsTest {

  @Test
  public void help() {
    String[] args = {"help"};
    CliParams params = CliParams.from(args);
    assertEquals("help", params.getCommand());
  }

  @Test
  public void texvcinfo() {
    String[] args = {"tags", "--texvcinfo", "expected"};
    CliParams params = CliParams.from(args);
    assertEquals("expected", params.getTagsCommandConfig().getTexvcinfoUrl());
  }

  @Test
  public void useTex() {
    String[] args = {"mlp", "--tex"};
    CliParams params = CliParams.from(args);
    assertEquals("mlp", params.getCommand());
    assertTrue(params.getMlpCommandConfig().getUseTeXIdentifiers());
  }

  @Test
  public void notUseTex() {
    String[] args = {"mlp"};
    CliParams params = CliParams.from(args);
    assertEquals("mlp", params.getCommand());
    assertFalse(params.getMlpCommandConfig().getUseTeXIdentifiers());
  }

  @Test
  public void count() {
    String[] args = {"count", "--formulae", "-in", "c:/tmp/mlp/input/"};
    CliParams params = CliParams.from(args);
    assertEquals("count", params.getCommand());

    CountCommandConfig count = params.getCount();

    assertTrue(count.isFormulas());
    assertFalse(count.isDefinitions());
    assertFalse(count.isIdentifiers());
    assertEquals("c:/tmp/mlp/input/", count.getInput());
  }

}

Test setting texvcinfo url from cli

Test setting texvcinfo url from cli


package org.wikipedia.settings;

import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.MenuItem;

public class PreferenceActivityWithBack extends PreferenceActivity {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Hmm. Can't use ActionBarActivity?
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            getActionBar().setDisplayHomeAsUpEnabled(true);
        }
    }

    public boolean onMenuItemSelected(int featureId, MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                finish();
                return true;
            default:
                throw new RuntimeException("WAT");
        }
    }

}

package org.wikipedia.settings;

import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.MenuItem;

public class PreferenceActivityWithBack extends PreferenceActivity {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Hmm. Can't use ActionBarActivity?
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            getActionBar().setDisplayHomeAsUpEnabled(true);
        }
    }

    public boolean onMenuItemSelected(int featureId, MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                finish();
                return true;
            default:
                throw new RuntimeException("WAT");
        }
    }

}

Fix possible crash with <4.0 devices when opening More.

OTRS:
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom&TicketID=7601473

Change-Id: I673e26d0288c71940f551ad9cdb72db262dbe406


package com.airbnb.aerosolve.core.transforms;

import com.airbnb.aerosolve.core.FeatureVector;

import java.util.Map;
import java.util.Set;

import com.typesafe.config.Config;

/**
 * "field1" specifies the string column to be deleted
 */
public class DeleteStringFeatureFamilyTransform implements Transform {
  private String fieldName1;

  @Override
  public void configure(Config config, String key) {
    fieldName1 = config.getString(key + ".field1");
  }

  @Override
  public void doTransform(FeatureVector featureVector) {
    Map<String, Set<String>> stringFeatures = featureVector.getStringFeatures();
    if (stringFeatures == null) {
      return ;
    }

    Set<String> feature1 = stringFeatures.get(fieldName1);
    if (feature1 == null) {
      return;
    }

    stringFeatures.remove(fieldName1);
  }
}

package com.airbnb.aerosolve.core.transforms;

import com.airbnb.aerosolve.core.FeatureVector;

import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.typesafe.config.Config;

/**
 * "field1" specifies the string column to be deleted
 */
public class DeleteStringFeatureFamilyTransform implements Transform {
  private String fieldName1;
  private List<String> fieldNames;

  @Override
  public void configure(Config config, String key) {
    if (config.hasPath(key + ".field1")) {
      fieldName1 = config.getString(key + ".field1");
    }
    if (config.hasPath(key + ".fields")) {
      fieldNames = config.getStringList(key + ".fields");
    }
  }

  @Override
  public void doTransform(FeatureVector featureVector) {
    Map<String, Set<String>> stringFeatures = featureVector.getStringFeatures();
    if (stringFeatures == null) {
      return ;
    }

    HashSet<String> fieldNamesSet = new HashSet<>();

    if (fieldName1 != null) {
      fieldNamesSet.add(fieldName1);
    }
    if (fieldNames != null) {
      fieldNamesSet.addAll(fieldNames);
    }

    for (String fieldName: fieldNamesSet) {
      Set<String> feature1 = stringFeatures.get(fieldName1);
      if (feature1 != null) {
        stringFeatures.remove(fieldName);
      }
    }
  }
}

Add ability to delete multiple string familes at once


package io.undertow.servlet.api;

import javax.servlet.Filter;
import javax.servlet.Servlet;
import javax.servlet.ServletException;

/**
 * Class that is run around invocations of servlet and filter lifecycle methods (init and destroy).
 *
 * Note that this only deals with lifecycle methods that are defined by the servlet spec. @POstConstruct,
 * PreDestroy and Inject methods are not handled.
 *
 * @author Stuart Douglas
 */
public interface LifecycleInterceptor {

    void init(ServletInfo servletInfo, Servlet servlet, LifecycleContext context);

    void init(FilterInfo filterInfo, Filter filter,  LifecycleContext context);

    void destroy(ServletInfo servletInfo, Servlet servlet,  LifecycleContext context);

    void destroy(FilterInfo filterInfo, Filter filter, LifecycleContext context);

    public interface LifecycleContext {
        void proceed() throws ServletException;
    }
}

package io.undertow.servlet.api;

import javax.servlet.Filter;
import javax.servlet.Servlet;
import javax.servlet.ServletException;

/**
 * Class that is run around invocations of servlet and filter lifecycle methods (init and destroy).
 *
 * Note that this only deals with lifecycle methods that are defined by the servlet spec. @POstConstruct,
 * PreDestroy and Inject methods are not handled.
 *
 * @author Stuart Douglas
 */
public interface LifecycleInterceptor {

    void init(ServletInfo servletInfo, Servlet servlet, LifecycleContext context) throws ServletException;

    void init(FilterInfo filterInfo, Filter filter,  LifecycleContext context) throws ServletException;

    void destroy(ServletInfo servletInfo, Servlet servlet,  LifecycleContext context) throws ServletException;

    void destroy(FilterInfo filterInfo, Filter filter, LifecycleContext context) throws ServletException;

    public interface LifecycleContext {
        void proceed() throws ServletException;
    }
}

Add exception to method signature

Add exception to method signature


package com.example;

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

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.cloud.contract.wiremock.WireMockRestServiceServer;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestTemplate;

@DirtiesContext
// tag::wiremock_test[]
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.NONE)
public class WiremockForDocsMockServerApplicationTests {

	@Autowired
	private RestTemplate restTemplate;

	@Autowired
	private Service service;

	@Test
	public void contextLoads() throws Exception {
		// will read stubs from default /resources/stubs location
		MockRestServiceServer server = WireMockRestServiceServer.with(this.restTemplate)
				.baseUrl("http://example.org").stubs("resource");
		// We're asserting if WireMock responded properly
		assertThat(this.service.go()).isEqualTo("Hello World");
		server.verify();
	}
}
// end::wiremock_test[]

package com.example;

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

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.cloud.contract.wiremock.WireMockRestServiceServer;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestTemplate;

@DirtiesContext
// tag::wiremock_test[]
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.NONE)
public class WiremockForDocsMockServerApplicationTests {

	@Autowired
	private RestTemplate restTemplate;

	@Autowired
	private Service service;

	@Test
	public void contextLoads() throws Exception {
		// will read stubs classpath
		MockRestServiceServer server = WireMockRestServiceServer.with(this.restTemplate)
				.baseUrl("http://example.org").stubs("classpath:/stubs/resource.json");
		// We're asserting if WireMock responded properly
		assertThat(this.service.go()).isEqualTo("Hello World");
		server.verify();
	}
}
// end::wiremock_test[]

Fix test when it runs as well

Fix test when it runs as well


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

package com.snowplowanalytics.snowplow.tracker;

public class LinkedHashMap<K,V> extends java.util.LinkedHashMap<K, V> {
    @Override
    public V put(K key, V value) {
        if(value != null)
            return super.put(key, value);
        else
            return null;
    }
}

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

package com.snowplowanalytics.snowplow.tracker;

public class LinkedHashMap<K,V> extends java.util.LinkedHashMap<K, V> {
    @Override
    public V put(K key, V value) {
        if(value != null && value != "")
            return super.put(key, value);
        else
            return null;
    }
}

Check for empty string insertion as well

 - Fixes #21


/*
 * Copyright 2019 Google LLC
 *
 * 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.google.protobuf;

import jsinterop.annotations.JsType;

/** J2CL emulation of ProtocolMessageEnum. */
@JsType
public interface ProtocolMessageEnum {
  int getNumber();
}

/*
 * Copyright 2019 Google LLC
 *
 * 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.google.protobuf;

/** J2CL emulation of ProtocolMessageEnum. */
public interface ProtocolMessageEnum {
  int getNumber();
}

Remove JsType annotation which can unnecessarily add to code size with bridges and make the proto Java enums accessible from JS.

PiperOrigin-RevId: 466748192


package com.autonomy.abc.selenium.page.connections.wizard;

import com.autonomy.abc.selenium.page.SAASPageBase;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.util.List;

public class ConnectorIndexStepTab extends SAASPageBase {

    private ConnectorIndexStepTab(WebDriver driver){
        super(driver);
    }

    public static ConnectorIndexStepTab make(WebDriver driver) {
        return new ConnectorIndexStepTab(driver);
    }

    public WebElement selectIndexButton(){
        return findElement(By.tagName("button"));
    }

    public WebElement getIndexSearchBox(){
        return getDriver().findElement(By.className("chosen-search"));
    }

    public List<WebElement> getExistingIndexes() {
        return getDriver().findElements(By.cssSelector(".chosen-results li"));
    }
}

package com.autonomy.abc.selenium.page.connections.wizard;

import com.autonomy.abc.selenium.page.SAASPageBase;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.util.List;

public class ConnectorIndexStepTab extends SAASPageBase {

    private ConnectorIndexStepTab(WebDriver driver){
        super(driver);
    }

    public static ConnectorIndexStepTab make(WebDriver driver) {
        return new ConnectorIndexStepTab(driver);
    }

    public WebElement selectIndexButton(){
        return findElement(By.linkText("Select index"));
    }

    public WebElement getIndexSearchBox(){
        return getDriver().findElement(By.className("chosen-search"));
    }

    public List<WebElement> getExistingIndexes() {
        return getDriver().findElements(By.cssSelector(".chosen-results li"));
    }
}

Change the way Connector Index Tab finds the 'select index' button'


package ast;

import symbols.value.Value;

public class Member extends Lvalue {

    private Lvalue _lvalue;
    private String _identifier;
    private Call _call;
    private Expression _expression;

    private boolean _isLValue;

    public Member(Lvalue lvalue, String identifier, Call call, Expression expression) {
        this._lvalue = lvalue;
        this._identifier = identifier;
        this._call = call;
        this._expression = expression;
        _isLValue = false;
    }

    public Lvalue getLvalue() {
        return this._lvalue;
    }

    public void setLvalue(Lvalue lvalue) {
        this._lvalue = lvalue;
    }

    public String getIdentifier() {
        return this._identifier;
    }

    public void setIdentifier(String identifier) {
        this._identifier = identifier;
    }

    public Call getCall() {
        return this._call;
    }

    public void setCall(Call call) {
        this._call = call;
    }

    public Expression getExpression() {
        return this._expression;
    }

    public void setExpression(Expression expression) {
        this._expression = expression;
    }

    public boolean isLValue() {
        return _isLValue;
    }

    public void setIsLValue() {
        this._isLValue = true;
    }

    @Override
    public Value accept(ASTVisitor visitor) throws ASTVisitorException {
        return visitor.visit(this);
    }
}

package ast;

import symbols.value.Value;

public class Member extends Lvalue {

    private Lvalue _lvalue;
    private final IdentifierExpression _identifier;
    private Call _call;
    private Expression _expression;

    private boolean _isLValue;

    public Member(Lvalue lvalue, IdentifierExpression identifier, Call call, Expression expression) {
        _lvalue = lvalue;
        _identifier = identifier;
        _call = call;
        _expression = expression;
        _isLValue = false;
    }

    public Lvalue getLvalue() {
        return _lvalue;
    }

    public void setLvalue(Lvalue lvalue) {
        _lvalue = lvalue;
    }

    public String getIdentifier() {
        return _identifier != null ? _identifier.getIdentifier() : null;
    }

    public IdentifierExpression getIdentifierExpr() {
        return _identifier;
    }

    public void setIdentifier(String identifier) {
        _identifier.setIdentifier(identifier);
    }

    public Call getCall() {
        return _call;
    }

    public void setCall(Call call) {
        _call = call;
    }

    public Expression getExpression() {
        return _expression;
    }

    public void setExpression(Expression expression) {
        _expression = expression;
    }

    public boolean isLValue() {
        return _isLValue;
    }

    public void setIsLValue() {
        _isLValue = true;
    }

    @Override
    public Value accept(ASTVisitor visitor) throws ASTVisitorException {
        return visitor.visit(this);
    }
}

[Method: Change identifier from String to IndentifierExpression] Add the methods to manage the changes.


/*
 * 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.
 */
@Version("1.2.0")
@Export(optional = "provide:=true")
package org.apache.jackrabbit.oak.plugins.segment;

import aQute.bnd.annotation.Export;
import aQute.bnd.annotation.Version;

/*
 * 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.
 */
@Version("2.0.0")
@Export(optional = "provide:=true")
package org.apache.jackrabbit.oak.plugins.segment;

import aQute.bnd.annotation.Export;
import aQute.bnd.annotation.Version;

OAK-2833: Refactor TarMK
bump export package version as required

git-svn-id: 67138be12999c61558c3dd34328380c8e4523e73@1682176 13f79535-47bb-0310-9956-ffa450edef68


package org.yamcs.studio.core.ui;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.yamcs.studio.core.vtype.YamcsVType;
import org.yamcs.utils.TimeEncoding;

public class YamcsUIPlugin extends AbstractUIPlugin {

    public static final String PLUGIN_ID = "org.yamcs.studio.core.ui";

    private static YamcsUIPlugin plugin;

    public static final String CMD_CONNECT = "org.yamcs.studio.ui.connect";

    private EventLogViewActivator eventLogActivator;

    @Override
    public void start(BundleContext context) throws Exception {
        super.start(context);
        plugin = this;
        TimeEncoding.setUp();
        ConnectionUIHelper.getInstance();
        YamcsVType.severityHandler = new SeverityHandlerSound();

        // TODO should maybe move these two to eventlog-plugin, but verify lazy behaviour
        DisplayOpener.init();
        eventLogActivator = new EventLogViewActivator();
    }

    @Override
    public void stop(BundleContext context) throws Exception {
        plugin = null;
        super.stop(context);
    }

    public static YamcsUIPlugin getDefault() {
        return plugin;
    }
}

package org.yamcs.studio.core.ui;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.yamcs.studio.core.vtype.YamcsVType;
import org.yamcs.utils.TimeEncoding;

public class YamcsUIPlugin extends AbstractUIPlugin {

    public static final String PLUGIN_ID = "org.yamcs.studio.core.ui";

    private static YamcsUIPlugin plugin;

    public static final String CMD_CONNECT = "org.yamcs.studio.ui.connect";

    // private EventLogViewActivator eventLogActivator; // TODO remove? very annoying actually

    @Override
    public void start(BundleContext context) throws Exception {
        super.start(context);
        plugin = this;
        TimeEncoding.setUp();
        ConnectionUIHelper.getInstance();
        YamcsVType.severityHandler = new SeverityHandlerSound();

        // TODO should maybe move these two to eventlog-plugin, but verify lazy behaviour
        DisplayOpener.init();
        // eventLogActivator = new EventLogViewActivator(); // TODO remove? very annoying actually
    }

    @Override
    public void stop(BundleContext context) throws Exception {
        plugin = null;
        super.stop(context);
    }

    public static YamcsUIPlugin getDefault() {
        return plugin;
    }
}

Disable auto-focus of event view

Disable auto-focus of event view

It was distracting when working in views on the same stack


package com.amee.platform.resource.dataitemvalue;

import com.amee.base.resource.*;
import com.amee.base.validation.ValidationException;
import com.amee.domain.DataItemValuesFilter;
import com.amee.domain.item.data.DataItem;

import java.util.Date;
import java.util.Map;

public interface DataItemValuesResource {

    public static interface Builder extends ResourceBuilder {

        public void handle(RequestWrapper requestWrapper, DataItem dataItem, DataItemValuesFilter filter);

        public DataItemValuesResource.Renderer getRenderer(RequestWrapper requestWrapper);

        public DataItemValueResource.Builder getDataItemValueBuilder(RequestWrapper requestWrapper);

        public DataItemValuesResource.DataItemValuesFilterValidator getValidator(RequestWrapper requestWrapper);
    }

    /**
     * Note that this Renderer is also used by DataItemValueHistoryResource.
     */
    public static interface Renderer extends ResourceRenderer {

        public void newDataItemValue(DataItemValueResource.Renderer renderer);

        public void setTruncated(boolean truncated);
    }

    public static interface DataItemValuesFilterValidator {

        public void initialise();

        public boolean isValid(Map<String, String> queryParameters);

        public DataItemValuesFilter getObject();

        public void setObject(DataItemValuesFilter object);

        public Date getDefaultStartDate();

        public void setDefaultStartDate(Date defaultStartDate);

        public ValidationResult getValidationResult();
    }

    public static interface FormAcceptor extends ResourceAcceptor {

        public Object handle(RequestWrapper requestWrapper) throws ValidationException;
    }
}

package com.amee.platform.resource.dataitemvalue;

import com.amee.base.resource.*;
import com.amee.base.validation.ValidationException;
import com.amee.domain.DataItemValuesFilter;
import com.amee.domain.item.data.DataItem;

import java.util.Date;
import java.util.Map;

public interface DataItemValuesResource {

    static interface Builder extends ResourceBuilder {

        void handle(RequestWrapper requestWrapper, DataItem dataItem, DataItemValuesFilter filter);

        DataItemValuesResource.Renderer getRenderer(RequestWrapper requestWrapper);

        DataItemValueResource.Builder getDataItemValueBuilder(RequestWrapper requestWrapper);

        DataItemValuesResource.DataItemValuesFilterValidator getValidator(RequestWrapper requestWrapper);
    }

    /**
     * Note that this Renderer is also used by DataItemValueHistoryResource.
     */
    static interface Renderer extends ResourceRenderer {

        void newDataItemValue(DataItemValueResource.Renderer renderer);

        void setTruncated(boolean truncated);
    }

    static interface DataItemValuesFilterValidator {

        void initialise();

        boolean isValid(Map<String, String> queryParameters);

        DataItemValuesFilter getObject();

        void setObject(DataItemValuesFilter object);

        Date getDefaultStartDate();

        void setDefaultStartDate(Date defaultStartDate);

        ValidationResult getValidationResult();
    }

    static interface FormAcceptor extends ResourceAcceptor {

        Object handle(RequestWrapper requestWrapper) throws ValidationException;
    }
}

Remove redundant access modifiers from interface. PL-11162.


package cvut.arenaq.mashup.AlchemyApi;

import java.util.List;

public class GetRankedTaxonomy {
    private String status;
    private String language;
    private List<Taxonomy> taxonomy;

    public String getStatus() {
        return status;
    }

    public String getLanguage() {
        return language;
    }

    public List<Taxonomy> getTaxonomy() {
        return taxonomy;
    }
}

package cvut.arenaq.mashup.AlchemyApi;

import java.util.List;

public class GetRankedTaxonomy {
    private String status;
    private String statusInfo;
    private String language;
    private List<Taxonomy> taxonomy;

    public String getStatus() {
        return status;
    }

    public String getStatusInfo() {
        return statusInfo;
    }

    public String getLanguage() {
        return language;
    }

    public List<Taxonomy> getTaxonomy() {
        return taxonomy;
    }
}

Add additional field to result model class of Alchemy api


package org.thinkinghub.gateway.core;

import org.junit.Test;
import org.thinkinghub.gateway.api.WeixinApi;

import static org.junit.Assert.assertEquals;

public class WeixinApiTest {
    private static final String AUTHORIZE_URL = "https://open.weixin.qq.com/connect/qrconnect?appid=%s&redirect_uri=%s&response_type=code&state=esfadsgsad34fwdef&scope=snsapi_login#wechat_redirect";

    @Test
    public void getAuthorizationBaseUrl() {
        assertEquals(WeixinApi.instance().getAuthorizationBaseUrl(), AUTHORIZE_URL);
    }
}

package org.thinkinghub.gateway.core;

import com.github.scribejava.core.model.OAuthConfig;
import org.junit.Test;
import org.thinkinghub.gateway.api.WeixinApi;

import static org.junit.Assert.assertEquals;

public class WeixinApiTest {
    private final String AUTHORIZE_URL = "https://open.weixin.qq.com/connect/qrconnect";
    private final String TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token";

    @Test
    public void getAuthorizationBaseUrl() {
        assertEquals( AUTHORIZE_URL, WeixinApi.instance().getAuthorizationBaseUrl());
    }

    @Test
    public void getAccessTokenEndpoint(){
        assertEquals(TOKEN_URL,  WeixinApi.instance().getAccessTokenEndpoint());
    }

    @Test
    public void getAuthorizationUrl(){
        OAuthConfig config = new OAuthConfig("myTestAppid", "myTestSecret",null, null, null, null, null, "code",null, null,null,null);
        assertEquals(AUTHORIZE_URL + "?response_type=code&appid=myTestAppid", WeixinApi.instance().getAuthorizationUrl(config, null));
    }

}

Refactor the test case for WeixinAPI

Refactor the test case for WeixinAPI


/**
 * Copyright (c) 2018 committers of YAKINDU 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
 * Contributors:
 * 	committers of YAKINDU - initial API and implementation
 *
 */
package org.yakindu.sct.generator.java;

import java.util.Collections;

import org.yakindu.sct.model.sexec.ExecutionFlow;

public class JavaIncludeProvider {
	public Iterable<CharSequence> getImports(ExecutionFlow it) {
		return Collections.emptyList();
	}
}

/**
 * Copyright (c) 2018 committers of YAKINDU 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
 * Contributors:
 * 	committers of YAKINDU - initial API and implementation
 *
 */
package org.yakindu.sct.generator.java;

import java.util.Collections;

import org.yakindu.sct.model.sexec.ExecutionFlow;

public class JavaIncludeProvider {
	public Iterable<String> getImports(ExecutionFlow it) {
		return Collections.emptyList();
	}
}

Add return type to Iterable<String>

Add return type to Iterable<String>


/*
 * Copyright 2000-2013 Vaadin Ltd.
 *
 * 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.vaadin.tests.widgetset.client;

import com.google.gwt.user.client.ui.HTML;

public class DelegateWidget extends HTML {
    private String value1;
    private int value2;
    private Boolean value3;
    private double value4;

    public void setValue1(String value1) {
        this.value1 = value1;
        updateText();
    }

    public void setValue2(int value2) {
        this.value2 = value2;
        updateText();
    }

    public void setValue3(Boolean value3) {
        this.value3 = value3;
        updateText();
    }

    public void setValue4(double value4) {
        this.value4 = value4;
    }

    private void updateText() {
        setHTML(value1 + "
" + value2 + "
" + value3 + "
"
                + value4 + "
");
    }
}

/*
 * Copyright 2000-2013 Vaadin Ltd.
 *
 * 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.vaadin.tests.widgetset.client;

import com.google.gwt.user.client.ui.HTML;

public class DelegateWidget extends HTML {
    private String value1;
    private int value2;
    private Boolean value3;
    private double value4;

    public void setValue1(String value1) {
        this.value1 = value1;
        updateText();
    }

    public void setValue2(int value2) {
        this.value2 = value2;
        updateText();
    }

    public void setValue3(Boolean value3) {
        this.value3 = value3;
        updateText();
    }

    public void setValue4(double value4) {
        this.value4 = value4;
        updateText();
    }

    private void updateText() {
        setHTML(value1 + "
" + value2 + "
" + value3 + "
"
                + value4 + "
");
    }
}

Fix random error in DelegateToWidget test

Because of performance fixes to the handling of @DelegateToWidget
handling, the order in which property changes are delegated are no
longer deterministic. This patch fixes a bug in the test which caused
the update to value4 to be ignored if that was the last property to get
delegated.

Change-Id: Ie13a125b0d719894391b8ae3c9d2d899b163ebb4


// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.filedistribution;

import com.yahoo.config.FileReference;
import com.yahoo.config.application.api.FileRegistry;

import java.util.List;

public class CombinedLegacyRegistry implements FileRegistry {
    private final FileDBRegistry legacy;
    private final FileDBRegistry future;

    CombinedLegacyRegistry(FileDBRegistry legacy, FileDBRegistry future) {
        this.legacy = legacy;
        this.future = future;
    }
    @Override
    public FileReference addFile(String relativePath) {
        FileReference reference = legacy.addFile(relativePath);
        return future.addFile(relativePath, reference);
    }

    @Override
    public String fileSourceHost() {
        return future.fileSourceHost();
    }

    @Override
    public List<Entry> export() {
        return future.export();
    }
}

// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.filedistribution;

import com.yahoo.config.FileReference;
import com.yahoo.config.application.api.FileRegistry;

import java.util.List;

public class CombinedLegacyRegistry implements FileRegistry {
    private final FileDBRegistry legacy;
    private final FileDBRegistry future;

    CombinedLegacyRegistry(FileDBRegistry legacy, FileDBRegistry future) {
        this.legacy = legacy;
        this.future = future;
    }
    @Override
    public FileReference addFile(String relativePath) {
        FileReference reference = legacy.addFile(relativePath);
        // TODO: Enable when system tested future.addFile(relativePath, reference);
        return reference;
    }

    @Override
    public String fileSourceHost() {
        return future.fileSourceHost();
    }

    @Override
    public List<Entry> export() {
        return future.export();
    }
}

Disable double addFile as legacy code has not been verified yet.


import java.io.IOException;
/**
 * Project RSA Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Feb 24, 2014.
 */

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

/**
 * This class is resposnible for testing and representation data for RSA
 * encryption algorithm.
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class Main {

    /**
     * This logger is responsible for the registration of events.
     */
    static final Logger logger = LogManager.getLogger(Main.class.getName());

    /**
     * This method sets up configuration for loggers.
     */
    private static void loggerSetup() {
        // BasicConfigurator.configure();
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        loggerSetup();
        RSA rsa = new RSA(1024);

        try {
            logger.info(IOOperations.encryptStream(
                    IOOperations.readFile("data.txt"), rsa, 10));
        } catch (IOException e) {
            logger.debug(e);
            logger.error(e);
        }
    }

}

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

import java.io.IOException;
import java.io.OutputStream;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

/**
 * This class is resposnible for testing and representation data for RSA
 * encryption algorithm.
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class Main {

    /**
     * This logger is responsible for the registration of events.
     */
    static final Logger logger = LogManager.getLogger(Main.class.getName());

    /**
     * This method sets up configuration for loggers.
     */
    private static void loggerSetup() {
        // BasicConfigurator.configure();
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        loggerSetup();
        RSA rsa = new RSA(1024);

        try {
            OutputStream encryptedStream = IOOperations.encryptStream(
                    IOOperations.readFile("data.txt"), rsa, RSA.BLOCK_SIZE);
            logger.info(encryptedStream.toString());
            logger.info(IOOperations.decryptStream(encryptedStream, rsa,
                    RSA.BLOCK_SIZE));
        } catch (IOException e) {
            logger.debug(e);
            logger.error(e);
        }
    }

}

Create an instance of a testing implementation


/*
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch 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.elasticsearch.bootstrap;

import java.util.Collections;
import java.util.Set;

/**
 * Exposes system startup information
 */
public final class BootstrapInfo {

    /** no instantiation */
    private BootstrapInfo() {}

    /**
     * Returns true if we successfully loaded native libraries.
     *

     * If this returns false, then native operations such as locking
     * memory did not work.
     */
    public static boolean isNativesAvailable() {
        return Natives.JNA_AVAILABLE;
    }

    /**
     * Returns true if we were able to lock the process's address space.
     */
    public static boolean isMemoryLocked() {
        return Natives.isMemoryLocked();
    }

    /**
     * Returns set of insecure plugins.
     *

     * These are plugins with unresolved issues in third-party libraries,
     * that require additional privileges as a workaround.
     */
    public static Set<String> getInsecurePluginList() {
        return Collections.unmodifiableSet(Security.SPECIAL_PLUGINS.keySet());
    }
}

/*
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch 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.elasticsearch.bootstrap;

/**
 * Exposes system startup information
 */
public final class BootstrapInfo {

    /** no instantiation */
    private BootstrapInfo() {}

    /**
     * Returns true if we successfully loaded native libraries.
     * <p>
     * If this returns false, then native operations such as locking
     * memory did not work.
     */
    public static boolean isNativesAvailable() {
        return Natives.JNA_AVAILABLE;
    }

    /**
     * Returns true if we were able to lock the process's address space.
     */
    public static boolean isMemoryLocked() {
        return Natives.isMemoryLocked();
    }
}

Remove this: we are gonna manage these right


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

package org.kaaproject.kaa.server.common;

import org.cassandraunit.dataset.cql.ClassPathCQLDataSet;
import org.junit.ClassRule;
import org.junit.extensions.cpsuite.ClasspathSuite;
import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters;
import org.junit.runner.RunWith;

@RunWith(ClasspathSuite.class)
@ClassnameFilters({"org.kaaproject.kaa.server.common.dao.service.Cassandra.*Test",
                   "org.kaaproject.kaa.server.common.nosql.cassandra.dao.*Test"})
public class CassandraTestSuite {

    @ClassRule
    public static CustomCassandraCQLUnit cassandraUnit = new CustomCassandraCQLUnit(new ClassPathCQLDataSet("cassandra.cql", false, false), "cassandra-test.yaml", 20000l);

}

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

package org.kaaproject.kaa.server.common;

import org.cassandraunit.dataset.cql.ClassPathCQLDataSet;
import org.junit.ClassRule;
import org.junit.extensions.cpsuite.ClasspathSuite;
import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters;
import org.junit.runner.RunWith;

@RunWith(ClasspathSuite.class)
@ClassnameFilters({"org.kaaproject.kaa.server.common.dao.service.Cassandra.*Test",
        "org.kaaproject.kaa.server.common.nosql.cassandra.dao.*Test"})
public class CassandraTestSuite {

    @ClassRule
    public static CustomCassandraCQLUnit cassandraUnit = new CustomCassandraCQLUnit(new ClassPathCQLDataSet("cassandra.cql", false, false), "cassandra-test.yaml", 2 * 60000L);

}

Increase embedded cassandra timeout to 2 min


package org.apache.poi.benchmark.suite;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Setup;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

public class SSPerformanceBenchmarks extends BaseBenchmark {
    @Setup
    public void setUp() throws IOException {
        compileAll();
    }

    @Benchmark
    public void benchmarkHSSFPerformance() throws IOException {
        runPOIApplication("org.apache.poi.ss.examples.SSPerformanceTest", TimeUnit.HOURS.toMillis(1), "HSSF", "30000", "20", "0");
    }

    @Benchmark
    public void benchmarkXSSFPerformance() throws IOException {
        runPOIApplication("org.apache.poi.ss.examples.SSPerformanceTest", TimeUnit.HOURS.toMillis(1), "XSSF", "30000", "20", "0");
    }

    @Benchmark
    public void benchmarkSXSSFPerformance() throws IOException {
        runPOIApplication("org.apache.poi.ss.examples.SSPerformanceTest", TimeUnit.HOURS.toMillis(1), "SXSSF", "30000", "20", "0");
    }
}

package org.apache.poi.benchmark.suite;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Setup;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

public class SSPerformanceBenchmarks extends BaseBenchmark {
    @Setup
    public void setUp() throws IOException {
        compileAll();
    }

    @Benchmark
    public void benchmarkHSSFPerformance() throws IOException {
        runPOIApplication("org.apache.poi.examples.ss.SSPerformanceTest", TimeUnit.HOURS.toMillis(1), "HSSF", "30000", "20", "0");
    }

    @Benchmark
    public void benchmarkXSSFPerformance() throws IOException {
        runPOIApplication("org.apache.poi.examples.ss.SSPerformanceTest", TimeUnit.HOURS.toMillis(1), "XSSF", "30000", "20", "0");
    }

    @Benchmark
    public void benchmarkSXSSFPerformance() throws IOException {
        runPOIApplication("org.apache.poi.examples.ss.SSPerformanceTest", TimeUnit.HOURS.toMillis(1), "SXSSF", "30000", "20", "0");
    }
}

Adjust package of SSPerformanceTest for latest Apache POI sources


package ca.corefacility.bioinformatics.irida.web.controller.test.unit.support;

import java.util.Date;

import ca.corefacility.bioinformatics.irida.model.IridaThing;

/**
 *
 * @author Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>
 */
public class IdentifiableTestEntity implements IridaThing, Comparable<IdentifiableTestEntity> {
	Long id;

	private Date createdDate;

	private Date modifiedDate;

	public IdentifiableTestEntity() {

	}

	public Long getId() {
		return this.id;
	}

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

	@Override
	public int compareTo(IdentifiableTestEntity o) {
		return createdDate.compareTo(o.createdDate);
	}

	@Override
	public Date getTimestamp() {
		return createdDate;
	}

	@Override
	public void setTimestamp(Date timestamp) {
		this.createdDate = timestamp;
	}

	@Override
	public String getLabel() {
		return null;
	}

	public Date getModifiedDate() {
		return modifiedDate;
	}

	public void setModifiedDate(Date modifiedDate) {
		this.modifiedDate = modifiedDate;
	}
}

package ca.corefacility.bioinformatics.irida.web.controller.test.unit.support;

import java.util.Date;

import ca.corefacility.bioinformatics.irida.model.IridaThing;

/**
 *
 * @author Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>
 */
public class IdentifiableTestEntity implements IridaThing, Comparable<IdentifiableTestEntity> {
	Long id;

	private Date createdDate;

	private Date modifiedDate;

	public IdentifiableTestEntity() {

	}

	public Long getId() {
		return this.id;
	}

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

	@Override
	public int compareTo(IdentifiableTestEntity o) {
		return createdDate.compareTo(o.createdDate);
	}

	@Override
	public Date getTimestamp() {
		return createdDate;
	}

	@Override
	public String getLabel() {
		return null;
	}

	public Date getModifiedDate() {
		return modifiedDate;
	}

	public void setModifiedDate(Date modifiedDate) {
		this.modifiedDate = modifiedDate;
	}
}

Test entity should not be allowed to change the created date after it's been created.


package com.philliphsu.bottomsheetpickers.view.numberpad;

import com.philliphsu.bottomsheetpickers.view.LocaleModel;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

public class NumberPadTimePickerPresenterTest {

    @Mock
    private INumberPadTimePicker.View mView;

    @Mock
    private LocaleModel mLocaleModel;

    private NumberPadTimePickerPresenter mPresenter;

    @Before
    public void setupPresenter() {
        // Mockito has a very convenient way to inject mocks by using the @Mock annotation. To
        // inject the mocks in the test the initMocks method needs to be called.
        MockitoAnnotations.initMocks(this);

        mPresenter = new NumberPadTimePickerPresenter(mView, mLocaleModel, false);
    }

    @Test
    public void clickOnNumberKey_UpdatesTimeDisplay() {
        mPresenter.onNumberKeyClick("1");
        Mockito.verify(mView).updateTimeDisplay("1");
    }
}

package com.philliphsu.bottomsheetpickers.view.numberpad;

import com.philliphsu.bottomsheetpickers.view.LocaleModel;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import static org.mockito.Mockito.verify;

public class NumberPadTimePickerPresenterTest {

    @Mock
    private INumberPadTimePicker.View mView;

    @Mock
    private LocaleModel mLocaleModel;

    private NumberPadTimePickerPresenter mPresenter;
    private boolean mIs24HourMode;

    @Before
    public void setupPresenter() {
        // Mockito has a very convenient way to inject mocks by using the @Mock annotation. To
        // inject the mocks in the test the initMocks method needs to be called.
        MockitoAnnotations.initMocks(this);

        mIs24HourMode = false;
        mPresenter = new NumberPadTimePickerPresenter(mView, mLocaleModel, mIs24HourMode);
    }

    @Test
    public void verifyViewEnabledStatesForEmptyState() {
        mPresenter.onCreate(NumberPadTimePickerState.EMPTY);
        verify(mView).setNumberKeysEnabled(mIs24HourMode ? 0 : 1, 10);
        verify(mView).setBackspaceEnabled(false);
        verify(mView).setAmPmDisplayVisible(!mIs24HourMode);
        if (!mIs24HourMode) {
            verify(mView).setAmPmDisplayIndex(mLocaleModel.isAmPmWrittenBeforeTime() ? 0 : 1);
        }
        /* Verify setLeftAltKeyText() and setRightAltKeyText() manually. */
        verify(mView).setLeftAltKeyEnabled(false);
        verify(mView).setRightAltKeyEnabled(false);
        verify(mView).setHeaderDisplayFocused(true);
    }

    @Test
    public void clickOnNumberKey_UpdatesTimeDisplay() {
        mPresenter.onNumberKeyClick("1");
        verify(mView).updateTimeDisplay("1");
    }
}

Add test to verify enabled states of views when time picker is empty initialized.


package com.github.bot.curiosone.core.analysis;

import com.github.bot.curiosone.core.nlp.Phrase;

/**
 * Handles emotion analysis for a Phrase.
 * Provides a single public static method to perform to calculate the emotion of a given Phrase.
 */
public class EmotionAnalysis {

  /**
   * Private constructor.
   */
  private EmotionAnalysis() {}

  /**
   * Performs an emotion analysis of the provided Phrase.
   * @param p the Phrase to be analysed.
   * @return a String representation of the calculated emotion. Supports "sad", "happy" and "angry"
   */
  public static String getEmotion(Phrase p) {
    //TODO: Add implementation.
    return "";
  }
}

package com.github.bot.curiosone.core.analysis;

import com.github.bot.curiosone.core.nlp.Phrase;

/**
 * Handles emotion analysis for a Phrase.
 * Provides a single public static method to perform to calculate the emotion of a given Phrase.
 */
public class EmotionAnalysis {

  /**
   * Private constructor.
   */
  private EmotionAnalysis() {}

  /**
   * Performs an emotion analysis of the provided Phrase.
   * @param phrase the Phrase to be analysed.
   * @return a String representation of the calculated emotion. Supports "sad", "happy" and "angry"
   */
  public static String getEmotion(Phrase phrase) {
    double score = TokenScorer.calculateScore(phrase.getTokens());
    if (score <= -0.5) return "angry";
    if (score < 0) return "sad";
    return "happy";
  }
}

Add base implementation of getEmotion method


/*
 * Copyright 2014 Codenvy, S.A.
 *
 * 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.codenvy.ide.ext.datasource.client.editdatasource;

import com.google.gwt.i18n.client.Messages;

public interface EditDatasourceMessages extends Messages {

    @DefaultMessage("Edit Datasource")
    String editButtonText();

    @DefaultMessage("Delete Datasources")
    String deleteButtonText();

    @DefaultMessage("Close")
    String closeButtonText();

    @DefaultMessage("Edit/Delete datasources")
    String editDatasourcesMenuText();

    @DefaultMessage("Edit/Delete datasources")
    String editDatasourcesDialogText();

    @DefaultMessage("Datasources")
    String datasourcesListLabel();

    @DefaultMessage("Cannot edit more than one datasource")
    String editMultipleSelectionMessage();

    @DefaultMessage("No datasource selected")
    String editOrDeleteNoSelectionMessage();

    @DefaultMessage("Delete {0} datasources")
    String confirmDeleteDatasources(int size);

    @DefaultMessage("No datasources configured")
    String emptyDatasourceList();
}

/*
 * Copyright 2014 Codenvy, S.A.
 *
 * 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.codenvy.ide.ext.datasource.client.editdatasource;

import com.google.gwt.i18n.client.Messages;

public interface EditDatasourceMessages extends Messages {

    @DefaultMessage("Edit Datasource")
    String editButtonText();

    @DefaultMessage("Delete Datasources")
    String deleteButtonText();

    @DefaultMessage("Close")
    String closeButtonText();

    @DefaultMessage("Manage datasources")
    String editDatasourcesMenuText();

    @DefaultMessage("Manage datasources")
    String editDatasourcesDialogText();

    @DefaultMessage("Datasources")
    String datasourcesListLabel();

    @DefaultMessage("Cannot edit more than one datasource")
    String editMultipleSelectionMessage();

    @DefaultMessage("No datasource selected")
    String editOrDeleteNoSelectionMessage();

    @DefaultMessage("Delete {0} datasources")
    String confirmDeleteDatasources(int size);

    @DefaultMessage("No datasources configured")
    String emptyDatasourceList();
}

Change menu text from edit/delete datasource -> manage datasources


// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.security.tls;

import java.util.Arrays;

/**
 * @author bjorncs
 */
public enum AuthorizationMode {
    DISABLE("disable"),
    LOG_ONLY("log_only"),
    ENFORCE("enforce");

    final String configValue;

    AuthorizationMode(String configValue) {
        this.configValue = configValue;
    }

    public String configValue() {
        return configValue;
    }

    static AuthorizationMode fromConfigValue(String configValue) {
        return Arrays.stream(values())
                .filter(v -> v.configValue.equals(configValue))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("Unknown value: " + configValue));
    }
}

// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.security.tls;

import java.util.Arrays;

/**
 * @author bjorncs
 */
public enum AuthorizationMode {
    DISABLE("disable"),
    LOG_ONLY("log_only"),
    ENFORCE("enforce");

    final String configValue;

    AuthorizationMode(String configValue) {
        this.configValue = configValue;
    }

    public String configValue() {
        return configValue;
    }

    /**
     * @return Default value when authorization mode is not explicitly specified
     */
    public static AuthorizationMode defaultValue() {
        return ENFORCE;
    }

    static AuthorizationMode fromConfigValue(String configValue) {
        return Arrays.stream(values())
                .filter(v -> v.configValue.equals(configValue))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("Unknown value: " + configValue));
    }
}

Define default value for tls authorization mode


package us.codecraft.webmagic.selector;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;

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

/**
 * @author code4crafter@gmail.com
 * @since 0.3.0
 */
public abstract class BaseElementSelector implements Selector, ElementSelector {

    @Override
    public String select(String text) {
        if (text != null) {
            return select(Jsoup.parse(text));
        }
        return null;
    }

    @Override
    public List<String> selectList(String text) {
        if (text != null) {
            return selectList(Jsoup.parse(text));
        } else {
            return new ArrayList<String>();
        }
    }

    public Element selectElement(String text) {
        if (text != null) {
            return selectElement(Jsoup.parse(text));
        }
        return null;
    }

    public List<Element> selectElements(String text) {
        if (text != null) {
            return selectElements(Jsoup.parse(text));
        } else {
            return new ArrayList<Element>();
        }
    }

    public abstract Element selectElement(Element element);

    public abstract List<Element> selectElements(Element element);

    public abstract boolean hasAttribute();

}

package us.codecraft.webmagic.selector;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

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

/**
 * @author code4crafter@gmail.com
 * @since 0.3.0
 */
public abstract class BaseElementSelector implements Selector, ElementSelector {
    private Document parse(String text) {
        if (text == null) {
            return null;
        }

        // Jsoup could not parse

 or 	 tag directly
        // https://stackoverflow.com/questions/63607740/jsoup-couldnt-parse-tr-tag
        if ((text.startsWith("
") && text.endsWith("
"))
                || (text.startsWith("") && text.endsWith("	"))) {
            text = "
" + text + "
";
        }
        return Jsoup.parse(text);
    }

    @Override
    public String select(String text) {
        if (text != null) {
            return select(parse(text));
        }
        return null;
    }

    @Override
    public List<String> selectList(String text) {
        if (text != null) {
            return selectList(parse(text));
        } else {
            return new ArrayList<String>();
        }
    }

    public Element selectElement(String text) {
        if (text != null) {
            return selectElement(parse(text));
        }
        return null;
    }

    public List<Element> selectElements(String text) {
        if (text != null) {
            return selectElements(parse(text));
        } else {
            return new ArrayList<Element>();
        }
    }

    public abstract Element selectElement(Element element);

    public abstract List<Element> selectElements(Element element);

    public abstract boolean hasAttribute();

}

Enhance Jsoup could parse tr td tag directly


package com.aayaffe.sailingracecoursemanager.communication;

import java.io.Serializable;

/**
 * Created by aayaffe on 30/09/2015.
 */
public enum ObjectTypes {
    RaceManager(0),
    WorkerBoat(1),
    Buoy(2),
    FlagBuoy(3),
    TomatoBuoy(4),
    TriangleBuoy(5),
    StartLine(6),
    FinishLine(7),
    StartFinishLine(8),
    Gate(9),
    ReferencePoint(10),
    Other(11);

    private int value;

    ObjectTypes(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }
}

package com.aayaffe.sailingracecoursemanager.communication;

import java.io.Serializable;

/**
 * Created by aayaffe on 30/09/2015.
 */
public enum ObjectTypes {
    WorkerBoat,
    FlagBuoy,
    TomatoBuoy,
    TriangleBuoy,
    StartLine,
    FinishLine,
    StartFinishLine,

    RaceManager,  //from here, the relevant ObjectTypes:
    Buoy,
    Gate,
    Satellite,
    ReferencePoint,
    Other
}

Revert "Revert "Revert "Updated object types in Dev"""

This reverts commit 91bd4abec789636041e6ffe2d3481d5e48798534.


package org.robolectric.internal.runtime;

import android.os.Build;

import org.robolectric.RuntimeEnvironment;

public class RuntimeAdapterFactory {
  public static RuntimeAdapter getInstance() {
    int apiLevel = RuntimeEnvironment.getApiLevel();
    if (apiLevel <= Build.VERSION_CODES.JELLY_BEAN) {
      return new Api16RuntimeAdapter();
    } else if (apiLevel <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
      return new Api17RuntimeAdapter();
    } else if (apiLevel <= Build.VERSION_CODES.KITKAT) {
      return new Api19RuntimeAdapter();
    } else if (apiLevel <= Build.VERSION_CODES.LOLLIPOP) {
      return new Api21RuntimeAdapter();
    } else {
      throw new RuntimeException("Could not find AndroidRuntimeAdapter for API level: " + apiLevel);
    }
  }
}

package org.robolectric.internal.runtime;

import android.os.Build;

import org.robolectric.RuntimeEnvironment;

public class RuntimeAdapterFactory {
  public static RuntimeAdapter getInstance() {
    int apiLevel = RuntimeEnvironment.getApiLevel();
    if (apiLevel <= Build.VERSION_CODES.JELLY_BEAN) {
      return new Api16RuntimeAdapter();
    } else if (apiLevel <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
      return new Api17RuntimeAdapter();
    } else if (apiLevel <= Build.VERSION_CODES.KITKAT) {
      return new Api19RuntimeAdapter();
    } else if (apiLevel <= Build.VERSION_CODES.LOLLIPOP) {
      return new Api21RuntimeAdapter();
    } else if (apiLevel <= Build.VERSION_CODES.LOLLIPOP_MR1) {
      return new Api22RuntimeAdapter();
    } else {
      throw new RuntimeException("Could not find AndroidRuntimeAdapter for API level: " + apiLevel);
    }
  }
}

Add RuntimeAdapter for API22. Attach has one new String parameter "referrer"


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

package com.speedment.test.connector.support;

import com.speedment.runtime.config.Dbms;
import com.speedment.runtime.config.DbmsUtil;
import com.speedment.runtime.config.trait.HasNameUtil;

import java.util.HashMap;
import java.util.Map;

public final class Dummies {

    private Dummies() {
    }

    public static Dbms dbms() {
        final Map<String, Object> data = new HashMap<>();
        data.put(DbmsUtil.IP_ADDRESS, "localhost");
        data.put(DbmsUtil.PORT, 3066);
        data.put(DbmsUtil.USERNAME, "username");
        data.put(HasNameUtil.NAME, "name");

        return Dbms.create(null, data);
    }
}

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

package com.speedment.test.connector.support;

import com.speedment.runtime.config.Dbms;
import com.speedment.runtime.config.DbmsUtil;
import com.speedment.runtime.config.trait.HasNameUtil;

import java.util.HashMap;
import java.util.Map;

public final class Dummies {

    private Dummies() {
    }

    public static Dbms dbms() {
        final Map<String, Object> data = new HashMap<>();
        data.put(DbmsUtil.IP_ADDRESS, "localhost");
        data.put(DbmsUtil.PORT, 3066);
        data.put(DbmsUtil.USERNAME, "username");
        data.put(DbmsUtil.SERVER_NAME, "server");
        data.put(HasNameUtil.NAME, "name");

        return Dbms.create(null, data);
    }
}

Add server property to dummy DBMS

Add server property to dummy DBMS


/*
 * Copyright 2010 The Apache Software Foundation
 *
 * 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.hadoop.hbase.stargate.util;

import java.util.HashMap;
import java.util.Map;

/**
 * Generic storage for per user information.
 */
public class UserData {

  public static final int TOKENBUCKET = 1;

  Map<Integer,Object> data = new HashMap<Integer,Object>(1);

  public synchronized boolean has(final int sel) {
    return data.get(sel) != null;
  }

  public synchronized Object get(final int sel) {
    return data.get(sel);
  }

  public synchronized Object put(final int sel, final Object o) {
    return data.put(sel, o);
  }

  public synchronized Object remove(int sel) {
    return remove(sel);
  }

}

/*
 * Copyright 2010 The Apache Software Foundation
 *
 * 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.hadoop.hbase.stargate.util;

import java.util.HashMap;
import java.util.Map;

/**
 * Generic storage for per user information.
 */
public class UserData {

  public static final int TOKENBUCKET = 1;

  Map<Integer,Object> data = new HashMap<Integer,Object>(1);

  public synchronized boolean has(final int sel) {
    return data.get(sel) != null;
  }

  public synchronized Object get(final int sel) {
    return data.get(sel);
  }

  public synchronized Object put(final int sel, final Object o) {
    return data.put(sel, o);
  }

  public synchronized Object remove(int sel) {
    return data.remove(sel);
  }

}

Fix infinite recursive loop bug

[stargate] Fix infinite recursive loop bug

Submitted-by: Zhentao Huang <zhentao.huang@trendmicro.com.cn>
Signed-off-by: Andrew Purtell <apurtell@apache.org>

git-svn-id: 25ca64b629f24bdef6d1cceac138f74b13f55e41@943999 13f79535-47bb-0310-9956-ffa450edef68


package com.pholser.junit.quickcheck.internal.extractors;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.javaruntype.type.Types;

import com.pholser.junit.quickcheck.RandomValueExtractor;
import com.pholser.junit.quickcheck.RegisterableRandomValueExtractor;

public class ExtractorRepository {
    private final Map<Type, RandomValueExtractor<?>> extractors = new HashMap<Type, RandomValueExtractor<?>>();

    public ExtractorRepository add(Iterable<RegisterableRandomValueExtractor<?>> source) {
        for (RegisterableRandomValueExtractor<?> each : source)
            registerTypes(each);

        return this;
    }

    private void registerTypes(RegisterableRandomValueExtractor<?> extractor) {
        for (Class<?> each : extractor.types())
            extractors.put(each, extractor);
    }

    public RandomValueExtractor<?> extractorFor(Type type) {
        org.javaruntype.type.Type<?> typeToken = Types.forJavaLangReflectType(type);

        if (typeToken.isArray()) {
            Class<?> componentType = typeToken.getComponentClass();
            return new ArrayExtractor(componentType, extractors.get(componentType));
        } else if (List.class.equals(typeToken.getRawClass())) {
            Class<?> componentType = typeToken.getTypeParameters().get(0).getType().getRawClass();
            return new ListExtractor(extractors.get(componentType));
        }

        return extractors.get(type);
    }
}

package com.pholser.junit.quickcheck.internal.extractors;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.javaruntype.type.Types;

import com.pholser.junit.quickcheck.RandomValueExtractor;
import com.pholser.junit.quickcheck.RegisterableRandomValueExtractor;

public class ExtractorRepository {
    private final Map<Type, RandomValueExtractor<?>> extractors = new HashMap<Type, RandomValueExtractor<?>>();

    public ExtractorRepository add(Iterable<RegisterableRandomValueExtractor<?>> source) {
        for (RegisterableRandomValueExtractor<?> each : source)
            registerTypes(each);

        return this;
    }

    private void registerTypes(RegisterableRandomValueExtractor<?> extractor) {
        for (Class<?> each : extractor.types())
            extractors.put(each, extractor);
    }

    public RandomValueExtractor<?> extractorFor(Type type) {
        org.javaruntype.type.Type<?> typeToken = Types.forJavaLangReflectType(type);

        if (typeToken.isArray()) {
            Class<?> componentType = typeToken.getComponentClass();
            return new ArrayExtractor(componentType, extractorFor(componentType));
        } else if (List.class.equals(typeToken.getRawClass())) {
            Class<?> componentType = typeToken.getTypeParameters().get(0).getType().getRawClass();
            return new ListExtractor(extractorFor(componentType));
        }

        return extractors.get(type);
    }
}

Make extractor repo recurse in case of list or array.


package com.prateekj.snooper.infra;

import android.databinding.BindingAdapter;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.RecyclerView;
import android.widget.ListView;

import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
import se.emilsjolander.stickylistheaders.StickyListHeadersListView;

public class CustomBindings {

  @BindingAdapter("adapter")
  public static void setAdapter(RecyclerView recyclerView, RecyclerView.Adapter adapter) {
    recyclerView.setAdapter(adapter);
  }

  @BindingAdapter("stickyAdapter")
  public static void setStickyAdapter(StickyListHeadersListView stickyHeadersListView, StickyListHeadersAdapter adapter) {
    stickyHeadersListView.setAdapter(adapter);
  }

  @BindingAdapter("nestingScrollingEnabled")
  public static void setNestingScrollingEnabled(StickyListHeadersListView stickyHeadersListView, boolean enabled) {
    ListView listView = stickyHeadersListView.getWrappedList();
    ViewCompat.setNestedScrollingEnabled(listView, enabled);
  }

  @BindingAdapter("itemDecoration")
  public static void setItemDecoration(RecyclerView recyclerView, RecyclerView.ItemDecoration itemDecoration) {
    recyclerView.addItemDecoration(itemDecoration);
  }
}

package com.prateekj.snooper.infra;

import android.databinding.BindingAdapter;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.RecyclerView;
import android.widget.ListView;

import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
import se.emilsjolander.stickylistheaders.StickyListHeadersListView;

public class CustomBindings {

  @BindingAdapter("app:adapter")
  public static void setAdapter(RecyclerView recyclerView, RecyclerView.Adapter adapter) {
    recyclerView.setAdapter(adapter);
  }

  @BindingAdapter("app:stickyAdapter")
  public static void setStickyAdapter(StickyListHeadersListView stickyHeadersListView, StickyListHeadersAdapter adapter) {
    stickyHeadersListView.setAdapter(adapter);
  }

  @BindingAdapter("app:nestingScrollingEnabled")
  public static void setNestingScrollingEnabled(StickyListHeadersListView stickyHeadersListView, boolean enabled) {
    ListView listView = stickyHeadersListView.getWrappedList();
    ViewCompat.setNestedScrollingEnabled(listView, enabled);
  }

  @BindingAdapter("app:itemDecoration")
  public static void setItemDecoration(RecyclerView recyclerView, RecyclerView.ItemDecoration itemDecoration) {
    recyclerView.addItemDecoration(itemDecoration);
  }
}

Revert "removing data binding warnings"

Revert "removing data binding warnings"

This reverts commit df1e2ca5d05839d788c73df62681e060de9760fd.


/*
 * Bach - Java Shell Builder
 * Copyright (C) 2020 Christian Stein
 *
 * 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
 *
 *     https://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.
 */

/** Bach's own build program. */
class Build {
  public static void main(String... args) {
    System.out.println("Build Bach.java using Bach.java " + Bach.VERSION);
    // new Bach().build(project -> project.version("11.0-ea")).assertSuccessful();
  }
}

/*
 * Bach - Java Shell Builder
 * Copyright (C) 2020 Christian Stein
 *
 * 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
 *
 *     https://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.
 */

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;

/** Bach's own build program. */
class Build {
  public static void main(String... args) {
    var bach = new Bach();
    bach.print("Build Bach.java using %s", bach);
    var project = newProjectDescriptor();
    bach.print("%s", project);
    // bach.build(project).assertSuccessful();
  }

  private static Object newProjectDescriptor() {
    var folders = new ArrayList<Bach.Folder>();
    folders.addAll(mainFolders());
    folders.addAll(testFolders());
    return folders;
  }

  private static List<Bach.Folder> mainFolders() {
    return List.of(new Bach.Folder(Path.of("src/de.sormuras.bach/main/java"), 11));
  }

  private static List<Bach.Folder> testFolders() {
    return List.of(
        new Bach.Folder(Path.of("src/de.sormuras.bach/test/java"), 14),
        new Bach.Folder(Path.of("src/de.sormuras.bach/test/java-module"), 9),
        new Bach.Folder(Path.of("src/test.base/test/java"), 14),
        new Bach.Folder(Path.of("src/test.module/test/java"), 14),
        new Bach.Folder(Path.of("src/test.preview/test-preview/java"), 14));
  }
}

Create all folders in build program

Create all folders in build program


package mb.nabl2.terms.unification;

public class Unifiers {

    public static class Immutable {

        public static IUnifier.Immutable of() {
//            return PersistentUnifier.Immutable.of();
            return IncrementalVarSetPersistentUnifier.Immutable.of();
        }

        public static IUnifier.Immutable of(boolean finite) {
//            return PersistentUnifier.Immutable.of(finite);
            return IncrementalVarSetPersistentUnifier.Immutable.of(finite);
        }

    }

}

package mb.nabl2.terms.unification;

public class Unifiers {

    public static class Immutable {

        public static IUnifier.Immutable of() {
            return PersistentUnifier.Immutable.of();
//            return IncrementalVarSetPersistentUnifier.Immutable.of();
        }

        public static IUnifier.Immutable of(boolean finite) {
            return PersistentUnifier.Immutable.of(finite);
//            return IncrementalVarSetPersistentUnifier.Immutable.of(finite);
        }

    }

}

Revert to original unifier since incremental version is still buggy.


package name.webdizz.fault.tolerance.timeout;

import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.junit.Test;

public class HttpOperationTimeoutTest {

    public static final int MS = 50;

    @Test(expected = ConnectTimeoutException.class)
    public void shouldMakeSureTimeOutCaughtUsingApacheHttpClient() throws Exception {
        int timeout = 1;
        RequestConfig config = RequestConfig.custom()
                .setConnectTimeout(timeout * MS)
                .setConnectionRequestTimeout(timeout * MS)
                .setSocketTimeout(timeout * MS).build();
        CloseableHttpClient client =
                HttpClientBuilder.create().setDefaultRequestConfig(config).build();
        client.execute(new HttpGet("http://yahoo.com"));
    }
}

package name.webdizz.fault.tolerance.timeout;

import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.junit.Test;

public class HttpOperationTimeoutTest {

    public static final int MS = 50;

    @Test(expected = ConnectTimeoutException.class)
    public void shouldMakeSureTimeOutCaughtUsingApacheHttpClient() throws Exception {
        int timeout = 1;
        RequestConfig config = RequestConfig.custom()
                .setConnectTimeout(timeout * MS)
                .build();
        CloseableHttpClient client =
                HttpClientBuilder.create().setDefaultRequestConfig(config).build();
        client.execute(new HttpGet("http://yahoo.com"));
    }
}

Remove socket connection time out configuration


package abhijith.carboncontacts;

/*
    Object of this class depicts a single phone number.
    Each phone number within a contact is considered as a different object
*/

public class PhoneContact implements Comparable<PhoneContact> {

    private String contactNumber;
    private String contactName;
    private String contactType;
    private String contactID;
    private String contactNumberID;

    //TODO: Add more fields like display pic, email etc for better user experience

    PhoneContact(String number, String name, String type, String id, String phoneNumberID){
        contactNumber = number.trim().replaceAll(" ","");
        contactName = name;
        contactType = type;
        contactID = id;
        contactNumberID = phoneNumberID;
    }

    /*Getters for each phone contact field*/

    String getContactNumber(){
        return contactNumber;
    }
    String getContactName(){
        return contactName;
    }
    String getContactType(){
        return contactType;
    }
    String getContactID(){
        return contactID;
    }
    String getContactNumberID(){
        return contactNumberID;
    }

    //Comparator to sort the PhoneContact objects according to the number
    @Override
    public int compareTo(PhoneContact another) {
        return new String(this.getContactNumber()).compareTo(new String(another.getContactNumber()));
    }
}

package abhijith.carboncontacts;

/*
    Object of this class depicts a single phone number.
    Each phone number within a contact is considered as a different object
*/

public class PhoneContact implements Comparable<PhoneContact> {

    private String contactNumber;
    private String contactName;
    private String contactType;
    private String contactID;
    private String contactNumberID;

    //TODO: Add more fields like display pic, email etc for better user experience

    PhoneContact(String number, String name, String type, String id, String phoneNumberID){
        String tempNumber;
        tempNumber = number.trim().replaceAll(" ","");
        tempNumber = tempNumber.trim().replaceAll("-","");
        tempNumber = tempNumber.trim().replace("(", "");
        contactNumber = tempNumber.trim().replace(")", "");
        contactName = name;
        contactType = type;
        contactID = id;
        contactNumberID = phoneNumberID;
    }

    /*Getters for each phone contact field*/

    String getContactNumber(){
        return contactNumber;
    }
    String getContactName(){
        return contactName;
    }
    String getContactType(){
        return contactType;
    }
    String getContactID(){
        return contactID;
    }
    String getContactNumberID(){
        return contactNumberID;
    }

    //Comparator to sort the PhoneContact objects according to the number
    @Override
    public int compareTo(PhoneContact another) {
        return new String(this.getContactNumber()).compareTo(new String(another.getContactNumber()));
    }
}

Fix bug that unable to detect duplicate contact with - or ()


/*
 * Copyright 2015 Chidiebere Okwudire.
 *
 * 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.
 *
 * Original implementation adapted from Thiago Locatelli's Parse4J project
 * (see https://github.com/thiagolocatelli/parse4j)
 */

package com.parse4cn1.command;

import com.codename1.io.ConnectionRequest;
import com.parse4cn1.ParseException;

/**
 * This class defines a command for deleting resources from the Parse server.
 */
public class ParseDeleteCommand extends ParseCommand {

    private final String endPoint;
    private String objectId;

    public ParseDeleteCommand(String endPoint, String objectId) {
        this.endPoint = endPoint;
        this.objectId = objectId;
    }

    public ParseDeleteCommand(String endPoint) {
        this.endPoint = endPoint;
    }

    @Override
    void setUpRequest(ConnectionRequest request) throws ParseException {
        setupDefaultHeaders();
        request.setPost(true);
        request.setHttpMethod("DELETE");
        request.setUrl(getUrl(endPoint, objectId));
    }
}

/*
 * Copyright 2015 Chidiebere Okwudire.
 *
 * 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.
 *
 * Original implementation adapted from Thiago Locatelli's Parse4J project
 * (see https://github.com/thiagolocatelli/parse4j)
 */

package com.parse4cn1.command;

import com.codename1.io.ConnectionRequest;
import com.parse4cn1.ParseException;

/**
 * This class defines a command for deleting resources from the Parse server.
 */
public class ParseDeleteCommand extends ParseCommand {

    private final String endPoint;
    private String objectId;

    public ParseDeleteCommand(String endPoint, String objectId) {
        this.endPoint = endPoint;
        this.objectId = objectId;
    }

    public ParseDeleteCommand(String endPoint) {
        this.endPoint = endPoint;
    }

    @Override
    void setUpRequest(ConnectionRequest request) throws ParseException {
        setupDefaultHeaders();
        request.setPost(false);
        request.setHttpMethod("DELETE");
        request.setUrl(getUrl(endPoint, objectId));
    }
}

Delete isn't a post method

Delete isn't a post method

This should fix the issue described in this stack overflow question https://stackoverflow.com/questions/49714538/unable-to-delete-an-object-parse-server


package org.reldb.dbrowser.ui.preferences;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.util.Util;

/**
 * This class creates a preference page
 */
public class PreferencePageGeneral extends FieldEditorPreferencePage {
	public static final String LARGE_ICONS = "general.double_icons";
	public static final String DEFAULT_CMD_MODE = "general.default_cmd_mode";

	/**
	 * Constructor
	 */
	public PreferencePageGeneral() {
		setTitle("General");
		setDescription("General settings.");
	}

	protected void createFieldEditors() {
		String reloadPrompt = "";
		if (!Util.isMac())
			reloadPrompt = "  Restart after changing to see the full effect.";
		addField(new BooleanFieldEditor(LARGE_ICONS, "&Larger icons." + reloadPrompt, getFieldEditorParent()));

		addField(new BooleanFieldEditor(DEFAULT_CMD_MODE, "Default to command-line mode.", getFieldEditorParent()));
	}

}

package org.reldb.dbrowser.ui.preferences;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.util.Util;

/**
 * This class creates a preference page
 */
public class PreferencePageGeneral extends FieldEditorPreferencePage {
	public static final String LARGE_ICONS = "general.double_icons";
	public static final String DEFAULT_CMD_MODE = "general.default_cmd_mode";
	public static final String SKIP_DEFAULT_DB_LOAD = "general.skip_default_db_load";

	/**
	 * Constructor
	 */
	public PreferencePageGeneral() {
		setTitle("General");
		setDescription("General settings.");
	}

	protected void createFieldEditors() {
		String reloadPrompt = "";
		if (!Util.isMac())
			reloadPrompt = "  Restart after changing to see the full effect.";
		addField(new BooleanFieldEditor(LARGE_ICONS, "&Larger icons." + reloadPrompt, getFieldEditorParent()));

		addField(new BooleanFieldEditor(DEFAULT_CMD_MODE, "Default to command-line mode.", getFieldEditorParent()));

		addField(new BooleanFieldEditor(SKIP_DEFAULT_DB_LOAD, "Do not automatically load user's default database.", getFieldEditorParent()));
	}

}

Add preference to not load user's default database.


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

/**
 * @author Vitaliy.Bibaev
 */
public class SpecialCasesTest extends TraceExecutionTestCase {
  public void testSortedSignedDoubleZeros() {
    doTest(false);
  }
}

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

/**
 * @author Vitaliy.Bibaev
 */
public class SpecialCasesTest extends TraceExecutionTestCase {
  public void testSortedSignedDoubleZeros() {
    doTest(false);
  }

  public void testExceptionAsStreamResult() {
    doTest(false);
  }
}

Check that trace is correct if exception is a result of stream chain