package woko.actions;

import java.util.Enumeration;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class WokoResourceBundle extends ResourceBundle {

  private Locale locale;

  public WokoResourceBundle(Locale locale) {
    this.locale = locale;
  }

  @Override
  public Enumeration<String> getKeys() {
    return null;
  }

  @Override
  protected Object handleGetObject(String fullKey) {
      return getResult(locale, "WokoResources", fullKey);
  }

  // Just returns null if the bundle or the key is not found,
  // instead of throwing an exception.
  private String getResult(Locale loc, String name, String key) {
    String result = null;
    ResourceBundle bundle = ResourceBundle.getBundle(name, loc);
    if (bundle != null) {
      try { result = bundle.getString(key); }
      catch (MissingResourceException exc) { }
    }
    return result;
  }
}

package woko.actions;

import java.util.Enumeration;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class WokoResourceBundle extends ResourceBundle {

    private static final String WOKO_RESOURCES_BUNDLE = "WokoResources";
    private static final String APP_RESOURCES_BUNDLE = "ApplicationResources";

    private Locale locale;

    public WokoResourceBundle(Locale locale) {
        this.locale = locale;
    }

    @Override
    public Enumeration<String> getKeys() {
        return null;
    }

    @Override
    protected Object handleGetObject(String fullKey) {
        // First, try to get resources from app specific bundle
        String result = getResult(locale, APP_RESOURCES_BUNDLE, fullKey);
        if (result == null)
            result = getResult(locale, WOKO_RESOURCES_BUNDLE, fullKey);

        return result;

    }

    // Just returns null if the bundle or the key is not found,
    // instead of throwing an exception.
    private String getResult(Locale loc, String name, String key) {
        String result = null;
        ResourceBundle bundle = ResourceBundle.getBundle(name, loc);
        if (bundle != null) {
            try { result = bundle.getString(key); }
            catch (MissingResourceException exc) { }
        }
        return result;
    }
}

Add specific Resource bundle management


package com.kickstarter.services.gcm;

import android.app.IntentService;
import android.content.Intent;
import android.support.annotation.NonNull;

import com.google.android.gms.gcm.GoogleCloudMessaging;
import com.google.android.gms.iid.InstanceID;
import com.kickstarter.R;

import timber.log.Timber;

public class UnregisterService extends IntentService {
  private static final String WORKER_THREAD_NAME = "UnregisterService";

  public UnregisterService() {
    super(WORKER_THREAD_NAME);
  }

  @Override
  protected void onHandleIntent(@NonNull final Intent intent) {
    Timber.d("onHandleIntent");

    try {
      final InstanceID instanceID = InstanceID.getInstance(this);
      instanceID.deleteToken(getString(R.string.gcm_defaultSenderId), GoogleCloudMessaging.INSTANCE_ID_SCOPE);
      Timber.d("Deleted token");
    } catch (final Exception e) {
      Timber.e("Failed to delete token: " + e.toString());
    }
  }
}

package com.kickstarter.services.gcm;

import android.app.IntentService;
import android.content.Intent;
import android.support.annotation.NonNull;

import com.google.android.gms.gcm.GoogleCloudMessaging;
import com.google.android.gms.iid.InstanceID;
import com.kickstarter.R;

import timber.log.Timber;

public class UnregisterService extends IntentService {
  public UnregisterService() {
    super("UnregisterService");
  }

  @Override
  protected void onHandleIntent(@NonNull final Intent intent) {
    Timber.d("onHandleIntent");

    try {
      final InstanceID instanceID = InstanceID.getInstance(this);
      instanceID.deleteToken(getString(R.string.gcm_defaultSenderId), GoogleCloudMessaging.INSTANCE_ID_SCOPE);
      Timber.d("Deleted token");
    } catch (final Exception e) {
      Timber.e("Failed to delete token: " + e.toString());
    }
  }
}

Remove constant only used once


package com.github.mobile.android.repo;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.github.mobile.android.R.id;
import com.github.mobile.android.util.AvatarHelper;
import com.madgag.android.listviews.ViewHolder;

import org.eclipse.egit.github.core.User;

/**
 * View holder to display a user/organization
 */
public class OrgViewHolder implements ViewHolder<User> {

    private final AvatarHelper avatarHelper;

    private final TextView nameText;

    private final ImageView avatarView;

    /**
     * Create org view holder
     *
     * @param view
     * @param avatarHelper
     */
    public OrgViewHolder(final View view, final AvatarHelper avatarHelper) {
        this.avatarHelper = avatarHelper;
        nameText = (TextView) view.findViewById(id.tv_org_name);
        avatarView = (ImageView) view.findViewById(id.iv_gravatar);
    }

    @Override
    public void updateViewFor(User user) {
        nameText.setText(user.getLogin());
        avatarView.setBackgroundDrawable(null);
        avatarHelper.bind(avatarView, user);
    }
}

package com.github.mobile.android.repo;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.github.mobile.android.R.id;
import com.github.mobile.android.util.AvatarHelper;
import com.madgag.android.listviews.ViewHolder;

import org.eclipse.egit.github.core.User;

/**
 * View holder to display a user/organization
 */
public class OrgViewHolder implements ViewHolder<User> {

    private final AvatarHelper avatarHelper;

    private final TextView nameText;

    private final ImageView avatarView;

    /**
     * Create org view holder
     *
     * @param view
     * @param avatarHelper
     */
    public OrgViewHolder(final View view, final AvatarHelper avatarHelper) {
        this.avatarHelper = avatarHelper;
        nameText = (TextView) view.findViewById(id.tv_org_name);
        avatarView = (ImageView) view.findViewById(id.iv_gravatar);
    }

    @Override
    public void updateViewFor(final User user) {
        nameText.setText(user.getLogin());
        avatarView.setBackgroundDrawable(null);
        avatarHelper.bind(avatarView, user);
    }
}

Mark user parameter as final


package org.metaborg.util.arrays;

import java.util.Collection;

public final class Arrays2 {
    public static <T> boolean addAll(Collection<T> addTo, T[] elementsToAdd) {
        boolean modified = false;
        for(T e : elementsToAdd) {
            modified = modified || addTo.add(e);
        }
        return modified;
    }
}

package org.metaborg.util.arrays;

import java.util.Collection;

public final class Arrays2 {
    public static <T> boolean addAll(Collection<T> addTo, T[] elementsToAdd) {
        boolean modified = false;
        for(T e : elementsToAdd) {
            modified = addTo.add(e) || modified;
        }
        return modified;
    }
}

Fix only one element being added.


/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * 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 android.arch.lifecycle;

import android.media.PlaybackParams;
import android.os.Build;
import android.support.test.filters.SdkSuppress;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
@SdkSuppress(maxSdkVersion = Build.VERSION_CODES.N_MR1)
@SmallTest
public class MissingClassTest {
    public static class ObserverWithMissingClasses {
        @SuppressWarnings("unused")
        public void newApiMethod(PlaybackParams params) {}

        @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
        public void onResume() {}
    }

    @Test(expected = IllegalArgumentException.class)
    public void testMissingApi() {
        new ReflectiveGenericLifecycleObserver(new ObserverWithMissingClasses());
    }
}

/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * 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 android.arch.lifecycle;

import android.app.PictureInPictureParams;
import android.os.Build;
import android.support.test.filters.SdkSuppress;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
@SdkSuppress(maxSdkVersion = Build.VERSION_CODES.N_MR1)
@SmallTest
public class MissingClassTest {
    public static class ObserverWithMissingClasses {
        @SuppressWarnings("unused")
        public void newApiMethod(PictureInPictureParams params) {}

        @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
        public void onResume() {}
    }

    @Test(expected = IllegalArgumentException.class)
    public void testMissingApi() {
        new ReflectiveGenericLifecycleObserver(new ObserverWithMissingClasses());
    }
}

Merge "Use api from 26" into oc-mr1-support-27.0-dev am: f5c970b5df am: 0e91a7eccb


package com.github.ferstl.jarscan;

import org.adoptopenjdk.jitwatch.jarscan.IJarScanOperation;
import org.adoptopenjdk.jitwatch.jarscan.freqinlinesize.FreqInlineSizeOperation;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;

/**
 * List every method with bytecode larger than specified limit.
 */
@Mojo(
    name = "maxMethodSize",
    aggregator = false,
    defaultPhase = LifecyclePhase.VERIFY,
    requiresDependencyCollection = ResolutionScope.TEST,
    requiresDependencyResolution = ResolutionScope.TEST,
    requiresDirectInvocation = false,
    threadSafe = true)
public class MaxMethodSizeMojo extends AbstractJarScanMojo {

  /**
   * Report methods larger than the specified bytes. The default for {@code -XX:MaxInlineSize} is 35. The default for
   * {@code -XX:FreqInlineSize} is 325.
   *
   * @since 1.1.0
   */
  @Parameter(property = "limit", defaultValue = "0")
  private int limit;

  @Override
  protected IJarScanOperation createOperation() {
    return new FreqInlineSizeOperation(this.limit);
  }

}

package com.github.ferstl.jarscan;

import org.adoptopenjdk.jitwatch.jarscan.IJarScanOperation;
import org.adoptopenjdk.jitwatch.jarscan.freqinlinesize.FreqInlineSizeOperation;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;

/**
 * List every method with bytecode larger than specified limit.
 *
 * @since 1.1
 */
@Mojo(
    name = "maxMethodSize",
    aggregator = false,
    defaultPhase = LifecyclePhase.VERIFY,
    requiresDependencyCollection = ResolutionScope.TEST,
    requiresDependencyResolution = ResolutionScope.TEST,
    requiresDirectInvocation = false,
    threadSafe = true)
public class MaxMethodSizeMojo extends AbstractJarScanMojo {

  /**
   * Report methods larger than the specified bytes. The default for {@code -XX:MaxInlineSize} is 35. The default for
   * {@code -XX:FreqInlineSize} is 325.
   *
   * @since 1.1
   */
  @Parameter(property = "limit", defaultValue = "0")
  private int limit;

  @Override
  protected IJarScanOperation createOperation() {
    return new FreqInlineSizeOperation(this.limit);
  }

}

Add @since to class Javadoc


package com.quizdeck.model.inputs;

import com.quizdeck.model.database.Quiz;
import com.quizdeck.model.database.submission;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * Created by Cade on 2/17/2016.
 */
@Getter
@Setter
public class CompleteQuizInput {

    @NotNull
    private Quiz quiz;

    @NotNull
    private String quizId;

    @NotNull
    private List<submission> submissions;

    public CompleteQuizInput(String quizId, Quiz quiz, List<submission> submissions) {
        this.quizId = quizId;
        this.quiz = quiz;
        this.submissions = submissions;
    }

}

package com.quizdeck.model.inputs;

import com.quizdeck.model.database.Quiz;
import com.quizdeck.model.database.submission;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * Created by Cade on 2/17/2016.
 */
@Getter
@Setter
public class CompleteQuizInput {

    @NotNull
    private Quiz quiz;

    @NotNull
    private String quizId;

    @NotNull
    private List<submission> submissions;

    public CompleteQuizInput() {}

    public CompleteQuizInput(String quizId, Quiz quiz, List<submission> submissions) {
        this.quizId = quizId;
        this.quiz = quiz;
        this.submissions = submissions;
    }

}

Add default constructor for Jackson


package org.helioviewer.jhv.timelines.data;

import java.util.HashMap;

public class BandType {

    private String baseURL;
    private String label;
    private String name;
    private String unitLabel;
    private final HashMap<String, Double> warnLevels = new HashMap<>();
    private double min;
    private double max;
    private boolean isLog = false;

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

    public String getBaseURL() {
        return baseURL;
    }

    public void setBaseURL(String _baseURL) {
        baseURL = _baseURL;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String _label) {
        label = _label;
    }

    public String getUnitLabel() {
        return unitLabel;
    }

    public void setUnitLabel(String _unitLabel) {
        unitLabel = _unitLabel;
    }

    public HashMap<String, Double> getWarnLevels() {
        return warnLevels;
    }

    public double getMin() {
        return min;
    }

    public void setMin(double _min) {
        min = _min;
    }

    public double getMax() {
        return max;
    }

    public void setMax(double _max) {
        max = _max;
    }

    public void setName(String _name) {
        name = _name;
    }

    public String getName() {
        return name;
    }

    public void setScale(String scale) {
        isLog = scale.equals("logarithmic");
    }

    public boolean isLogScale() {
        return isLog;
    }

}

package org.helioviewer.jhv.timelines.data;

import java.util.HashMap;

public class BandType {

    private String label;
    private String name;
    private String unitLabel;
    private final HashMap<String, Double> warnLevels = new HashMap<>();
    private double min;
    private double max;
    private boolean isLog = false;
    private DataProvider dataprovider;

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

    public String getLabel() {
        return label;
    }

    public void setLabel(String _label) {
        label = _label;
    }

    public String getUnitLabel() {
        return unitLabel;
    }

    public void setUnitLabel(String _unitLabel) {
        unitLabel = _unitLabel;
    }

    public HashMap<String, Double> getWarnLevels() {
        return warnLevels;
    }

    public double getMin() {
        return min;
    }

    public void setMin(double _min) {
        min = _min;
    }

    public double getMax() {
        return max;
    }

    public void setMax(double _max) {
        max = _max;
    }

    public void setName(String _name) {
        name = _name;
    }

    public String getName() {
        return name;
    }

    public void setScale(String scale) {
        isLog = scale.equals("logarithmic");
    }

    public boolean isLogScale() {
        return isLog;
    }

    public DataProvider getDataprovider() {
        return dataprovider;
    }

    public void setDataprovider(DataProvider dataprovider) {
        this.dataprovider = dataprovider;
    }

}

Replace baseURL with data provider.


/*
 * Copyright 2015 Timothy Brooks
 *
 * 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 net.uncontended.precipice.timeout;

import java.util.concurrent.TimeUnit;

public class NewTimerService {

    private final long resolution;
    private final long startTime;

    public NewTimerService(long resolution, TimeUnit unit) {
        this.resolution = unit.toMillis(resolution);
        startTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
    }

    public void schedule(Object task, long delay, TimeUnit unit) {

    }
}

/*
 * Copyright 2015 Timothy Brooks
 *
 * 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 net.uncontended.precipice.timeout;

import java.util.concurrent.TimeUnit;

/**
 * Unstable and still in development. At this time, {@link TimeoutService} should be used.
 */
public class NewTimerService {

    private final long resolution;
    private final long startTime;

    public NewTimerService(long resolution, TimeUnit unit) {
        this.resolution = unit.toMillis(resolution);
        startTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
    }

    public void schedule(Object task, long delay, TimeUnit unit) {

    }
}

Add comment about timeout service stability


/* IBM_PROLOG_BEGIN_TAG
 * This is an automatically generated prolog.
 *
 * $Source: src/java/test/blockmap/com/ibm/research/blockmap/CapiTestSupport.java $
 *
 * IBM Data Engine for NoSQL - Power Systems Edition User Library Project
 *
 * Contributors Listed Below - COPYRIGHT 2015,2016,2017
 * [+] International Business Machines Corp.
 *
 *
 * 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.
 *
 * IBM_PROLOG_END_TAG
 */
package com.ibm.research.blockmap;

import org.junit.Ignore;

@Ignore
class CapiTestSupport {

	static final String DEVICE_PATH = "amd64".equals(System.getProperty("os.arch")) ? null : "/dev/sdf"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    //static final String DEVICE_PATH="/dev/hdisk0";

}

/* IBM_PROLOG_BEGIN_TAG
 * This is an automatically generated prolog.
 *
 * $Source: src/java/test/blockmap/com/ibm/research/blockmap/CapiTestSupport.java $
 *
 * IBM Data Engine for NoSQL - Power Systems Edition User Library Project
 *
 * Contributors Listed Below - COPYRIGHT 2015,2016,2017
 * [+] International Business Machines Corp.
 *
 *
 * 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.
 *
 * IBM_PROLOG_END_TAG
 */
package com.ibm.research.blockmap;

import org.junit.Ignore;

@Ignore
class CapiTestSupport {

	static final String DEVICE_PATH = "amd64".equals(System.getProperty("os.arch")) ? null : System.getProperty("CAPI_DEVICE_PATH", "/dev/sdf"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    //static final String DEVICE_PATH="/dev/hdisk0";

}

Use the CAPI_DEVICE_PATH property in blockmap tests


package org.jeecqrs.common.event.sourcing;

/**
 *
 * @param <E>  the base event type
 */
public interface EventSourcingBus<E> {

    void persist(E event);

}

/*
 * Copyright (c) 2013 Red Rainbow IT Solutions GmbH, Germany
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package org.jeecqrs.common.event.sourcing;

import java.util.List;
import org.jeecqrs.common.event.Event;

/**
 * Provides the ability to store a changes made during event sourcing.
 *
 * @param <E>  the base event type
 */
public interface EventSourcingBus<E extends Event> {

    void store(long originalVersion, List<E> changes);

}

Change signature of store method


package org.reldb.dbrowser.ui.content.recent;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormAttachment;
import org.reldb.dbrowser.ui.DbTab;

public class RecentPanel extends Composite {

	private Label lblConvert;

	/**
	 * Create the composite.
	 *
	 * @param parent
	 * @param style
	 */
	public RecentPanel(Composite parent, DbTab dbTab, int style) {
		super(parent, style);
		FormLayout formLayout = new FormLayout();
		formLayout.marginWidth = 5;
		formLayout.marginHeight = 5;
		setLayout(formLayout);

		lblConvert = new Label(this, SWT.NONE);
		FormData fd_lblConvert = new FormData();
		fd_lblConvert.top = new FormAttachment(0);
		fd_lblConvert.left = new FormAttachment(0);
		fd_lblConvert.right = new FormAttachment(100);
		lblConvert.setLayoutData(fd_lblConvert);
		lblConvert.setText("Recently-used database options go here.");
	}
}

package org.reldb.dbrowser.ui.content.recent;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormAttachment;
import org.reldb.dbrowser.ui.DbTab;

public class RecentPanel extends Composite {

	/**
	 * Create the composite.
	 *
	 * @param parent
	 * @param style
	 */
	public RecentPanel(Composite parent, DbTab dbTab, int style) {
		super(parent, style);
		FormLayout formLayout = new FormLayout();
		formLayout.marginWidth = 5;
		formLayout.marginHeight = 5;
		setLayout(formLayout);

		Label lblConvert = new Label(this, SWT.NONE);
		FormData fd_lblConvert = new FormData();
		fd_lblConvert.top = new FormAttachment(0);
		fd_lblConvert.left = new FormAttachment(0);
		fd_lblConvert.right = new FormAttachment(100);
		lblConvert.setLayoutData(fd_lblConvert);
		lblConvert.setText("Recently-used database options go here.");
	}
}

Work on Recently-Used Database tab.


package com.atsebak.raspberrypi.protocol.ssh;

import lombok.Builder;
import net.schmizz.sshj.SSHClient;
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;

import java.io.IOException;

@Builder
public class SSH {
    private int timeout;
    private int connectionTimeout;

    /**
     * Build an SSHJ SSH Client
     *
     * @return
     */
    public SSHClient toClient() {
        SSHClient sshClient = new SSHClient();
        try {
            sshClient.addHostKeyVerifier(new PromiscuousVerifier());
            sshClient.loadKnownHosts();
            sshClient.setConnectTimeout(connectionTimeout);
            sshClient.setTimeout(timeout);
        } catch (IOException e) {

        }
        return sshClient;
    }
}

package com.atsebak.raspberrypi.protocol.ssh;

import lombok.Builder;
import net.schmizz.sshj.SSHClient;
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;

import java.io.IOException;

@Builder
public class SSH {
    private int timeout;
    private int connectionTimeout;

    /**
     * Build an SSHJ SSH Client
     *
     * @return
     */
    public SSHClient toClient() {
        SSHClient sshClient = new SSHClient();
        try {
            sshClient.addHostKeyVerifier(new PromiscuousVerifier());
            sshClient.setConnectTimeout(connectionTimeout);
            sshClient.setTimeout(timeout);
            sshClient.loadKnownHosts();
        } catch (IOException e) {

        }
        return sshClient;
    }
}

Fix issue with test breaking when loading known hosts


package org.javarosa.xpath.expr;

import org.javarosa.core.model.condition.EvaluationContext;
import org.javarosa.core.model.instance.DataInstance;
import org.javarosa.core.util.externalizable.DeserializationException;
import org.javarosa.core.util.externalizable.PrototypeFactory;
import org.javarosa.xpath.XPathUnsupportedException;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

public class XPathUnionExpr extends XPathBinaryOpExpr {
    public XPathUnionExpr() {
    } //for deserialization

    public XPathUnionExpr(XPathExpression a, XPathExpression b) {
        super(-1, a, b);
    }

    @Override
    public Object evalRaw(DataInstance model, EvaluationContext evalContext) {
        throw new XPathUnsupportedException("nodeset union operation");
    }

    @Override
    public String toString() {
        return super.toString("union");
    }

    @Override
    public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
        super.readExternal(in, pf);
    }

    @Override
    public void writeExternal(DataOutputStream out) throws IOException {
        super.writeExternal(out);
    }

    @Override
    public String toPrettyString() {
        return "unsupported union operation";
    }
}

package org.javarosa.xpath.expr;

import org.javarosa.core.model.condition.EvaluationContext;
import org.javarosa.core.model.instance.DataInstance;
import org.javarosa.core.util.externalizable.DeserializationException;
import org.javarosa.core.util.externalizable.PrototypeFactory;
import org.javarosa.xpath.XPathUnsupportedException;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

public class XPathUnionExpr extends XPathBinaryOpExpr {
    public XPathUnionExpr() {
    } //for deserialization

    public XPathUnionExpr(XPathExpression a, XPathExpression b) {
        super(-1, a, b);
    }

    @Override
    public Object evalRaw(DataInstance model, EvaluationContext evalContext) {
        throw new XPathUnsupportedException("nodeset union operation");
    }

    @Override
    public String toString() {
        return super.toString("union");
    }

    @Override
    public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
        readExpressions(in, pf);
        op = -1;
    }

    @Override
    public void writeExternal(DataOutputStream out) throws IOException {
        writeExpressions(out);
    }

    @Override
    public String toPrettyString() {
        return "unsupported union operation";
    }
}

Fix externalization oversite that would have required a migration


package com.rarchives.ripme.tst.ripper.rippers;

import com.rarchives.ripme.ripper.rippers.GfycatRipper;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.net.URL;

public class GfycatRipperTest extends RippersTest {

    /**
     * Rips correctly formatted URL directly from Gfycat
     * @throws IOException
     */
    @Test
    public void testGfycatGoodURL() throws IOException{
        GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/TemptingExcellentIchthyosaurs"));
        testRipper(ripper);
    }
    /**
     * Rips badly formatted URL directly from Gfycat
     * @throws IOException
     */
    public void testGfycatBadURL() throws IOException {
        GfycatRipper ripper  = new GfycatRipper(new URL("https://gfycat.com/gifs/detail/limitedtestyamericancrow"));
        testRipper(ripper);
    }

    public void testGfycatProfile() throws IOException {
        GfycatRipper ripper  = new GfycatRipper(new URL("https://gfycat.com/@golbanstorage"));
        testRipper(ripper);
    }
}

package com.rarchives.ripme.tst.ripper.rippers;

import com.rarchives.ripme.ripper.rippers.GfycatRipper;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.net.URL;

public class GfycatRipperTest extends RippersTest {

    /**
     * Rips correctly formatted URL directly from Gfycat
     * @throws IOException
     */
    @Test
    public void testGfycatGoodURL() throws IOException{
        GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/TemptingExcellentIchthyosaurs"));
        testRipper(ripper);
    }
    /**
     * Rips badly formatted URL directly from Gfycat
     * @throws IOException
     */
    public void testGfycatBadURL() throws IOException {
        GfycatRipper ripper  = new GfycatRipper(new URL("https://gfycat.com/gifs/detail/limitedtestyamericancrow"));
        testRipper(ripper);
    }

    /**
     * Rips a Gfycat profile
     * @throws IOException
     */
    public void testGfycatProfile() throws IOException {
        GfycatRipper ripper  = new GfycatRipper(new URL("https://gfycat.com/@golbanstorage"));
        testRipper(ripper);
    }

    /**
     * Rips a Gfycat amp link
     * @throws IOException
     */
    public void testGfycatAmp() throws IOException {
        GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/amp/TemptingExcellentIchthyosaurs"));
        testRipper(ripper);
    }
}

Add unit test for Gfycat Amp links


package jp.toastkid.article.search;

import static org.junit.Assert.assertNotNull;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

import org.junit.Test;

/**
 * Test of {@link SearchResult}.
 * @author Toast kid
 *
 */
public class SearchResultTest {

    /**
     * Test of {@link SearchResult} constructor.
     * @throws IOException
     */
    @Test
    public void testSearchResult() throws IOException {
        final Path path = Files.createTempFile("temp", ".txt");
        final SearchResult searchResult = new SearchResult(path.toString());
        assertNotNull(searchResult.toString());
    }

    /**
     * Test of {@link SearchResult#makeSimple(String)}.
     *
     * @throws IOException
     */
    @Test
    public void testMakeSimple() throws IOException {
        final Path path = Files.createTempFile("temp", ".txt");
        final SearchResult simple = SearchResult.makeSimple(path.toString());
        assertNotNull(simple);
    }

}

package jp.toastkid.article.search;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Test of {@link SearchResult}.
 * @author Toast kid
 *
 */
public class SearchResultTest {

    /**
     * Test of {@link SearchResult} constructor.
     * @throws IOException
     */
    @Test
    public void testSearchResult() throws IOException {
        final Path path = Files.createTempFile("temp", ".txt");
        final SearchResult searchResult = new SearchResult(path.toString());
        assertNotNull(searchResult.toString());
        assertNotNull(searchResult.filePath());
        assertTrue(searchResult.getOrEmpty("").isEmpty());
        assertTrue(0 < searchResult.lastModified());
        assertTrue(searchResult.mapIsEmpty());
        assertSame(0, searchResult.size());
        assertNull(searchResult.title());
    }

    /**
     * Test of {@link SearchResult#makeSimple(String)}.
     *
     * @throws IOException
     */
    @Test
    public void testMakeSimple() throws IOException {
        final Path path = Files.createTempFile("temp", ".txt");
        final SearchResult simple = SearchResult.makeSimple(path.toString());
        assertNotNull(simple);
    }

}

Modify unit test of search result.


package uk.ac.cam.cstibhotel.otcanalyser.gui;

import java.awt.BorderLayout;

import javax.swing.JFrame;

import uk.ac.cam.cstibhotel.otcanalyser.communicationlayer.SearchListener;
import uk.ac.cam.cstibhotel.otcanalyser.communicationlayer.SearchResult;

public class GUI extends JFrame implements SearchListener {

	private static final long serialVersionUID = 1L;

	public StatusBar statusBar;

	public static GUI gui;
	static SearchWindow searchWindow;
	DataViewer dataViewer;

	public static GUI getInstance() {
		if (gui==null) {
			gui = new GUI();
		}
		return gui;
	}

	public GUI() {
		setTitle("OTC Analyser");
		setSize(1000,600);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		searchWindow = SearchWindow.getInstance();
		add(searchWindow,BorderLayout.WEST);
		searchWindow.setVisible(true);
		statusBar = StatusBar.getInstance();
		add(statusBar,BorderLayout.SOUTH);
		statusBar.setVisible(true);
		dataViewer = DataViewer.dataViewer;
		this.add(dataViewer);
		dataViewer.setVisible(true);
		this.setVisible(true);
	}

	@Override
	public void getSearchResult(SearchResult s) {
		DataViewer.addTrades(s.getResultData());
	}

}

package uk.ac.cam.cstibhotel.otcanalyser.gui;

import java.awt.BorderLayout;

import javax.swing.JFrame;

import uk.ac.cam.cstibhotel.otcanalyser.communicationlayer.SearchListener;
import uk.ac.cam.cstibhotel.otcanalyser.communicationlayer.SearchResult;

public class GUI extends JFrame implements SearchListener {

	private static final long serialVersionUID = 1L;

	public StatusBar statusBar;

	public static GUI gui;
	static SearchWindow searchWindow;
	DataViewer dataViewer;

	public static GUI getInstance() {
		if (gui==null) {
			gui = new GUI();
		}
		return gui;
	}

	public GUI() {
		setTitle("OTC Analyser");
		setSize(1000,600);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		searchWindow = SearchWindow.getInstance();
		add(searchWindow,BorderLayout.WEST);
		searchWindow.setVisible(true);
		statusBar = StatusBar.getInstance();
		add(statusBar,BorderLayout.SOUTH);
		statusBar.setVisible(true);
		dataViewer = DataViewer.dataViewer;
		this.add(dataViewer);
		dataViewer.setVisible(true);
		this.setVisible(true);
	}

	@Override
	public void getSearchResult(SearchResult s) {
		DataViewer.clearTrades();
		DataViewer.addTrades(s.getResultData());
	}

}

Clear trades from old search from data viewer before adding new ones


package com.breadwallet.tools.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by byfieldj on 2/15/18.
 *

 *

 * Reusable class to quick check whether user is connect to Wifi or mobile data
 */

public class BRConnectivityStatus {

    private Context mContext;

    public BRConnectivityStatus(Context context) {
        this.mContext = context;
    }

    // Returns true if connected to wifi, false if connected to mobile data
    public boolean isWifiOrMobileDataConntected() {
        ConnectivityManager cm = (ConnectivityManager)
                mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo netinfo = cm.getActiveNetworkInfo();

        if (netinfo != null && netinfo.isConnectedOrConnecting()) {
            android.net.NetworkInfo wifi =
                    cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
            android.net.NetworkInfo mobile =
                    cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

            if ((mobile != null && mobile.isConnectedOrConnecting()) || (wifi != null &&
                    wifi.isConnectedOrConnecting())) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }

}

package com.breadwallet.tools.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by byfieldj on 2/15/18.
 *

 *

 * Reusable class to quick check whether user is connect to Wifi or mobile data
 */

public class BRConnectivityStatus {

    private Context mContext;
    public static final int NO_NETWORK = 0;
    public static final int WIFI_ON = 1;
    public static final int MOBILE_ON = 2;
    public static final int MOBILE_WIFI_ON = 3;

    public BRConnectivityStatus(Context context) {
        this.mContext = context;
    }

    // Returns true if connected to wifi, false if connected to mobile data
    public int isMobileDataOrWifiConnected() {
        ConnectivityManager cm = (ConnectivityManager)
                mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo netinfo = cm.getActiveNetworkInfo();

        if (netinfo != null && netinfo.isConnectedOrConnecting()) {
            android.net.NetworkInfo wifi =
                    cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
            android.net.NetworkInfo mobile =
                    cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

            // Mobile Data is on only
            if ((mobile != null && mobile.isConnectedOrConnecting()) && (wifi == null ||
                    !wifi.isConnectedOrConnecting())) {
                return MOBILE_ON;

                // Wifi is on only
            } else if (wifi != null && wifi.isConnectedOrConnecting() && (mobile == null || !mobile.isConnectedOrConnecting())) {
                return WIFI_ON;

                // Both mobile and wifi is on
            } else if (mobile != null && wifi != null && mobile.isConnectedOrConnecting() && wifi.isConnectedOrConnecting()) {

                return MOBILE_WIFI_ON;
            }
        }

        return NO_NETWORK;
    }

}

Fix mobile and wifi check logic


package devopsdistilled.operp.client.abstracts;

import javax.swing.JComponent;
import javax.swing.JDialog;

import net.miginfocom.swing.MigLayout;

public abstract class SubTaskPane {
	protected JDialog dialog;
	protected JComponent owner;

	public SubTaskPane() {
		dialog = new JDialog();
	}

	public abstract JComponent getPane();

	public void setOwner(JComponent owner) {
		this.owner = owner;
	}

	public JDialog getDialog() {
		dialog.getContentPane().setLayout(new MigLayout("debug"));
		dialog.getContentPane().add(getPane());
		dialog.setLocationRelativeTo(owner);
		dialog.setSize(400, 600);
		dialog.setVisible(true);
		return dialog;
	}

}

package devopsdistilled.operp.client.abstracts;

import javax.swing.JComponent;
import javax.swing.JDialog;

import net.miginfocom.swing.MigLayout;

public abstract class SubTaskPane {
	protected JDialog dialog;
	protected JComponent owner;

	public SubTaskPane() {
		dialog = new JDialog();
	}

	public abstract JComponent getPane();

	public void setOwner(JComponent owner) {
		this.owner = owner;
	}

	public JDialog getDialog() {
		dialog.getContentPane().setLayout(new MigLayout("debug, fill"));
		dialog.getContentPane().add(getPane(), "grow");
		dialog.setLocationRelativeTo(owner);
		dialog.setSize(400, 600);
		dialog.setVisible(true);
		return dialog;
	}

}

Set components to grow inside to fill JDialog ContentPane


package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.StudySegment;

/**
 * @author Moses Hohman
 * @author Rhett Sutphin
 */
public class StudySegmentDao extends StudyCalendarMutableDomainObjectDao<StudySegment> {
    @Override
    public Class<StudySegment> domainClass() {
        return StudySegment.class;
    }

    public void delete(StudySegment segment) {
        getHibernateTemplate().delete(segment);
    }
}

package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.StudySegment;

/**
 * @author Moses Hohman
 * @author Rhett Sutphin
 */
public class StudySegmentDao extends StudyCalendarMutableDomainObjectDao<StudySegment> {
    @Override
    public Class<StudySegment> domainClass() {
        return StudySegment.class;
    }

    /**
     * Deletes the given study segment
     *
     * @param  segment the study segment to delete
     */
    public void delete(StudySegment segment) {
        getHibernateTemplate().delete(segment);
    }
}

Add javadoc to study segment dao.


package com.filestack.internal.responses;

import com.google.gson.annotations.SerializedName;

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

/** Response object from multipart upload endpoint. */
public class UploadResponse {
  private String url;
  @SerializedName("location_url")
  private String locationUrl;
  @SerializedName("headers")
  private S3Headers s3Headers;

  public String getUrl() {
    return url;
  }

  public String getLocationUrl() {
    return locationUrl;
  }

  /**
   * Return {@link Map} of S3 headers.
   */
  public Map<String, String> getS3Headers() {
    HashMap<String, String> headers = new HashMap<>();
    headers.put("Authorization", s3Headers.auth);
    if (s3Headers.acl != null) {
      headers.put("x-amz-acl", s3Headers.acl);
    }
    headers.put("Content-MD5", s3Headers.md5);
    headers.put("x-amz-content-sha256", s3Headers.sha256);
    headers.put("x-amz-date", s3Headers.date);
    if (s3Headers.encryption != null) {
      headers.put("x-amz-server-side-encryption", s3Headers.encryption);
    }
    return headers;
  }

  private class S3Headers {
    @SerializedName("Authorization")
    private String auth;
    @SerializedName("x-amz-acl")
    private String acl;
    @SerializedName("Content-MD5")
    private String md5;
    @SerializedName("x-amz-content-sha256")
    private String sha256;
    @SerializedName("x-amz-date")
    private String date;
    @SerializedName("x-amz-server-side-encryption")
    private String encryption;
  }
}

package com.filestack.internal.responses;

import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;

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

/** Response object from multipart upload endpoint. */
public class UploadResponse {
  private String url;
  @SerializedName("location_url")
  private String locationUrl;
  @SerializedName("headers")
  private JsonObject s3Headers;

  public String getUrl() {
    return url;
  }

  public String getLocationUrl() {
    return locationUrl;
  }

  /**
   * Return {@link Map} of S3 headers.
   */
  public Map<String, String> getS3Headers() {
    HashMap<String, String> out = new HashMap<>();
    for (String key : s3Headers.keySet()) {
      out.put(key, s3Headers.get(key).getAsString());
    }
    return out;
  }
}

Replace S3Headers class with JsonObject


// Copyright 2012 The Chromium Authors. 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.chromium.chrome.browser.nfc;

import android.app.Activity;
import android.nfc.NfcAdapter;
import android.util.Log;

/**
 * Initializes Android Beam (sharing URL via NFC) for devices that have NFC. If user taps their
 * device with another Beam capable device, then Chrome gets the current URL, filters for security
 * and returns the result to Android.
 */
public final class BeamController {
    /**
     * If the device has NFC, construct a BeamCallback and pass it to Android.
     *
     * @param activity Activity that is sending out beam messages.
     * @param provider Provider that returns the URL that should be shared.
     */
    public static void registerForBeam(final Activity activity, final BeamProvider provider) {
        final NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(activity);
        if (nfcAdapter == null) return;
        try {
            final BeamCallback beamCallback = new BeamCallback(activity, provider);
            nfcAdapter.setNdefPushMessageCallback(beamCallback, activity);
            nfcAdapter.setOnNdefPushCompleteCallback(beamCallback, activity);
        } catch (IllegalStateException e) {
            Log.w("BeamController", "NFC registration failure. Can't retry, giving up.");
        }
    }
}

// Copyright 2012 The Chromium Authors. 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.chromium.chrome.browser.nfc;

import android.app.Activity;
import android.nfc.NfcAdapter;
import android.util.Log;

/**
 * Initializes Android Beam (sharing URL via NFC) for devices that have NFC. If user taps their
 * device with another Beam capable device, then Chrome gets the current URL, filters for security
 * and returns the result to Android.
 */
public final class BeamController {
    /**
     * If the device has NFC, construct a BeamCallback and pass it to Android.
     *
     * @param activity Activity that is sending out beam messages.
     * @param provider Provider that returns the URL that should be shared.
     */
    public static void registerForBeam(final Activity activity, final BeamProvider provider) {
        final NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(activity);
        if (nfcAdapter == null) return;
        try {
            final BeamCallback beamCallback = new BeamCallback(activity, provider);
            nfcAdapter.setNdefPushMessageCallback(beamCallback, activity);
            nfcAdapter.setOnNdefPushCompleteCallback(beamCallback, activity);
        } catch (IllegalStateException | SecurityException e) {
            Log.w("BeamController", "NFC registration failure. Can't retry, giving up.");
        }
    }
}

Handle NFC permission being unavailable.


package mn.devfest.persistence;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;

import mn.devfest.api.model.Conference;

/**
 * Stores and provides information about the conference. The app is shipped with a local copy of
 * the latest conference information. As we get newer information from the API, this is updated.
 *
 * @author pfuentes
 */
public class ConferenceRepository {

    Context mContext;
    SharedPreferences mSharedPreferences;

    public ConferenceRepository (@NonNull Context context){
        mContext = context;
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
    }

    public void setConference(Conference conference) {
        //TODO implement
    }

    public Conference getConference() {
        //TODO implement and remove dummy return
        return new Conference();
    }

}

package mn.devfest.persistence;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import mn.devfest.api.model.Conference;

/**
 * Stores and provides information about the conference. The app is shipped with a local copy of
 * the latest conference information. As we get newer information from the API, this is updated.
 *
 * @author pfuentes
 */
public class ConferenceRepository {

    Context mContext;
    SharedPreferences mSharedPreferences;

    public ConferenceRepository(@NonNull Context context) {
        mContext = context;
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
    }

    /**
     * Removes any existing persisted conference data and replaces it with the passed value
     *
     * @param conference most up-to-date conference information available
     */
    public void setConference(@Nullable Conference conference) {
        //TODO implement
    }

    /**
     * Provides the most recently persisted conference data
     *
     * @return persisted conference data
     */
    @NonNull
    public Conference getConference() {
        //TODO implement and remove dummy return
        return new Conference();
    }

}

Document methods in conference repository


package org.restheart.examples;

import java.io.IOException;
import com.google.protobuf.InvalidProtocolBufferException;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;

public class Test {
    public static void main(String[] args) throws Exception  {
        testRequest(args[0] == null ? "World" : args[0]);
    }

    public static void testRequest(String name) throws UnirestException, InvalidProtocolBufferException, IOException  {
        var body = HelloRequest.newBuilder()
            .setName(name)
            .build();

        var resp = Unirest.post("http://localhost:8080/proto")
                .header("Content-Type", "application/protobuf")
                .body(body.toByteArray())
                .asBinary();

        var reply = HelloReply.parseFrom(resp.getBody().readAllBytes());

        System.out.println(reply.getMessage());
    }
}

package org.restheart.examples;

import java.io.IOException;
import com.google.protobuf.InvalidProtocolBufferException;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;

public class Test {
    public static void main(String[] args) throws Exception  {
        testRequest(args.length < 1 ? "World" : args[0]);
    }

    public static void testRequest(String name) throws UnirestException, InvalidProtocolBufferException, IOException  {
        var body = HelloRequest.newBuilder()
            .setName(name)
            .build();

        var resp = Unirest.post("http://localhost:8080/proto")
                .header("Content-Type", "application/protobuf")
                .body(body.toByteArray())
                .asBinary();

        var reply = HelloReply.parseFrom(resp.getBody().readAllBytes());

        System.out.println(reply.getMessage());
    }
}

Fix NPE in protobuffer example test class


/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.retry;

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

/**
 * Tests for the {@link TimeoutRetry} class.
 */
public final class TimeoutRetryTest {

  /**
   * Tests that the provided timeout is respected.
   */
  @Test
  public void timeout() {
    final long timeoutMs = 50;
    final int sleepMs = 10;
    int attempts = 0;
    TimeoutRetry timeoutRetry = new TimeoutRetry(timeoutMs, sleepMs);
    Assert.assertEquals(0, timeoutRetry.getAttemptCount());
    long startMs = System.currentTimeMillis();
    while (timeoutRetry.attempt()) {
      attempts++;
    }
    long endMs = System.currentTimeMillis();
    Assert.assertTrue(attempts > 0);
    Assert.assertTrue((endMs - startMs) >= timeoutMs);
    Assert.assertEquals(attempts, timeoutRetry.getAttemptCount());
    Assert.assertTrue(attempts <= (timeoutMs / sleepMs) + 1);
  }
}

/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.retry;

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

import org.junit.Test;

/**
 * Tests for the {@link TimeoutRetry} class.
 */
public final class TimeoutRetryTest {

  /**
   * Tests that the provided timeout is respected.
   */
  @Test
  public void timeout() {
    final long timeoutMs = 50;
    final int sleepMs = 10;
    int attempts = 0;
    TimeoutRetry timeoutRetry = new TimeoutRetry(timeoutMs, sleepMs);
    assertEquals(0, timeoutRetry.getAttemptCount());
    long startMs = System.currentTimeMillis();
    while (timeoutRetry.attempt()) {
      attempts++;
    }
    long endMs = System.currentTimeMillis();
    assertTrue(attempts > 0);
    assertTrue((endMs - startMs) >= timeoutMs);
    assertEquals(attempts, timeoutRetry.getAttemptCount());
    assertTrue(attempts <= (timeoutMs / sleepMs) + 1);
  }
}

Use static imports for standard test utilities


package net.elprespufferfish.rssreader;

import android.provider.BaseColumns;

public class DatabaseSchema {

    public static interface FeedTable extends BaseColumns {
        public static final String TABLE_NAME = "feeds";
        public static final String FEED_NAME = "feed_name";
        public static final String FEED_URL = "feed_url";
    }

    public static interface ArticleTable extends BaseColumns {
        public static final String TABLE_NAME = "articles";
        public static final String ARTICLE_FEED = "article_feed";
        public static final String ARTICLE_NAME = "article_name";
        public static final String ARTICLE_URL = "article_url";
        public static final String ARTICLE_PUBLICATION_DATE = "article_pubdate";
        public static final String ARTICLE_DESCRIPTION = "article_description";
        public static final String ARTICLE_GUID = "article_guid";
        public static final String ARTICLE_IS_READ = "article_is_read";
    }

    private DatabaseSchema() {
        // prevent instantiations
    }
}

package net.elprespufferfish.rssreader;

import android.provider.BaseColumns;

public class DatabaseSchema {

    public interface FeedTable extends BaseColumns {
        String TABLE_NAME = "feeds";
        String FEED_NAME = "feed_name";
        String FEED_URL = "feed_url";
    }

    public interface ArticleTable extends BaseColumns {
        String TABLE_NAME = "articles";
        String ARTICLE_FEED = "article_feed";
        String ARTICLE_NAME = "article_name";
        String ARTICLE_URL = "article_url";
        String ARTICLE_PUBLICATION_DATE = "article_pubdate";
        String ARTICLE_DESCRIPTION = "article_description";
        String ARTICLE_GUID = "article_guid";
        String ARTICLE_IS_READ = "article_is_read";
    }

    private DatabaseSchema() {
        // prevent instantiations
    }
}

Remove redundant modifiers for interface fields


package se.tla.mavenversionbumper.vcs;

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

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

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

    public static final String VERSIONCONTROL = "versioncontrol";

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

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

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

package se.tla.mavenversionbumper.vcs;

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

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

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

    public static final String VERSIONCONTROL = "versioncontrol";

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

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

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

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

Print out what will actually be executed.


package org.robockets.stronghold.robot.highgoalshooter;

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

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

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

package org.robockets.stronghold.robot.highgoalshooter;

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

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

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

Add horizontal align to free fire command group.


package com.example.mysmall.lib.style;

import android.app.Application;

//import net.wequick.small.Small;

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

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

package com.example.mysmall.lib.style;

import android.app.Application;

import net.wequick.small.Small;

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

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

Add sample for setting Small WebActivity theme


package com.uwetrottmann.shopr.utils;

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

    private static Statistics _instance;

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

    private boolean mIsStarted;

    private Statistics() {

    }

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

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

    public void incrementCycleCount() {
        mCycleCount++;
    }

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

}

package com.uwetrottmann.shopr.utils;

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

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

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

    private static Statistics _instance;

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

    private boolean mIsStarted;

    private Statistics() {

    }

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

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

    public void incrementCycleCount() {
        mCycleCount++;
    }

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

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

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

        return inserted;
    }

}

Store stats when finishing task.


package org.realityforge.arez.processor;

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

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

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

package org.realityforge.arez.processor;

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

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

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

Fix the generation of classnames


package io.github.aquerr.eaglefactions.entities;

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

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

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

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

package io.github.aquerr.eaglefactions.entities;

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

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

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

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

Fix crash (change Power type to double)


package org.commcare.modern.parse;

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

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

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

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

package org.commcare.modern.parse;

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

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

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

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

Add option to fail fast on parse


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

import io.gravitee.repository.model.Application;

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

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

    Set<Application> findAll();

    Set<Application> findByUser(String username);

    Application create(Application application);

    Application update(Application application);

    Optional<Application> findByName(String applicationName);

    void delete(String apiName);

    int countByUser(String username);

    int countByTeam(String teamName);
}

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

import io.gravitee.repository.model.Application;

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

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

    Set<Application> findAll();

    Set<Application> findByTeam(String teamName);

    Set<Application> findByUser(String username);

    Application create(Application application);

    Application update(Application application);

    Optional<Application> findByName(String applicationName);

    void delete(String apiName);

    int countByUser(String username);

    int countByTeam(String teamName);
}

Add service to retrieve list of Applications by team


package org.honorato.diagnostics.example;

import android.os.Bundle;

import org.honorato.diagnostics.DiagnosticsActivity;

public class MainActivity extends DiagnosticsActivity {

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

package org.honorato.diagnostics.example;

import android.os.Bundle;

import org.honorato.diagnostics.DiagnosticsActivity;

public class MainActivity extends DiagnosticsActivity {

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

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

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

Add example for adding check to inherited activity


package org.jetbrains.kotlin.core.log;

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

public class KotlinLogger {

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

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

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

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

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

package org.jetbrains.kotlin.core.log;

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

public class KotlinLogger {

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

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

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

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

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

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

Add method to log and throw runtime exception


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

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

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

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

}

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

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

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

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

}

Set valid parents on breadcrumbitem


package de.espend.idea.laravel.config;

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

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

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

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

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

        Matcher m = configFilePattern.matcher(path);

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

    public static class ConfigFileMatchResult
    {
        private boolean matches;

        private String keyPrefix;

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

        public boolean matches() {
            return matches;
        }

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

package de.espend.idea.laravel.config;

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

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

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

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

        Matcher m = configFilePattern.matcher(path);

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

    public static class ConfigFileMatchResult
    {
        private boolean matches;

        private String keyPrefix;

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

        public boolean matches() {
            return matches;
        }

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

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


package org.intermine.webservice.server.lists;

import java.io.IOException;

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

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

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

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

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

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

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

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

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

}

package org.intermine.webservice.server.lists;

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

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

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

}

Use the new WebServiceServlet framework


package com.strider.datadefender.database.metadata;

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

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

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

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

/*
 * Copyright 2014, Armenak Grigoryan, and individual contributors as indicated
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 */
package com.strider.datadefender.database.metadata;

import com.strider.datadefender.DbConfig.Vendor;

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

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

Refactor getMetaData to use DbConfig.Vendor


package matlab.syntax;

import java.util.*;

import dl.syntax.*;

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

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

	public RealVariable getLHS() {
		return lhs;
	}

	public Term getRHS() {
		return rhs;
	}

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

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

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

}

package matlab.syntax;

import java.util.*;

import dl.syntax.*;

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

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

	public RealVariable getLHS() {
		return lhs;
	}

	public Term getRHS() {
		return rhs;
	}

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

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

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

}

Replace LHS with replacement values


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

import org.junit.Before;

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

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

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

}

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

import org.junit.Before;

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

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

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

}

Stop using wires in versions for Firefox test


package org.codehaus.xfire.handler;

import org.codehaus.xfire.MessageContext;

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

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

package org.codehaus.xfire.handler;

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

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

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

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


package com.example.project.controller;

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

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

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

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

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

}

package com.example.project.controller;

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

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

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

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

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

}

Test commit from IntelliJ IDEA


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fix compile error on Linux


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

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

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

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

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

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

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

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

Return empty description instead of null


package com.thegongoliers.output.motors;

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

public class CircuitBreakerMotorModule implements MotorModule {

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

    private double mLastTripTime;

    private boolean mIsTripped;

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

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

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

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

        if (mIsTripped){
            return 0;
        }

        return desiredSpeed;
    }

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

}

package com.thegongoliers.output.motors;

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

public class CircuitBreakerMotorModule implements MotorModule {

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

    private double mLastTripTime;

    private boolean mIsTripped;

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

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

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

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

        if (mIsTripped){
            return 0;
        }

        return desiredSpeed;
    }

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

}

Make circuit breaker module more generic