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

import org.junit.Before;

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

/**
 * Test asserting Marionette versions.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.4.0
 */
public class MarionetteVersionTest extends BaseVersionTst {

	@Before
	public void setup() {
		browserManager = MarionetteDriverManager.getInstance();
		specificVersions = new String[] { "0.9.0", "0.8.0", "0.6.2", "0.5.0",
				"0.4.0", "0.3.0" };
	}

}

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

import org.junit.Before;

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

/**
 * Test asserting Marionette versions.
 *
 * @author Boni Garcia (boni.gg@gmail.com)
 * @since 1.4.0
 */
public class MarionetteVersionTest extends BaseVersionTst {

	@Before
	public void setup() {
		browserManager = MarionetteDriverManager.getInstance();
		specificVersions = new String[] { "0.10.0", "0.9.0", "0.8.0", "0.6.2",
				"0.5.0", "0.4.0", "0.3.0" };
	}

}

Add version 0.10.0 in test for Marionette versions


package org.metaborg.meta.nabl2.terms;

import com.google.common.collect.ImmutableClassToInstanceMap;

public interface ITermVar extends ITerm, IListTerm {

    String getResource();

    String getName();

    ITermVar withAttachments(ImmutableClassToInstanceMap<Object> value);

}

package org.metaborg.meta.nabl2.terms;

import com.google.common.collect.ImmutableClassToInstanceMap;

public interface ITermVar extends ITerm, IListTerm {

    String getResource();

    String getName();

    ITermVar withAttachments(ImmutableClassToInstanceMap<Object> value);

    @Override ITermVar withLocked(boolean locked);

}

Add override to refine return type.

Add override to refine return type.


/*
 *  Copyright (c) 2012-2020, Jan Bernitt
 *
 *  Licensed under the Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
 */

/**
 * Defines the API of Silk DI.
 *
 * @uses se.jbee.inject.declare.Bundle
 * @uses se.jbee.inject.declare.ModuleWith
 */
module se.jbee.inject {
  exports se.jbee.inject;
  exports se.jbee.inject.action;
  exports se.jbee.inject.bind;
  exports se.jbee.inject.bind.serviceloader;
  exports se.jbee.inject.bootstrap;
  exports se.jbee.inject.config;
  exports se.jbee.inject.container;
  exports se.jbee.inject.declare;
  exports se.jbee.inject.event;
  exports se.jbee.inject.extend;
  exports se.jbee.inject.scope;

  requires java.logging;
  requires java.desktop;
  requires java.management;

  uses se.jbee.inject.declare.Bundle;
  uses se.jbee.inject.declare.ModuleWith;
}

/*
 *  Copyright (c) 2012-2020, Jan Bernitt
 *
 *  Licensed under the Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
 */

/**
 * Defines the API of Silk DI.
 *
 * @uses se.jbee.inject.declare.Bundle
 * @uses se.jbee.inject.declare.ModuleWith
 */
module se.jbee.inject {
  exports se.jbee.inject;
  exports se.jbee.inject.action;
  exports se.jbee.inject.bind;
  exports se.jbee.inject.bind.serviceloader;
  exports se.jbee.inject.bootstrap;
  exports se.jbee.inject.config;
  exports se.jbee.inject.container;
  exports se.jbee.inject.declare;
  exports se.jbee.inject.event;
  exports se.jbee.inject.extend;
  exports se.jbee.inject.scope;

  requires transitive java.logging;
  requires java.desktop;
  requires java.management;

  uses se.jbee.inject.declare.Bundle;
  uses se.jbee.inject.declare.ModuleWith;
}

Fix module exports related warning

Fix module exports related warning

src\core\se\jbee\inject\bootstrap\Supply.java:52:
  warning: [exports] class Logger in module java.logging
                     is not indirectly exported using requires transitive
        public static final Supplier<Logger> LOGGER = (dep, context) //


package org.ucombinator.jaam.visualizer.gui;

public class GUINodeStatus
{
    public double left, right, top, bottom;
    public double x, y, width, height;

    // The width and height of the node's children within the same level of the hierarchy
    public double bboxWidth, bboxHeight;
    public double opacity;

    // Default constructor
    public GUINodeStatus()
    {
        this.setDefaultStatus();
    }

    // Copy constructor
    public GUINodeStatus(GUINodeStatus other)
    {
        this.left = other.left;
        this.right = other.right;
        this.top = other.top;
        this.bottom = other.bottom;

        this.x = other.x;
        this.y = other.y;
        this.width = other.width;
        this.height = other.height;

        this.opacity = other.opacity;
    }

    public void setDefaultStatus()
    {
        this.width = 1;
        this.height = 1;
        this.left = 0;
        this.right = 1;
        this.top = -1;
        this.bottom = 0;
        this.x = 0.5;
        this.y = -0.5;
        this.opacity = 1;
    }

    public String toString()
    {
        return "(x, y) = (" + x + ", " + y + "), left = " + left + ", right = " + right
                + ", width = " + width + ", top = " + top + ", bottom = " + bottom + ", height = " + height
                + ", opacity = " + opacity;
    }
}

package org.ucombinator.jaam.visualizer.gui;

public class GUINodeStatus
{
    public double left, right, top, bottom;
    public double x, y, width, height;

    // The width and height of the node's children within the same level of the hierarchy
    public double bboxWidth, bboxHeight;
    public double opacity;

    public GUINodeStatus()
    {
        this.width = 1;
        this.height = 1;
        this.left = 0;
        this.right = 1;
        this.top = -1;
        this.bottom = 0;
        this.x = 0.5;
        this.y = -0.5;
        this.opacity = 1;
    }

    public String toString()
    {
        return "(x, y) = (" + x + ", " + y + "), left = " + left + ", right = " + right
                + ", width = " + width + ", top = " + top + ", bottom = " + bottom + ", height = " + height
                + ", opacity = " + opacity;
    }
}

Remove unused constructor and inline single-use method


package com.github.sormuras.bach.project;

import com.github.sormuras.bach.Project;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;

/**
 * A space for main modules.
 *
 * @param modules the list of modules to compile
 * @param moduleSourcePaths the list of module source paths
 * @param release the Java version (release feature number) to compile for
 * @param tweaks the additional arguments to be passed on a per-tool basis
 */
public record MainSpace(
    List<String> modules,
    List<String> moduleSourcePaths,
    int release,
    Map<String, List<String>> tweaks)
    implements Space {

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

  @Override
  public Path classes(Project project) {
    return project.base().classes("", release);
  }
}

package com.github.sormuras.bach.project;

import com.github.sormuras.bach.Project;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;

/**
 * A space for main modules.
 *
 * @param modules the list of modules to compile
 * @param moduleSourcePaths the list of module source paths
 * @param release the Java version (release feature number) to compile for
 * @param tweaks the additional arguments to be passed on a per-tool basis
 */
public record MainSpace(
    List<String> modules,
    List<String> moduleSourcePaths,
    int release,
    Map<String, List<String>> tweaks)
    implements Space {

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

  @Override
  public Path classes(Project project) {
    return project.base().classes("", release);
  }

  /**
   * @param project the project providing a workspace directory
   * @param entry the path (directory or regular file) to resolve
   * @return a path within the given project's documentation workspace
   */
  public Path documentation(Project project, String entry) {
    return project.base().workspace("documentation", entry);
  }
}

Extend main space with documentation path accessor


package org.jeffpiazza.derby.devices;

import java.lang.reflect.Method;

public class AllDeviceTypes {
  // The universe of all possible device classes
  @SuppressWarnings(value = "unchecked")
  public static final Class<? extends TimerDevice>[] allDeviceClasses
      = (Class<? extends TimerDevice>[]) new Class[]{
        SmartLineDevice.class,
        FastTrackDevice.class,
        OlderFastTrackDevice.class,
        TheJudgeDevice.class,
        NewBoldDevice.class,
        DerbyTimerDevice.class,
        MiscJunkDevice.class,
        DerbyMagicDevice.class
      };

  public static String toHumanString(Class<? extends TimerDevice> type) {
    try {
      Method m = type.getMethod("toHumanString");
      return (String) m.invoke(null);
    } catch (Exception ex) {
      return null;
    }
  }

  public static void listDeviceClassNames() {
    for (Class<? extends TimerDevice> cl : allDeviceClasses) {
      String human = toHumanString(cl);
      System.err.println("         " + cl.getSimpleName()
                         + (human == null ? "" : (": " + human)));
    }
  }
}

package org.jeffpiazza.derby.devices;

import java.lang.reflect.Method;

public class AllDeviceTypes {
  // The universe of all possible device classes
  @SuppressWarnings(value = "unchecked")
  public static final Class<? extends TimerDevice>[] allDeviceClasses
      = (Class<? extends TimerDevice>[]) new Class[]{
        SmartLineDevice.class,
        FastTrackDevice.class,
        OlderFastTrackDevice.class,
        TheJudgeDevice.class,
        NewBoldDevice.class,
        DerbyTimerDevice.class,
        MiscJunkDevice.class,
        DerbyMagicDevice.class,
        DerbyMagic9600.class
      };

  public static String toHumanString(Class<? extends TimerDevice> type) {
    try {
      Method m = type.getMethod("toHumanString");
      return (String) m.invoke(null);
    } catch (Exception ex) {
      return null;
    }
  }

  public static void listDeviceClassNames() {
    for (Class<? extends TimerDevice> cl : allDeviceClasses) {
      String human = toHumanString(cl);
      System.err.println("         " + cl.getSimpleName()
                         + (human == null ? "" : (": " + human)));
    }
  }
}

Add DerbyMagic9600 as another possible timer device (DerbyMagic timer running at 9600 baud).


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

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

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

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

OAK-3749: Implement tooling for tracing a node through the revision history
Bump package export version

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


/* © 2013-2015 Deuterium Labs Limited */
package com.deuteriumlabs.dendrite.view;

import javax.servlet.jsp.PageContext;

public class CoverView extends View {
    public CoverView(final PageContext pageContext) {
        this.setPageContext(pageContext);
    }

	@Override
	public String getUrl() {
		return "/cover";
	}

	@Override
	public void initialise() {
		final PageContext pageContext = this.getPageContext();
		pageContext.setAttribute("webPageTitle", "Dendrite");
	}

	public void prepareTagName(final String tag) {
		final PageContext pageContext = this.getPageContext();
		pageContext.setAttribute("tagName", tag);
	}
}

/* © 2013-2015 Deuterium Labs Limited */
package com.deuteriumlabs.dendrite.view;

import javax.servlet.jsp.PageContext;

public class CoverView extends View {
    public CoverView(final PageContext pageContext) {
        this.pageContext = pageContext;
    }

	@Override
	public String getUrl() {
		return "/cover";
	}

	@Override
	public void initialise() {
		final PageContext pageContext = this.getPageContext();
		pageContext.setAttribute("webPageTitle", "Dendrite");
	}

	public void prepareTagName(final String tag) {
		final PageContext pageContext = this.getPageContext();
		pageContext.setAttribute("tagName", tag);
	}
}

Replace setter call with direct access

Replace setter call with direct access


package com.mlab.roadrecorder.settings;

import org.apache.log4j.Logger;

import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment;

import com.mlab.roadrecorder.alvac.R;

public class SettingsFragment extends PreferenceFragment {
	private final Logger LOG = Logger.getLogger(SettingsFragment.class);

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

		addPreferencesFromResource(R.xml.prefs);
		ListPreference listpref = (ListPreference) findPreference("videoresolution");

		listpref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
			@Override
			public boolean onPreferenceChange(Preference preference, Object newValue) {
				LOG.debug("onPreferenceChange() " + newValue);
				return true;
			}
		});
	}

}

package com.mlab.roadrecorder.settings;

import org.apache.log4j.Logger;

import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment;

import com.mlab.roadrecorder.App;
import com.mlab.roadrecorder.alvac.R;

public class SettingsFragment extends PreferenceFragment {
	private final Logger LOG = Logger.getLogger(SettingsFragment.class);

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

		addPreferencesFromResource(R.xml.prefs);
		ListPreference listpref = (ListPreference) findPreference("videoresolution");
		listpref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
			@Override
			public boolean onPreferenceChange(Preference preference, Object newValue) {
				LOG.debug("onPreferenceChange() " + newValue);
				setSummary(preference, newValue.toString());
				return true;
			}
		});
		setSummary(listpref, App.getVideoResolution());

		EditTextPreference edit = (EditTextPreference) findPreference("mindiskspace");
		edit.setSummary("Mínimo espacio en disco para empezar a grabar " + App.getMinDiskSpaceToSave() + " Mb");

	}
	private void setSummary(Preference preference, String summary) {
		if(summary.equals("480")) {
			preference.setSummary("720x480 px");
		} else if(summary.equals("720")) {
			preference.setSummary("1280x720 px");
		} else if(summary.equals("1080")) {
			preference.setSummary("1920x1080 px");
		} else {
			preference.setSummary("");
		}
	}
}

Add summaries to ListPreference and MinDiskSpace preference


package com.bookbase.bookbase.database;

import android.arch.persistence.room.Room;
import android.content.Context;

public class DatabaseFactory{

    private static DatabaseFactory instance;

    private static AppDatabase db;

    private static void createDb(Context context){
        if(db == null){
            db = Room.databaseBuilder(context, AppDatabase.class, "bookbase-db").allowMainThreadQueries().build();
        }
        return;
    }

    public static AppDatabase getDb(Context context){
        if(instance == null){
            createDb(context);
            instance = new DatabaseFactory();
            return db;
        }
        return db;
    }

}

package com.bookbase.bookbase.database;

import android.arch.persistence.room.Room;
import android.content.Context;

public class DatabaseFactory{

    private static DatabaseFactory instance;

    private static AppDatabase db;

    private static void createDb(Context context){
        if(db == null){
            db = Room.databaseBuilder(context, AppDatabase.class, "bookbase-db").build();
        }
        return;
    }

    public static AppDatabase getDb(Context context){
        if(instance == null){
            createDb(context);
            instance = new DatabaseFactory();
            return db;
        }
        return db;
    }

}

Move db access off main thread

Move db access off main thread


import java.io.*;

public class MarkResetTest {
    public static void main(String av[]) throws Exception {
        BufferedInputStream b =
	  new BufferedInputStream(new StringBufferInputStream( "ABCDEF"));
        b.mark(3);
        b.read();
        b.read();
        b.read();
        b.reset();
        b.mark(-1);
        byte []bb = new byte[5];
        int r = b.read(bb, 0, 5);
        if (r == 5) {
            System.out.println("Success.");
        } else {
            System.out.println("Failure " + r);
        }
    }
}

/* Expected Output:
Success.
*/

import java.io.*;

public class MarkResetTest {
    public static void main(String av[]) throws Exception {

	// Test BufferedReader
	final int READLEN = 3;
	StringReader source = new StringReader ("0123456789ABC");
	BufferedReader br = new BufferedReader (source, 5);
	char buf[] = new char [READLEN];

	for (;;) {
	    br.mark(READLEN);
	    int charsRead = 0;
	    int len = 0;
	    while (charsRead < READLEN &&
		   (len = br.read (buf, charsRead, READLEN-charsRead)) >= 0)
		charsRead += len;
	    if (len < 0)
		break;
	    System.out.println ("read " + buf);
	    br.reset();
	    br.read();    // next char
	}

	// Test BufferedInputStream
        BufferedInputStream b =
	  new BufferedInputStream(new StringBufferInputStream("ABCDEF"));
        b.mark(3);
        b.read();
        b.read();
        b.read();
        b.reset();
        b.mark(-1);
        byte []bb = new byte[5];
        int r = b.read(bb, 0, 5);
        if (r == 5) {
            System.out.println("Success.");
        } else {
            System.out.println("Failure " + r);
        }
    }
}

/* Expected Output:
read 012
read 123
read 234
read 345
read 456
read 567
read 678
read 789
read 89A
read 9AB
read ABC
Success.
*/

Add a test for BufferedReader here.

Add a test for BufferedReader here.


package com.ibm.sk;

import java.util.Arrays;
import java.util.stream.Collectors;

import com.ibm.sk.ant.AntLoader;
import com.ibm.sk.ant.facade.AntFactory;
import com.ibm.sk.ff.gui.common.objects.operations.InitMenuData;
import com.ibm.sk.handlers.GameMenuHandler;

public class MenuMain extends AbstractMain {

	public MenuMain() {
		super();
	}

	public static void main(final String args[]) {
		final AntFactory[] implementations = AntLoader.getImplementations();
		final InitMenuData initData = new InitMenuData();

		initData.setCompetitors(Arrays.asList(implementations).stream().map(AntFactory::getTeamName)
				.collect(Collectors.toList()).stream().toArray(String[]::new));
		showMainWindow(initData);
	}

	public static void showMainWindow(final InitMenuData initData) {
		FACADE.showInitMenu(initData);
		FACADE.addGuiEventListener(new GameMenuHandler(FACADE, initData));
	}

}

package com.ibm.sk;

import java.util.Arrays;
import java.util.stream.Collectors;

import com.ibm.sk.ant.AntLoader;
import com.ibm.sk.ant.facade.AntFactory;
import com.ibm.sk.ff.gui.client.ReplayFileHelper;
import com.ibm.sk.ff.gui.common.objects.operations.InitMenuData;
import com.ibm.sk.handlers.GameMenuHandler;

public class MenuMain extends AbstractMain {

	public MenuMain() {
		super();
	}

	public static void main(final String args[]) {
		final AntFactory[] implementations = AntLoader.getImplementations();
		final InitMenuData initData = new InitMenuData();

		initData.setCompetitors(Arrays.asList(implementations).stream().map(AntFactory::getTeamName).collect(Collectors.toList()).stream().toArray(String[]::new));
		initData.setReplay(ReplayFileHelper.getAvailableReplays());

		showMainWindow(initData);
	}

	public static void showMainWindow(final InitMenuData initData) {
		FACADE.showInitMenu(initData);
		FACADE.addGuiEventListener(new GameMenuHandler(FACADE, initData));
	}

}

Send replay data to menu

Send replay data to menu


package me.pagarme.factory;

import me.pagar.BankAccountType;
import me.pagar.model.BankAccount;

public class BankAccountFactory {

    public static String DEFAULT_AGENCIA = "0192";
    public static String DEFAULT_AGENCIA_DV = "0";
    public static String DEFAULT_CONTA = "03245";
    public static String DEFAULT_CONTA_DV = "0";
    public static String DEFAULT_BANK_CODE = "341";
    public static String DEFAULT_LEGAL_NAME = "Conta teste";
    public static String DEFAULT_DOCUMENT_NUMBER = "18344334799";
    public static BankAccountType DEFAULT_TYPE = BankAccountType.CONTA_CORRENTE;

    public BankAccount create(){
        BankAccount bankAccount = new BankAccount();
        bankAccount.setAgencia(DEFAULT_AGENCIA);
        bankAccount.setAgenciaDv(DEFAULT_AGENCIA_DV);
        bankAccount.setBankCode(DEFAULT_BANK_CODE);
        bankAccount.setConta(DEFAULT_CONTA);
        bankAccount.setContaDv(DEFAULT_CONTA_DV);
        bankAccount.setLegalName(DEFAULT_LEGAL_NAME);
        bankAccount.setDocumentNumber(DEFAULT_DOCUMENT_NUMBER);
        bankAccount.setType(DEFAULT_TYPE);
        return bankAccount;
    }
}

package me.pagarme.factory;

import me.pagar.BankAccountType;
import me.pagar.model.BankAccount;

public class BankAccountFactory {

    public static String DEFAULT_AGENCIA = "0192";
    public static String DEFAULT_AGENCIA_DV = "0";
    public static String DEFAULT_CONTA = "03245";
    public static String DEFAULT_CONTA_DV = "0";
    public static String DEFAULT_BANK_CODE = "341";
    public static String DEFAULT_LEGAL_NAME = "Conta teste";
    public static String DEFAULT_DOCUMENT_NUMBER = "18344334799";
    public static BankAccountType DEFAULT_TYPE = BankAccountType.CORRENTE;

    public BankAccount create(){
        BankAccount bankAccount = new BankAccount();
        bankAccount.setAgencia(DEFAULT_AGENCIA);
        bankAccount.setAgenciaDv(DEFAULT_AGENCIA_DV);
        bankAccount.setBankCode(DEFAULT_BANK_CODE);
        bankAccount.setConta(DEFAULT_CONTA);
        bankAccount.setContaDv(DEFAULT_CONTA_DV);
        bankAccount.setLegalName(DEFAULT_LEGAL_NAME);
        bankAccount.setDocumentNumber(DEFAULT_DOCUMENT_NUMBER);
        bankAccount.setType(DEFAULT_TYPE);
        return bankAccount;
    }
}

Refactor default value for BankAccountType as refactored on enum


package com.hyperwallet.clientsdk.model;

import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;

@XmlRootElement
public class HyperwalletErrorList {

    public List<HyperwalletError> errors = new ArrayList<HyperwalletError>();

    public HyperwalletErrorList() {}

    public List<HyperwalletError> getErrors() {
        return errors;
    }

    public void setErrors(List<HyperwalletError> errorList) {
        this.errors = errorList;
    }
}

package com.hyperwallet.clientsdk.model;

import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;

@XmlRootElement
public class HyperwalletErrorList {

    public List<HyperwalletError> errors = new ArrayList<HyperwalletError>();

    public HyperwalletErrorList() {}

    public List<HyperwalletError> getErrors() {
        return errors;
    }

    public void setErrors(List<HyperwalletError> errors) {
        this.errors = errors;
    }
}

Add the error representation to SDK library


// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author gjoranv
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("*://*/logs");
        addComponent(logHandler);
    }

}

// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.admin;

import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;

/**
 * @author gjoranv
 */
public class LogserverContainerCluster extends ContainerCluster<LogserverContainer> {

    public LogserverContainerCluster(AbstractConfigProducer<?> parent, String name, DeployState deployState) {
        super(parent, name, name, deployState);

        addDefaultHandlersWithVip();
        addLogHandler();
        addDefaultSearchAccessLog();
    }

    @Override
    protected void doPrepare(DeployState deployState) { }

    private void addLogHandler() {
        Handler<?> logHandler = Handler.fromClassName(ContainerCluster.LOG_HANDLER_CLASS);
        logHandler.addServerBindings("*://*/logs");
        addComponent(logHandler);
    }

}

Add access log for logserver container

Add access log for logserver container


package com.hp.autonomy.searchcomponents.idol.test;

import com.hp.autonomy.frontend.configuration.authentication.CommunityPrincipal;
import com.hpe.bigdata.frontend.spring.authentication.AuthenticationInformationRetriever;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@Configuration
@ConditionalOnProperty(value = "mock.configuration", matchIfMissing = true)
public class IdolTestAuthenticationConfiguration {
    @Bean
    @Primary
    @ConditionalOnProperty(value = "mock.authenticationRetriever", matchIfMissing = true)
    public AuthenticationInformationRetriever<?, CommunityPrincipal> authenticationInformationRetriever() {
        final UsernamePasswordAuthenticationToken authentication = mock(UsernamePasswordAuthenticationToken.class);
        when(authentication.isAuthenticated()).thenReturn(true);

        final CommunityPrincipal communityPrincipal = mock(CommunityPrincipal.class);
        when(communityPrincipal.getId()).thenReturn(1L);
        when(communityPrincipal.getUsername()).thenReturn("user");
        when(authentication.getPrincipal()).thenReturn(communityPrincipal);

        @SuppressWarnings("unchecked")
        final AuthenticationInformationRetriever<?, CommunityPrincipal> authenticationInformationRetriever = mock(AuthenticationInformationRetriever.class);
        when(authenticationInformationRetriever.getAuthentication()).thenReturn(authentication);
        when(authenticationInformationRetriever.getPrincipal()).thenReturn(communityPrincipal);
        return authenticationInformationRetriever;
    }
}

package com.hp.autonomy.searchcomponents.idol.test;

import com.hp.autonomy.frontend.configuration.authentication.CommunityPrincipal;
import com.hpe.bigdata.frontend.spring.authentication.AuthenticationInformationRetriever;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@Configuration
@ConditionalOnProperty(value = "mock.configuration", matchIfMissing = true)
public class IdolTestAuthenticationConfiguration {
    @Bean
    @Primary
    @ConditionalOnProperty(value = "mock.authenticationRetriever", matchIfMissing = true)
    public AuthenticationInformationRetriever<?, CommunityPrincipal> authenticationInformationRetriever() {
        final UsernamePasswordAuthenticationToken authentication = mock(UsernamePasswordAuthenticationToken.class);
        when(authentication.isAuthenticated()).thenReturn(true);

        final CommunityPrincipal communityPrincipal = mock(CommunityPrincipal.class);
        when(communityPrincipal.getId()).thenReturn(1L);
        when(communityPrincipal.getUsername()).thenReturn("user");
        when(communityPrincipal.getName()).thenReturn("user");
        when(authentication.getPrincipal()).thenReturn(communityPrincipal);

        @SuppressWarnings("unchecked")
        final AuthenticationInformationRetriever<UsernamePasswordAuthenticationToken, CommunityPrincipal> authenticationInformationRetriever = mock(AuthenticationInformationRetriever.class);
        when(authenticationInformationRetriever.getAuthentication()).thenReturn(authentication);
        when(authenticationInformationRetriever.getPrincipal()).thenReturn(communityPrincipal);
        return authenticationInformationRetriever;
    }
}

Enhance mock of idol user for integration tests (ISO-6)

[rev. matthew.gordon]


package com.github.arteam.simplejsonrpc.core.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ValueNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * Date: 07.06.14
 * Time: 12:24
 *
Representation of a JSON-RPC request

 */
public class Request {

    @Nullable
    private final String jsonrpc;

    @Nullable
    private final String method;

    @NotNull
    private final JsonNode params;

    @NotNull
    private final ValueNode id;

    public Request(@JsonProperty("jsonrpc") @Nullable String jsonrpc,
                   @JsonProperty("method") @Nullable String method,
                   @JsonProperty("params") @NotNull JsonNode params,
                   @JsonProperty("id") @NotNull ValueNode id) {
        this.jsonrpc = jsonrpc;
        this.method = method;
        this.id = id;
        this.params = params;
    }

    @Nullable
    public String getJsonrpc() {
        return jsonrpc;
    }

    @Nullable
    public String getMethod() {
        return method;
    }

    @NotNull
    public ValueNode getId() {
        return id;
    }

    @NotNull
    public JsonNode getParams() {
        return params;
    }

    @Override
    public String toString() {
        return "Request{jsonrpc=" + jsonrpc + ", method=" + method + ", id=" + id + ", params=" + params + "}";
    }
}

package com.github.arteam.simplejsonrpc.core.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.NullNode;
import com.fasterxml.jackson.databind.node.ValueNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * Date: 07.06.14
 * Time: 12:24
 *
Representation of a JSON-RPC request

 */
public class Request {

    @Nullable
    private final String jsonrpc;

    @Nullable
    private final String method;

    @NotNull
    private final JsonNode params;

    @Nullable
    private final ValueNode id;

    public Request(@JsonProperty("jsonrpc") @Nullable String jsonrpc,
                   @JsonProperty("method") @Nullable String method,
                   @JsonProperty("params") @NotNull JsonNode params,
                   @JsonProperty("id") @Nullable ValueNode id) {
        this.jsonrpc = jsonrpc;
        this.method = method;
        this.id = id;
        this.params = params;
    }

    @Nullable
    public String getJsonrpc() {
        return jsonrpc;
    }

    @Nullable
    public String getMethod() {
        return method;
    }

    @NotNull
    public ValueNode getId() {
        return id != null ? id : NullNode.getInstance();
    }

    @NotNull
    public JsonNode getParams() {
        return params;
    }

    @Override
    public String toString() {
        return "Request{jsonrpc=" + jsonrpc + ", method=" + method + ", id=" + id + ", params=" + params + "}";
    }
}

Check that request id can be null

Check that request id can be null


package com.github.michaelkhw.playground.pi;

import com.github.michaelkhw.playground.timer.NanoTimer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.Arrays;
import java.util.Collection;

import static org.junit.Assert.assertEquals;

/**
 * Created by michael on 21/3/15.
 */
@RunWith(Parameterized.class)
public class PiCalculatorTest {
    private PiCalculator calculator;

    @Parameterized.Parameters(name = "{index}: PiCalculatorTest({0})")
    public static Collection<Object[]> testParameters() {
        return Arrays.asList(
                new Object[][]{
                        {"Akka", new AkkaPiCalculator()},
                        {"Simple", new SimplePiCalculator()},
                        {"Native", new NativePiCalculator()}
                });
    }

    public PiCalculatorTest(String name, PiCalculator calculator) {
        this.calculator = calculator;
    }

    @Test
    public void testCalculate() throws Exception {
        try {
            // Put a heavy Load to the calculator, attempting to JIT compile the method
            calculator.calculate(10000);

            // The actual work begins
            double actual;
            // This will took around 1-2 secs on my mac
            try (NanoTimer ignored = new NanoTimer()) {
                actual = calculator.calculate(100000000L);
            }

            assertEquals(3.14159, actual, 0.00001);
        } finally {
            if (calculator instanceof AutoCloseable)
                ((AutoCloseable) calculator).close();
        }
    }
}

package com.github.michaelkhw.playground.pi;

import com.github.michaelkhw.playground.timer.NanoTimer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.Arrays;
import java.util.Collection;

import static org.junit.Assert.assertEquals;

/**
 * Created by michael on 21/3/15.
 */
@RunWith(Parameterized.class)
public class PiCalculatorTest {
    private PiCalculator calculator;

    @Parameterized.Parameters(name = "{index}: PiCalculatorTest({0})")
    public static Collection<Object[]> testParameters() {
        return Arrays.asList(
                new Object[][]{
                        {"Akka", new AkkaPiCalculator()},
                        {"Simple", new SimplePiCalculator()},
                        //{"Native", new NativePiCalculator()}
                });
    }

    public PiCalculatorTest(String name, PiCalculator calculator) {
        this.calculator = calculator;
    }

    @Test
    public void testCalculate() throws Exception {
        try {
            // Put a heavy Load to the calculator, attempting to JIT compile the method
            calculator.calculate(10000);

            // The actual work begins
            double actual;
            // This will took around 1-2 secs on my mac
            try (NanoTimer ignored = new NanoTimer()) {
                actual = calculator.calculate(100000000L);
            }

            assertEquals(3.14159, actual, 0.00001);
        } finally {
            if (calculator instanceof AutoCloseable)
                ((AutoCloseable) calculator).close();
        }
    }
}

Disable native pi calculator test for the moment


package com.suse.studio.client.test.httpservermock;

import org.simpleframework.http.Response;

/**
 * Convenience responder that always outputs a 501 "Not Implemented" error.
 */
public class NotImplementedResponder implements Responder {

    /**
     * @see com.suse.studio.client.test.httpservermock.Responder#respond(org.simpleframework.http.Response)
     */
    @Override
    public void respond(Response response) {
        response.setCode(505);
    }
}

package com.suse.studio.client.test.httpservermock;

import org.simpleframework.http.Response;

/**
 * Convenience responder that always outputs a 501 "Not Implemented" error.
 */
public class NotImplementedResponder implements Responder {

    /**
     * @see com.suse.studio.client.test.httpservermock.Responder#respond(org.simpleframework.http.Response)
     */
    @Override
    public void respond(Response response) {
        response.setCode(501);
        response.setDescription("Not Implemented");
    }
}

Fix responder to return the correct code and description


package com.example.android.quakereport;

import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.support.v7.app.AppCompatActivity;

/**
 * Created by usa19 on 8/7/2017.
 */

public class SettingsActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.settings_activity);
    }

    public static class EarthquakePreferenceFragment extends PreferenceFragment {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            addPreferencesFromResource(R.xml.settings_main);
        }
    }
}

package com.example.android.quakereport;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;

/**
 * Created by usa19 on 8/7/2017.
 */

public class SettingsActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.settings_activity);
    }

    public static class EarthquakePreferenceFragment extends PreferenceFragment implements Preference.OnPreferenceChangeListener {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            addPreferencesFromResource(R.xml.settings_main);

            Preference minMagnitude = findPreference(getString(R.string.settings_min_magnitude_key));
            bindPreferenceSummaryToValue(minMagnitude);
        }

        private void bindPreferenceSummaryToValue(Preference minMagnitude) {
            minMagnitude.setOnPreferenceChangeListener(this);
            SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(minMagnitude.getContext());
            String preferenceString = preferences.getString(minMagnitude.getKey(), "");
            onPreferenceChange(minMagnitude, preferenceString);
        }

        @Override
        public boolean onPreferenceChange(Preference preference, Object value) {
            String stringValue = value.toString();
            preference.setSummary(stringValue);
            return true;
        }
    }
}

Add preference summary underneath the setting option


package com.example.activity;

import com.example.BuildConfig;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;

import static org.junit.Assert.assertTrue;

@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 18)
public class DeckardActivityTest {

    @Test
    public void testSomething() throws Exception {
        assertTrue(Robolectric.setupActivity(DeckardActivity.class) != null);
    }
}

package com.example.activity;

import com.example.BuildConfig;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;

import static org.junit.Assert.assertTrue;

@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class DeckardActivityTest {

    @Test
    public void testSomething() throws Exception {
        assertTrue(Robolectric.setupActivity(DeckardActivity.class) != null);
    }
}

Use sdk 21 in example spec

Use sdk 21 in example spec


package org.grouplens.lenskit.iterative;

/**
 * Training Loop controller for iterative updates
 */
public interface TrainingLoopController {
    /**
     *
     * @param error The error of the last iteration completed (use {Gustav Lindqvist Double#POSITIVE_INFINITY} before the first iteration).
     * @return {@code false} if the computation is finished.
     */
    boolean keepTraining(double error);

    /**
     *
     * @return the number of iterations done so far.
     */
    int getIterationCount();
}

package org.grouplens.lenskit.iterative;

/**
 * Training Loop controller for iterative updates
 */
public interface TrainingLoopController {
    /**
     * Query whether the computation should stop.
     *
     * @param error The error of the last iteration completed (use {Gustav Lindqvist Double#POSITIVE_INFINITY} before the first iteration).
     * @return {@code false} if the computation is finished.
     */
    boolean keepTraining(double error);

    /**
     *
     * @return the number of iterations done so far.
     */
    int getIterationCount();
}

Add a description for the keepTraining method


package com.mcmoddev.modernmetals.integration;

import com.google.common.collect.Lists;
import com.mcmoddev.lib.integration.IIntegration;
import com.mcmoddev.lib.util.AnnotationChecker;

import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import java.util.List;

public enum IntegrationManager {
    INSTANCE;

    private List<IIntegration> integrations = Lists.newArrayList();

    public void preInit(FMLPreInitializationEvent event) {
        AnnotationChecker.getInstances(event.getAsmData(), ModernMetalsPlugin.class, IIntegration.class).stream()
                .forEachOrdered(integration -> {
                    Class<? extends IIntegration> integrationClass = integration.getClass();
                    ModernMetalsPlugin plugin = integrationClass.getAnnotation(ModernMetalsPlugin.class);
                    if (Loader.isModLoaded(plugin.value())) {
                    	FMLLog.severe("MODERNMETALS: Loaded " + plugin.value());
                        integrations.add(integration);
                        integration.init();
                    }
                });
    }
}

package com.mcmoddev.modernmetals.integration;

import com.google.common.collect.Lists;
import com.mcmoddev.modernmetals.ModernMetals;
import com.mcmoddev.modernmetals.integration.ModernMetalsPlugin;
import com.mcmoddev.lib.integration.IIntegration;

import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import java.util.List;

public enum IntegrationManager {
    INSTANCE;

    private List<IIntegration> integrations = Lists.newArrayList();

    public void preInit(FMLPreInitializationEvent event) {
    	for( final ASMData asmDataItem : event.getAsmData().getAll(ModernMetalsPlugin.class.getCanonicalName()) ) {
    		String modId = asmDataItem.getAnnotationInfo().get("value").toString();
    		String className = asmDataItem.getClassName();
    		if (Loader.isModLoaded(modId)) {
    			IIntegration integration;
				try {
					integration = Class.forName(className).asSubclass(IIntegration.class).newInstance();
					ModernMetals.logger.info("MODERNMETALS Loaded: "+modId);
					integrations.add(integration);
					integration.init();
				} catch (final Exception e) {
					// do nothing
				}
    		}
    	}
    }
}

Make MMe match BMe and remove references to the removed AnnotationChecker class


/*
 * Copyright 2014 Johan Parent
 *
 *    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.pareto4j.inspector.collections;

import java.util.EnumSet;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: gebruiker
 * Date: 3/12/13
 * Time: 20:36
 * To change this template use File | Settings | File Templates.
 */
public class Profile {
    static final Set<DelegateTypes> modify = EnumSet.noneOf(DelegateTypes.class);
    static final boolean fullStacktrace = System.getProperty("fullStacktrace") != null;
    static {
        for (DelegateTypes delegateTypes : DelegateTypes.values()) {
            if (System.getProperty("skip"+delegateTypes.name()) == null) {
                modify.add(delegateTypes);
                System.err.println("Will inspect " + delegateTypes);
            }
        }
    }

}

/*
 * Copyright 2014 Johan Parent
 *
 *    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.pareto4j.inspector.collections;

import java.util.EnumSet;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: gebruiker
 * Date: 3/12/13
 * Time: 20:36
 * To change this template use File | Settings | File Templates.
 */
public class Profile {
    static final Set<DelegateTypes> modify = EnumSet.noneOf(DelegateTypes.class);
    static final boolean fullStacktrace = System.getProperty("inspector.fullStacktrace") != null;
    static {
        for (DelegateTypes delegateTypes : DelegateTypes.values()) {
            if (System.getProperty("skip"+delegateTypes.name()) == null) {
                modify.add(delegateTypes);
                System.err.println("Will inspect " + delegateTypes);
            }
        }
    }

}

Use inspector. prefix for "inpsector.fullStacktrace" sys prop


package info.u_team.u_team_core.inventory;

import info.u_team.u_team_core.api.item.IExtendedItemHandler;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.items.ItemStackHandler;

public class UItemStackHandler extends ItemStackHandler implements IExtendedItemHandler {

	public UItemStackHandler(int size) {
		super(size);
	}

	@Override
	public void setSize(int size) {
		throw new UnsupportedOperationException();
	}

	@Override
	public CompoundNBT serializeNBT() {
		final CompoundNBT compound = new CompoundNBT();
		ItemStackHelper.saveAllItems(compound, stacks, false);
		return compound;
	}

	@Override
	public void deserializeNBT(CompoundNBT compound) {
		ItemStackHelper.loadAllItems(compound, stacks);
		onLoad();
	}
}

package info.u_team.u_team_core.inventory;

import info.u_team.u_team_core.api.item.IExtendedItemHandler;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.items.ItemStackHandler;

public class UItemStackHandler extends ItemStackHandler implements IExtendedItemHandler {

	public UItemStackHandler(int size) {
		super(size);
	}

	@Override
	public void setSize(int size) {
		throw new UnsupportedOperationException();
	}

	@Override
	public CompoundNBT serializeNBT() {
		final CompoundNBT compound = new CompoundNBT();
		ItemStackHelper.saveAllItems(compound, stacks, false);
		return compound;
	}

	@Override
	public void deserializeNBT(CompoundNBT compound) {
		ItemStackHelper.loadAllItems(compound, stacks);
		onLoad();
	}

	@Override
	public void onContentsChanged(int slot) {
		super.onContentsChanged(slot);
	}
}

Make onContentsChanged public in the uitemstackhandler


package no.uio.ifi.trackfind.backend.services;

import no.uio.ifi.trackfind.backend.dao.Dataset;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.Collection;
import java.util.function.Function;

/**
 * Service for querying remote GSuite service for performing JSON to GSuite conversion.
 */
@Service
public class GSuiteService implements Function<Collection<Dataset>, String> {

    private RestTemplate restTemplate;

    /**
     * Convert datasets to GSuite.
     *
     * @param datasets Datasets to convert.
     * @return GSuite string.
     */
    @SuppressWarnings("unchecked")
    @Override
    public String apply(Collection<Dataset> datasets) {
        HttpEntity<Collection<Dataset>> request = new HttpEntity<>(datasets);
        return restTemplate.postForObject("http://gsuite/togsuite", request, String.class);
    }

    @Autowired
    public void setRestTemplate(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

}

package no.uio.ifi.trackfind.backend.services;

import no.uio.ifi.trackfind.backend.dao.Dataset;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;

/**
 * Service for querying remote GSuite service for performing JSON to GSuite conversion.
 */
@Service
public class GSuiteService implements Function<Collection<Dataset>, String> {

    private RestTemplate restTemplate;
    private SchemaService schemaService;

    /**
     * Convert datasets to GSuite.
     *
     * @param datasets Datasets to convert.
     * @return GSuite string.
     */
    @SuppressWarnings("unchecked")
    @Override
    public String apply(Collection<Dataset> datasets) {
        Map<String, Object> body = new HashMap<>();
        body.put("attributes", schemaService.getAttributes());
        body.put("datasets", datasets);
        HttpEntity<Map<String, Object>> request = new HttpEntity<>(body);
        return restTemplate.postForObject("http://gsuite/togsuite", request, String.class);
    }

    @Autowired
    public void setRestTemplate(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

    @Autowired
    public void setSchemaService(SchemaService schemaService) {
        this.schemaService = schemaService;
    }

}

Send FAIR attributes to GSuite service.

Send FAIR attributes to GSuite service.


package ethanjones.cubes.launcher;

import javax.swing.JOptionPane;

public class UncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
  public static final UncaughtExceptionHandler INSTANCE = new UncaughtExceptionHandler();

  private UncaughtExceptionHandler() {

  }

  @Override
  public void uncaughtException(Thread t, Throwable e) {
    JOptionPane.showMessageDialog(null, e.toString(), "Cubes Launcher Error", JOptionPane.ERROR_MESSAGE);
  }
}

package ethanjones.cubes.launcher;

import javax.swing.JOptionPane;

public class UncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
  public static final UncaughtExceptionHandler INSTANCE = new UncaughtExceptionHandler();

  private UncaughtExceptionHandler() {

  }

  @Override
  public void uncaughtException(Thread t, Throwable e) {
    try {
      System.err.println("Uncaught exception:");
      e.printStackTrace();
    } catch (Exception ignored) {
    }
    try {
      JOptionPane.showMessageDialog(null, e.toString(), "Cubes Launcher Error", JOptionPane.ERROR_MESSAGE);
    } catch (Exception ignored) {
    }
  }
}

Print uncaught exceptions to System.err as well as displaying dialog box


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

/**
 * @author David M. Lloyd
 *
 * @deprecated Use {@link org.wildfly.common.context.Contextual} instead.
 */
package org.wildfly.common.selector;

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

/**
 * @author David M. Lloyd
 */
package org.wildfly.common.selector;

Remove invalid @deprecated tag from package doc


package no.priv.bang.ukelonn.impl;

import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

public class UkelonnUI extends UI {
    private static final long serialVersionUID = 1388525490129647161L;

    @Override
    protected void init(VaadinRequest request) {
        // Create the content root layout for the UI
        VerticalLayout content = new VerticalLayout();
        setContent(content);

        // Display the greeting
        content.addComponent(new Label("Hello World!"));

        // Have a clickable button
        content.addComponent(new Button("Push Me!",
                                        new Button.ClickListener() {
                                            private static final long serialVersionUID = 2723190031041985566L;

                                            @Override
                                            public void buttonClick(ClickEvent e) {
                                                Notification.show("Pushed!");
                                            }
                                        }));
    }

}

package no.priv.bang.ukelonn.impl;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

public class UkelonnUI extends UI {
    private static final long serialVersionUID = 1388525490129647161L;

    @Override
    protected void init(VaadinRequest request) {
    	Subject currentUser = SecurityUtils.getSubject();
        // Create the content root layout for the UI
        VerticalLayout content = new VerticalLayout();
        setContent(content);

        // Display the greeting
        content.addComponent(new Label("Hello " + currentUser.getPrincipal()));

        // Have a clickable button
        content.addComponent(new Button("Push Me!",
                                        new Button.ClickListener() {
                                            private static final long serialVersionUID = 2723190031041985566L;

                                            @Override
                                            public void buttonClick(ClickEvent e) {
                                                Notification.show("Pushed!");
                                            }
                                        }));
    }

}

Access the shiro username (aka "principal") from the vaadin UI.


package x2x.translator.xcodeml.xelement;

import org.w3c.dom.Element;

/**
 * The XintConstant represents the FintConstant elements (7.1.1) element in
 * XcodeML intermediate representation.
 *
 * Elements: defined in Xconstant
 * - contains constant value
 * Attributes: defined in Xconstant
 * - Optional: type (text), kind (text)
 */

public class XintConstant extends Xconstant {
  public XintConstant(Element intConstantElement){
    super(intConstantElement);
  }

  public XintConstant create(XcodeProg xcodeml, String value, String type,
    String kind)
  {
    Xconstant constant = create(xcodeml, value, type, kind, XconstType.INT);
    return constant == null ? null : (XintConstant)constant;
  }
}

package x2x.translator.xcodeml.xelement;

import org.w3c.dom.Element;

/**
 * The XintConstant represents the FintConstant elements (7.1.1) element in
 * XcodeML intermediate representation.
 *
 * Elements: defined in Xconstant
 * - contains constant value
 * Attributes: defined in Xconstant
 * - Optional: type (text) defined in Xconstant, kind (text) defined
 *             in Xconstant
 */

public class XintConstant extends Xconstant {

  public XintConstant(Element intConstantElement){
    super(intConstantElement);
  }

  public XintConstant create(XcodeProg xcodeml, String value, String type,
    String kind)
  {
    Xconstant constant = create(xcodeml, value, type, kind, XconstType.INT);
    return constant == null ? null : (XintConstant)constant;
  }
}

Add comment + fix typo

Add comment + fix typo


/*
 * Copyright 2017 Patrik Karlsson.
 *
 * 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.nbgames.core.actions;

import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionRegistration;
import org.openide.util.NbBundle;

/**
 *
 * @author Patrik Karlsson
 */
public class CallbackOptionsAction {

    @ActionID(category = "Game",
            id = "org.nbgames.core.actions.OptionsAction")
    @ActionRegistration(displayName = "#CTL_OptionsAction")
    @ActionReferences({
        @ActionReference(path = "Shortcuts", name = "D-P")
        ,
        @ActionReference(path = "Shortcuts", name = "C-PERIOD")
    })
    @NbBundle.Messages("CTL_OptionsAction=Options")
    public static final String KEY = "OptionsAction";
}

/*
 * Copyright 2017 Patrik Karlsson.
 *
 * 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.nbgames.core.actions;

import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionRegistration;
import org.openide.util.NbBundle;

/**
 *
 * @author Patrik Karlsson
 */
public class CallbackOptionsAction {

    @ActionID(category = "Game",
            id = "org.nbgames.core.actions.OptionsAction")
    @ActionRegistration(displayName = "#CTL_OptionsAction")
    @ActionReferences({
        @ActionReference(path = "Shortcuts", name = "D-P")
        ,
        @ActionReference(path = "Shortcuts", name = "D-COMMA")
    })
    @NbBundle.Messages("CTL_OptionsAction=Options")
    public static final String KEY = "OptionsAction";
}

Use cmd comma for options

Core: Use cmd comma for options


/*
 * Copyright (C) 2010-2013 by PhonyTive LLC (http://phonytive.com)
 * http://astivetoolkit.org
 *
 * This file is part of Astive Toolkit(ATK)
 *
 * 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.astivetoolkit.util.test;

import junit.framework.TestCase;
import org.astivetoolkit.util.AppLocale;

/**
 * Test case for {@link org.astivetoolkit.util.AppLocale}.
 *
 * @since 1.0.0
 */
public class AppLocaleTest extends TestCase {

    /**
     * Creates a new AppLocaleTest object.
     */
    public AppLocaleTest() {
    }

    /**
     * Test method.
     */
    public void testAppLocale() {
        assertEquals(AppLocale.getI18n("messageTest", new Object[]{"test"}), "This is a test.");
    }
}

/*
 * Copyright (C) 2010-2013 by PhonyTive LLC (http://phonytive.com)
 * http://astivetoolkit.org
 *
 * This file is part of Astive Toolkit(ATK)
 *
 * 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.astivetoolkit.util.test;

import java.util.Locale;
import junit.framework.TestCase;
import org.astivetoolkit.util.AppLocale;

/**
 * Test case for {@link org.astivetoolkit.util.AppLocale}.
 *
 * @since 1.0.0
 */
public class AppLocaleTest extends TestCase {

    /**
     * Creates a new AppLocaleTest object.
     */
    public AppLocaleTest() {
    }

    /**
     * Test method.
     */
    public void testAppLocale() {
        // This test only work if the Locale is English
        if(Locale.getDefault() == Locale.ENGLISH) {
            assertEquals(AppLocale.getI18n("messageTest", new Object[]{"test"}), "This is a test.");
        }
    }
}

Test works only for locale=es_US.

Test works only for locale=es_US.


package com.jraska.github.client.network;

import android.content.Context;
import com.jraska.github.client.dagger.PerApp;
import dagger.Module;
import dagger.Provides;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import timber.log.Timber;

import java.io.File;

@Module
public class NetworkModule {
  @Provides @PerApp OkHttpClient provideOkHttpClient(Context context) {
    HttpLoggingInterceptor.Logger logger = message -> Timber.tag("OkHttp").v(message);
    HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(logger);
    loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);

    File cacheDir = context.getCacheDir();
    Cache cache = new Cache(cacheDir, 1024 * 1024 * 4);

    OkHttpClient client = new OkHttpClient.Builder()
        .addInterceptor(loggingInterceptor)
        .cache(cache)
        .build();

    return client;
  }
}

package com.jraska.github.client.network;

import android.content.Context;
import com.jraska.github.client.dagger.PerApp;
import dagger.Module;
import dagger.Provides;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import timber.log.Timber;

import java.io.File;

@Module
public class NetworkModule {
  @Provides @PerApp OkHttpClient provideOkHttpClient(Context context) {
    HttpLoggingInterceptor.Logger logger = message -> Timber.tag("OkHttp").v(message);
    HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(logger);
    loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);

    File cacheDir = context.getCacheDir();
    Cache cache = new Cache(cacheDir, 1024 * 1024 * 4);

    OkHttpClient client = new OkHttpClient.Builder()
        .addInterceptor(loggingInterceptor)
        .cache(cache)
        .build();

    return client;
  }
}

Use just basic logging for requests

Use just basic logging for requests


/*
 * Copyright (c) 1998-2020 John Caron and University Corporation for Atmospheric Research/Unidata
 *  See LICENSE for license information.
 */
package ucar.nc2.dt.grid;

import org.junit.Test;
import ucar.unidata.util.test.TestDir;

/** Open specific problem dataset with GridDataset.open(). */
public class TestReadProblem {

  @Test
  public void doOne() throws Exception {
    TestReadandCount.doOne(TestDir.cdmUnitTestDir + "formats/grib2/", "eta218.wmo", 57, 16, 20, 11);
  }

}

/*
 * Copyright (c) 1998-2020 John Caron and University Corporation for Atmospheric Research/Unidata
 *  See LICENSE for license information.
 */
package ucar.nc2.dt.grid;

import org.junit.Test;
import org.junit.experimental.categories.Category;
import ucar.unidata.util.test.TestDir;
import ucar.unidata.util.test.category.NeedsCdmUnitTest;

/** Open specific problem dataset with GridDataset.open(). */
public class TestReadProblem {

  @Test
  @Category(NeedsCdmUnitTest.class)
  public void doOne() throws Exception {
    TestReadandCount.doOne(TestDir.cdmUnitTestDir + "formats/grib2/", "eta218.wmo", 57, 16, 20, 11);
  }

}

Add @Category(NeedsCdmUnitTest.class) to new unit test


package com.johnlpage.mongosyphon;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;

import org.bson.Document;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.json.*;

public class JobDescription {
	private Document jobDesc;
	Logger logger;

	JobDescription(String configFile) throws FileNotFoundException {
		logger = LoggerFactory.getLogger(JobDescription.class);
		String config = "";
		try {
			config = new String(Files.readAllBytes(Paths.get(configFile)),
					StandardCharsets.UTF_8);
		} catch (IOException e) {
			logger.error(e.getMessage());

			System.exit(1);
		}
		// Better errors from this parser
		try {
			@SuppressWarnings("unused")
			JSONObject obj = new JSONObject(config);
		} catch (Exception e) {
			logger.error(e.getMessage());
			System.exit(1);
		}
		jobDesc = Document.parse(config);

	}

	public Map<String, Object> getJobDesc() {
		return jobDesc;
	}

	public Document getSection(String heading) {
		if (heading == null) {
			return jobDesc.get("start", Document.class);
		}
		return jobDesc.get(heading, Document.class);
	}

}

package com.johnlpage.mongosyphon;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;

import org.bson.Document;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.json.*;

public class JobDescription {
	private Document jobDesc;
	Logger logger;

	JobDescription(String configFile) throws FileNotFoundException {
		logger = LoggerFactory.getLogger(JobDescription.class);
		String config = "";
		try {
			config = new String(Files.readAllBytes(Paths.get(configFile)),
					StandardCharsets.UTF_8);
		} catch (IOException e) {
			logger.error(e.getMessage());

			System.exit(1);
		}

		// Handle \ followed by newline as line continuation
		config = config.replaceAll("\\\\\n", "");

		// Better errors from this parser
		try {
			@SuppressWarnings("unused")
			JSONObject obj = new JSONObject(config);
		} catch (Exception e) {
			logger.error(e.getMessage());
			System.exit(1);
		}
		jobDesc = Document.parse(config);

	}

	public Map<String, Object> getJobDesc() {
		return jobDesc;
	}

	public Document getSection(String heading) {
		if (heading == null) {
			return jobDesc.get("start", Document.class);
		}
		return jobDesc.get(heading, Document.class);
	}

}

Add support for line continuation (\ at end of line) for long SQL strings


package yokohama.unit.ast_junit;

interface StatementVisitor<T> {
    T visitIsStatement(IsStatement isStatement);
    T visitIsNotStatement(IsNotStatement isNotStatement);
    T visitActionStatement(ActionStatement actionStatement);
    T visitTopBindStatement(TopBindStatement topBindStatement);
    T visitVarDeclStatement(VarDeclStatement varDeclStatement);
    T visitBindThrownStatement(BindThrownStatement bindThrownStatement);
}

package yokohama.unit.ast_junit;

public interface StatementVisitor<T> {
    T visitIsStatement(IsStatement isStatement);
    T visitIsNotStatement(IsNotStatement isNotStatement);
    T visitActionStatement(ActionStatement actionStatement);
    T visitTopBindStatement(TopBindStatement topBindStatement);
    T visitVarDeclStatement(VarDeclStatement varDeclStatement);
    T visitBindThrownStatement(BindThrownStatement bindThrownStatement);
}

Change class visibility to public

Change class visibility to public


package de.dotwee.rgb.canteen.model.helper;

import android.content.Context;
import android.widget.ArrayAdapter;

import java.util.List;

/**
 * Created by lukas on 19.11.2016.
 */
public class SpinnerHelper {
    private static final String TAG = SpinnerHelper.class.getSimpleName();

    public static ArrayAdapter<String> load(List<String> values, Context applicationContext) {
        ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<String>(
                applicationContext.getApplicationContext(), android.R.layout.simple_spinner_item, values
        );

        stringArrayAdapter.setDropDownViewResource(
                android.R.layout.simple_spinner_dropdown_item
        );

        return stringArrayAdapter;
    }
}

package de.dotwee.rgb.canteen.model.helper;

import android.content.Context;
import android.widget.ArrayAdapter;

import java.util.List;

/**
 * Created by lukas on 19.11.2016.
 */
public class SpinnerHelper {
    private static final String TAG = SpinnerHelper.class.getSimpleName();

    public static ArrayAdapter<String> load(List<String> values, Context applicationContext) {
        ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<>(
                applicationContext.getApplicationContext(), android.R.layout.simple_spinner_item, values
        );

        stringArrayAdapter.setDropDownViewResource(
                android.R.layout.simple_spinner_dropdown_item
        );

        return stringArrayAdapter;
    }
}

Remove explicit type argument since java defines declares it itself


package x2x.translator.xcodeml.xelement;

import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
 * The XbaseElement represents an element in XcodeML intermediate
 * representation.
 */

public class XbaseElement {
  protected Element baseElement = null;

  public XbaseElement(Element element){
    baseElement = element;
  }

  public Element getBaseElement(){
    return baseElement;
  }

  public Node clone(){
    if(baseElement != null){
      return baseElement.cloneNode(true);
    }
    return null;
  }

  public String getData(){
    return baseElement.getTextContent();
  }

  public void delete(){
    XelementHelper.delete(baseElement);
  }
}

package x2x.translator.xcodeml.xelement;

import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
 * The XbaseElement represents an element in XcodeML intermediate
 * representation.
 */

public class XbaseElement {
  protected Element baseElement = null;

  public XbaseElement(Element element){
    baseElement = element;
  }

  public Element getBaseElement(){
    return baseElement;
  }

  public Node clone(){
    if(baseElement != null){
      return baseElement.cloneNode(true);
    }
    return null;
  }

  public String getData(){
    return baseElement.getTextContent();
  }

  public void delete(){
    XelementHelper.delete(baseElement);
    baseElement = null;
  }
}

Set the base element to null after deletion


package org.ligoj.app.resource.message;

import org.ligoj.app.api.NodeVo;
import org.ligoj.app.api.SimpleUser;
import org.ligoj.app.model.Message;
import org.ligoj.app.plugin.id.resource.ContainerWithTypeVo;
import org.ligoj.app.resource.project.ProjectLightVo;

import lombok.Getter;
import lombok.Setter;

/**
 * A message to target audience and with detailed information from the source.
 */
@Getter
@Setter
public class MessageVo extends Message {

	/**
	 * SID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Optional project targeted by this message.
	 */
	private ProjectLightVo project;

	/**
	 * Optional user details source of this message.
	 */
	private SimpleUser from;

	/**
	 * Optional user targeted by this message.
	 */
	private SimpleUser user;

	/**
	 * Optional node details targeted by this message.
	 */
	private NodeVo node;

	/**
	 * Optional group details targeted by this message.
	 */
	private ContainerWithTypeVo group;

	/**
	 * Optional company details targeted by this message.
	 */
	private ContainerWithTypeVo company;

	/**
	 * Message state. When true this message is new for a specific message.
	 */
	private boolean unread;

}

package org.ligoj.app.resource.message;

import org.ligoj.app.api.NodeVo;
import org.ligoj.app.api.SimpleUser;
import org.ligoj.app.model.Message;
import org.ligoj.app.plugin.id.resource.ContainerWithScopeVo;
import org.ligoj.app.resource.project.ProjectLightVo;

import lombok.Getter;
import lombok.Setter;

/**
 * A message to target audience and with detailed information from the source.
 */
@Getter
@Setter
public class MessageVo extends Message {

	/**
	 * SID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Optional project targeted by this message.
	 */
	private ProjectLightVo project;

	/**
	 * Optional user details source of this message.
	 */
	private SimpleUser from;

	/**
	 * Optional user targeted by this message.
	 */
	private SimpleUser user;

	/**
	 * Optional node details targeted by this message.
	 */
	private NodeVo node;

	/**
	 * Optional group details targeted by this message.
	 */
	private ContainerWithScopeVo group;

	/**
	 * Optional company details targeted by this message.
	 */
	private ContainerWithScopeVo company;

	/**
	 * Message state. When true this message is new for a specific message.
	 */
	private boolean unread;

}

Move User/Group/Company management to plugin-id


package edu.pdx.cs399J.xml;

import java.io.*;
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;

/**
 * This program parses and XML file and validates it for correctness
 * against its DTD.
 */
public class ValidateXml extends DefaultHandler {

  private static PrintStream err = System.err;

  public void error(SAXParseException ex) {
    err.println("ERROR: " + ex);
  }

  public void fatalError(SAXParseException ex) {
    err.println("FATAL: " + ex);
  }

  public void warning(SAXParseException ex) {
    err.println("WARNING: " + ex);
  }

  public static void main(String[] args) {
    try {
      SAXParserFactory factory = SAXParserFactory.newInstance();
      factory.setValidating(true);

      SAXParser parser = factory.newSAXParser();
      parser.parse(new File(args[0]), new ValidateXml());

    } catch (ParserConfigurationException ex) {
      ex.printStackTrace(System.err);

    } catch (SAXException ex) {
      err.println("Parsing exception: " + ex);

    } catch (IOException ex) {
      err.println("IOException: " + ex);
    }
  }
}

package edu.pdx.cs399J.xml;

import java.io.*;
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;

/**
 * This program parses and XML file and validates it for correctness
 * against its DTD.
 */
public class ValidateXml extends DefaultHandler {

  private static PrintStream err = System.err;

  public void error(SAXParseException ex) {
    err.println("ERROR at (" + ex.getLineNumber() + ":" +
                ex.getColumnNumber() + "): " + ex.getMessage());
  }

  public void fatalError(SAXParseException ex) {
    err.println("FATAL at (" + ex.getLineNumber() + ":" +
                ex.getColumnNumber() + "): " + ex.getMessage());
  }

  public void warning(SAXParseException ex) {
    err.println("WARNING at (" + ex.getLineNumber() + ":" +
                ex.getColumnNumber() + "): " + ex.getMessage());
  }

  public static void main(String[] args) {
    try {
      SAXParserFactory factory = SAXParserFactory.newInstance();
      factory.setValidating(true);

      SAXParser parser = factory.newSAXParser();
      parser.parse(new File(args[0]), new ValidateXml());

    } catch (ParserConfigurationException ex) {
      ex.printStackTrace(System.err);

    } catch (SAXException ex) {
      err.println("Parsing exception: " + ex);

    } catch (IOException ex) {
      err.println("IOException: " + ex);
    }
  }
}

Print line and column numbers

Print line and column numbers


/*
 * 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.wicket.examples.library;

import org.apache.wicket.examples.WicketExamplePage;
import org.apache.wicket.request.mapper.parameter.PageParameters;

/**
 * Simple logout page.
 *
 * @author Jonathan Locke
 */
public class SignOut extends WicketExamplePage
{
	/**
	 * Constructor
	 *
	 * @param parameters
	 *            Page parameters (ignored since this is the home page)
	 */
	public SignOut(final PageParameters parameters)
	{
		getSession().invalidate();
	}
}

/*
 * 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.wicket.examples.library;

import org.apache.wicket.examples.WicketExamplePage;
import org.apache.wicket.request.mapper.parameter.PageParameters;

/**
 * Simple logout page.
 *
 * @author Jonathan Locke
 */
public class SignOut extends WicketExamplePage
{
	/**
	 * Constructor
	 *
	 * @param parameters
	 *            Page parameters (ignored since this is the home page)
	 */
	public SignOut(final PageParameters parameters)
	{
		getSession().invalidate();
	}

	/**
	 * @see org.apache.wicket.Page#onBeforeRender()
	 */
	@Override
	protected void onBeforeRender()
	{
		super.onBeforeRender();

		getApplication().getSecuritySettings().getAuthenticationStrategy().remove();
	}
}

Clear the cookie after logout

Clear the cookie after logout

git-svn-id: 5a74b5304d8e7e474561603514f78b697e5d94c4@981321 13f79535-47bb-0310-9956-ffa450edef68


package ml.shifu.shifu.core;

import org.testng.Assert;
import org.testng.annotations.Test;

public class ConvergeJudgerTest {

    @Test
    public void testJudge() {
        ConvergeJudger judger = new ConvergeJudger();

        Assert.assertTrue(judger.judge(1.0, 2.0));
        Assert.assertTrue(judger.judge(1.0, 1.0));
        Assert.assertFalse(judger.judge(1.0, 0.1));
    }

}

package ml.shifu.shifu.core;

import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class ConvergeJudgerTest {

    private ConvergeJudger judger;

    @BeforeClass
    public void setUp() {
        this.judger = new ConvergeJudger();
    }

    @Test
    public void testJudge() {
        Assert.assertTrue(judger.judge(1.0, 2.0));
        Assert.assertTrue(judger.judge(1.0, 1.0));
        Assert.assertFalse(judger.judge(1.0, 0.1));
    }

}

Use setup to initialize judger instance.


// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.xwalk.runtime.client.embedded.test;

import android.test.suitebuilder.annotation.SmallTest;

import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.xwalk.test.util.RuntimeClientApiTestBase;

/**
 * Test suite for Presentation API.
 */
public class PresentationTest extends XWalkRuntimeClientTestBase {

    // @SmallTest
    // @Feature({"PresentationTest"})
    // TODO: Since the embedded extension issue, disable this temporarily.
    @DisabledTest
    public void testPresentationDisplayAvailable() throws Throwable {
        RuntimeClientApiTestBase<XWalkRuntimeClientTestRunnerActivity> helper =
                new RuntimeClientApiTestBase<XWalkRuntimeClientTestRunnerActivity>(
                        getTestUtil(), this);
        helper.testPresentationDisplayAvailable();
    }
}

// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.xwalk.runtime.client.embedded.test;

import android.test.suitebuilder.annotation.SmallTest;

import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.xwalk.test.util.RuntimeClientApiTestBase;

/**
 * Test suite for Presentation API.
 */
public class PresentationTest extends XWalkRuntimeClientTestBase {

    @SmallTest
    @Feature({"PresentationTest"})
    public void testPresentationDisplayAvailable() throws Throwable {
        RuntimeClientApiTestBase<XWalkRuntimeClientTestRunnerActivity> helper =
                new RuntimeClientApiTestBase<XWalkRuntimeClientTestRunnerActivity>(
                        getTestUtil(), this);
        helper.testPresentationDisplayAvailable();
    }
}

[Android] Enable test case for presentation API in embedded mode
Extension in embedded mode is now avaialble, reopen the test case for
presentation API


package edu.teco.dnd.module;

public class UserSuppliedCodeException extends Exception {

	private static final long serialVersionUID = -851321417787303985L;

	public UserSuppliedCodeException() {
			super();
			}

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

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

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

	public UserSuppliedCodeException(String message, Throwable cause, boolean enableSuppression,
			boolean writableStackTrace) {
		super(message, cause, enableSuppression, writableStackTrace);
	}

}

package edu.teco.dnd.module;

public class UserSuppliedCodeException extends Exception {

	private static final long serialVersionUID = -851321417787303985L;

	public UserSuppliedCodeException() {
			super();
			}

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

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

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

Remove constructor not available in Java 6


package io.rado.backgroundcolor;

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

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

public class BackgroundColorPackage implements ReactPackage {

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

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }

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

        modules.add(new BackgroundColorModule(reactContext));

        return modules;
    }
}

package io.rado.backgroundcolor;

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

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

public class BackgroundColorPackage implements ReactPackage {

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

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }

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

        modules.add(new BackgroundColorModule(reactContext));

        return modules;
    }
}

Remove depreciated createJSModules @overide marker


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.anarres.jdiagnostics;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;

/**
 *
 * @author shevek
 */
public class DefaultQueryTest {

    private static final Log LOG = LogFactory.getLog(DefaultQueryTest.class);

    @Test
    public void testQuery() {
        DefaultQuery query = new DefaultQuery();
        query.add(new ThrowableQuery(new Exception()));
        LOG.info(query.call());
    }

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.anarres.jdiagnostics;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author shevek
 */
public class DefaultQueryTest {

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

    @Test
    public void testQuery() {
        DefaultQuery query = new DefaultQuery();
        query.add(new ThrowableQuery(new Exception()));
        LOG.info(String.valueOf(query.call()));
    }

}

Fix tests to work with slf4j.

Fix tests to work with slf4j.


package org.wikipedia.settings;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.preference.Preference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import org.wikipedia.R;

public class PreferenceMultiLine extends Preference {

    public PreferenceMultiLine(Context ctx, AttributeSet attrs, int defStyle) {
        super(ctx, attrs, defStyle);
    }

    public PreferenceMultiLine(Context ctx, AttributeSet attrs) {
        super(ctx, attrs);
    }

    public PreferenceMultiLine(Context ctx) {
        super(ctx);
    }

    @Override
    protected void onBindView(View view) {
        super.onBindView(view);
        TextView textView = (TextView) view.findViewById(android.R.id.title);
        if (textView != null) {
            textView.setSingleLine(false);
        }
        // Intercept the click listener for this preference, and if the preference has an intent,
        // launch the intent ourselves, so that we can catch the exception if the intent fails.
        this.setOnPreferenceClickListener(new OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                if (preference.getIntent() != null) {
                    try {
                        getContext().startActivity(preference.getIntent());
                    } catch (ActivityNotFoundException e) {
                        Toast.makeText(getContext(), getContext().getString(R.string.error_browser_not_found), Toast.LENGTH_LONG).show();
                    }
                    return true;
                }
                return false;
            }
        });
    }
}

package org.wikipedia.settings;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.preference.Preference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import org.wikipedia.R;

public class PreferenceMultiLine extends Preference {

    public PreferenceMultiLine(Context ctx, AttributeSet attrs, int defStyle) {
        super(ctx, attrs, defStyle);
    }

    public PreferenceMultiLine(Context ctx, AttributeSet attrs) {
        super(ctx, attrs);
    }

    public PreferenceMultiLine(Context ctx) {
        super(ctx);
    }

    @Override
    protected void onBindView(View view) {
        super.onBindView(view);
        TextView textView = (TextView) view.findViewById(android.R.id.title);
        if (textView != null) {
            textView.setSingleLine(false);
        }
        // Intercept the click listener for this preference, and if the preference has an intent,
        // launch the intent ourselves, so that we can catch the exception if the intent fails.
        // (but only do this if the preference doesn't already have a click listener)
        if (this.getOnPreferenceClickListener() == null) {
            this.setOnPreferenceClickListener(new OnPreferenceClickListener() {
                @Override
                public boolean onPreferenceClick(Preference preference) {
                    if (preference.getIntent() != null) {
                        try {
                            getContext().startActivity(preference.getIntent());
                        } catch (ActivityNotFoundException e) {
                            Toast.makeText(getContext(), getContext().getString(R.string.error_browser_not_found), Toast.LENGTH_LONG).show();
                        }
                        return true;
                    }
                    return false;
                }
            });
        }
    }
}

Fix "logout" preference after crash fix.

(became no longer clickable)
Now giving an onClickListener to a preference only if it doesn't already
have a listener.

Change-Id: I93b25da9485477737f877abae34188d0243bebd4


/*
 * Copyright (c) 2008-2017, Hazelcast, 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.hazelcast.client.quorum;

import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.nio.Address;

import static com.hazelcast.test.HazelcastTestSupport.getNode;

public class QuorumTestUtil {

    private QuorumTestUtil() {
    }

    public static ClientConfig getClientConfig(HazelcastInstance instance) {
        ClientConfig clientConfig = new ClientConfig();
        Address address = getNode(instance).address;
        clientConfig.getNetworkConfig().addAddress(address.getHost() + ":" + address.getPort());
        clientConfig.getGroupConfig().setName(instance.getConfig().getGroupConfig().getName());
        return clientConfig;
    }
}

/*
 * Copyright (c) 2008-2017, Hazelcast, 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.hazelcast.client.quorum;

import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.nio.Address;

import static com.hazelcast.test.HazelcastTestSupport.getNode;

public class QuorumTestUtil {

    private QuorumTestUtil() {
    }

    public static ClientConfig getClientConfig(HazelcastInstance instance) {
        ClientConfig clientConfig = new ClientConfig();
        Address address = getNode(instance).address;
        clientConfig.getNetworkConfig().addAddress(address.getHost() + ":" + address.getPort());
        clientConfig.getNetworkConfig().setSmartRouting(false);
        clientConfig.getGroupConfig().setName(instance.getConfig().getGroupConfig().getName());
        return clientConfig;
    }
}

Fix attempt QuorumTest for clients

Fix attempt QuorumTest for clients

Make sure a client uses a single connection to the cluster. So it is aligned
with blocked connections.