package com.salcedo.rapbot.keyboard;

import akka.actor.ActorRef;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import uk.co.caprica.vlcj.player.media.callback.seekable.RandomAccessFileMedia;

import javax.swing.*;
import java.awt.*;
import java.net.MalformedURLException;
import java.net.URL;

public class KeyEventSource implements EventSource {
    @Override
    public void listen(ActorRef actor) {
        JFrame frame = new JFrame("RapBot");
        EmbeddedMediaPlayerComponent mediaPlayerComponent = new EmbeddedMediaPlayerComponent();

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.addKeyListener(new KeyEventForwarder(actor));
        frame.setBounds(100, 100, 600, 400);
        frame.setContentPane(mediaPlayerComponent);
        frame.setVisible(true);

        mediaPlayerComponent.getMediaPlayer().playMedia("http://192.168.1.41:3001/stream.mjpg");
    }
}

package com.salcedo.rapbot.keyboard;

import akka.actor.ActorRef;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;

import javax.swing.*;

public class KeyEventSource implements EventSource {
    @Override
    public void listen(ActorRef actor) {
        JFrame frame = new JFrame("RapBot");
        EmbeddedMediaPlayerComponent mediaPlayerComponent = new EmbeddedMediaPlayerComponent();

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.addKeyListener(new KeyEventForwarder(actor));
        frame.setBounds(100, 100, 640, 480);
        frame.setContentPane(mediaPlayerComponent);
        frame.setVisible(true);

        mediaPlayerComponent.getMediaPlayer().playMedia("http://192.168.1.41:3001/stream.mjpg");
    }
}

Set correct size for window.


package com.reactlibrary;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import org.tensorflow.Graph;

public class RNTensorflowGraphModule extends ReactContextBaseJavaModule {

    private Graph graph;

    public RNTensorflowGraphModule(ReactApplicationContext reactContext) {
        super(reactContext);
    }

    @Override
    public String getName() {
        return "TensorflowGraph";
    }

    @ReactMethod
    public void init(Graph graph) {
        this.graph = graph;
    }

    @ReactMethod
    public void importGraphDef(byte[] graphDef) {
        this.graph.importGraphDef(graphDef);
    }

    @ReactMethod
    public void importGraphDef(byte[] graphDef, String prefix) {
        this.graph.importGraphDef(graphDef, prefix);
    }

    @ReactMethod
    public void toGraphDef(Promise promise) {
        try {
            promise.resolve(this.graph.toGraphDef());
        } catch (Exception e) {
            promise.resolve(e);
        }
    }

    @ReactMethod
    public void operation(String name, Promise promise) {
        try {
            promise.resolve(this.graph.operation(name));
        } catch (Exception e) {
            promise.resolve(e);
        }
    }

    @ReactMethod
    public void close(Graph graph) {
        this.graph.close();
    }
}

package com.reactlibrary;

import android.util.Base64;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import org.tensorflow.Graph;

public class RNTensorflowGraphModule extends ReactContextBaseJavaModule {

    private Graph graph;

    public RNTensorflowGraphModule(ReactApplicationContext reactContext) {
        super(reactContext);
    }

    @Override
    public String getName() {
        return "TensorflowGraph";
    }

    @ReactMethod
    public void init(Graph graph) {
        this.graph = graph;
    }

    @ReactMethod
    public void importGraphDef(String graphDef) {
        this.graph.importGraphDef(Base64.decode(graphDef, Base64.DEFAULT));
    }

    @ReactMethod
    public void importGraphDef(String graphDef, String prefix) {
        this.graph.importGraphDef(Base64.decode(graphDef, Base64.DEFAULT), prefix);
    }

    @ReactMethod
    public void toGraphDef(Promise promise) {
        try {
            promise.resolve(Base64.encodeToString(this.graph.toGraphDef(), Base64.DEFAULT));
        } catch (Exception e) {
            promise.resolve(e);
        }
    }

    @ReactMethod
    public void operation(String name, Promise promise) {
        try {
            promise.resolve(this.graph.operation(name));
        } catch (Exception e) {
            promise.resolve(e);
        }
    }

    @ReactMethod
    public void close(Graph graph) {
        this.graph.close();
    }
}

Use base64 strings instead of byte arrays


/*******************************************************************************
 * Copyright (c) 2004 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.model.api.extension;

import java.util.Locale;
import java.util.ResourceBundle;

import com.ibm.icu.util.ULocale;

/**
 * Provides the resource bundle with the given locale.
 */

public interface IResourceBundleProvider
{

	/**
	 * Returns the resource bundle with the locale.
	 *
	 * @param locale
	 *            the given locale
	 * @return the resource bundle
	 * @deprecated to support ICU4J, replaced by :
	 *             getResourceBundle(ULocale locale)
	 */

	public ResourceBundle getResourceBundle( Locale locale );

	/**
	 * Returns the resource bundle with the locale.
	 *
	 * @param locale
	 *            the given locale
	 * @return the resource bundle
	 */

	public ResourceBundle getResourceBundle( ULocale locale );

}

/*******************************************************************************
 * Copyright (c) 2004 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.model.api.extension;

import java.util.Locale;
import java.util.ResourceBundle;

import com.ibm.icu.util.ULocale;
import com.ibm.icu.util.UResourceBundle;

/**
 * Provides the resource bundle with the given locale.
 */

public interface IResourceBundleProvider
{

	/**
	 * Returns the resource bundle with the locale.
	 *
	 * @param locale
	 *            the given locale
	 * @return the resource bundle
	 * @deprecated to support ICU4J, replaced by :
	 *             getResourceBundle(ULocale locale)
	 */

	public ResourceBundle getResourceBundle( Locale locale );

	/**
	 * Returns the resource bundle with the locale.
	 *
	 * @param locale
	 *            the given locale
	 * @return the resource bundle
	 */

	public UResourceBundle getResourceBundle( ULocale locale );

}

Fix unit test case error


package com.ustwo.boilerplate.base;

import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;

import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;

public abstract class BasePresenter<T extends BaseView> {
  private CompositeDisposable disposables;
  private T view;

  /**
   * On view attached.
   *
   * @param view View attached to the presenter
   */
  @CallSuper
  public void onViewAttached(@NonNull final T view) {
    if (this.view != null) {
      throw new IllegalStateException("View " + this.view + " is already attached. Cannot attach "
          + view);
    }
    this.view = view;
  }

  /**
   * On view detached.
   */
  @CallSuper
  public void onViewDetached() {
    if (view == null) {
      throw new IllegalStateException("View is already detached");
    }
    view = null;

    if (disposables != null) {
      disposables.dispose();
      disposables = null;
    }
  }

  /**
   * Dispose on view detach.
   *
   * @param disposable Disposable to be disposed of upon view detachment
   */
  @CallSuper
  protected void disposeOnViewDetach(@NonNull final Disposable disposable) {
    if (disposables == null) {
      disposables = new CompositeDisposable();
    }
    disposables.add(disposable);
  }

  public boolean isViewAttached() {
    return view != null;
  }
}

package com.ustwo.boilerplate.base;

import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;

import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;

public abstract class BasePresenter<T extends BaseView> {
  private CompositeDisposable disposables;
  private T view;

  /**
   * On view attached. To be called when your view is initialised.
   *
   * @param view View attached to the presenter
   */
  @CallSuper
  public void onViewAttached(@NonNull final T view) {
    if (this.view != null) {
      throw new IllegalStateException("View " + this.view + " is already attached. Cannot attach "
          + view);
    }
    this.view = view;
  }

  /**
   * On view detached. Intended as a cleanup process that should be called when the view will no
   * longer be in use.
   */
  @CallSuper
  public void onViewDetached() {
    if (view == null) {
      throw new IllegalStateException("View is already detached");
    }
    view = null;

    if (disposables != null) {
      disposables.dispose();
      disposables = null;
    }
  }

  /**
   * Dispose on view detach.
   *
   * @param disposable Disposable to be disposed of upon view detachment
   */
  @CallSuper
  protected void disposeOnViewDetach(@NonNull final Disposable disposable) {
    if (disposables == null) {
      disposables = new CompositeDisposable();
    }
    disposables.add(disposable);
  }

  public boolean isViewAttached() {
    return view != null;
  }
}

Add clarification on expected usage of onViewAttached and onViewDetached


/*
 * Copyright 2014 Aurélien Broszniowski
 *
 * 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.rainfall.generator;

import io.rainfall.SequenceGenerator;

import java.util.concurrent.atomic.AtomicLong;

/**
 * @author Aurelien Broszniowski
 *
 */

public class IterationSequenceGenerator implements SequenceGenerator {

  private final AtomicLong next;

  public IterationSequenceGenerator() {
    this.next = new AtomicLong(1);
  }

  /**
   * Constructor taking the first value to be returned by {@link #next()} in parameter
   *
   * @param firstValue first value to be returned
   */
  public IterationSequenceGenerator(long firstValue) {
    this.next = new AtomicLong(firstValue);
  }

  @Override
  public long next() {
    return next.getAndIncrement();
  }

  @Override
  public String getDescription() {
    return "Iterative sequence";
  }
}

/*
 * Copyright 2014 Aurélien Broszniowski
 *
 * 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.rainfall.generator;

import io.rainfall.SequenceGenerator;

import java.util.concurrent.atomic.AtomicLong;

/**
 * @author Aurelien Broszniowski
 */

public class IterationSequenceGenerator implements SequenceGenerator {

  private final AtomicLong next;

  public IterationSequenceGenerator() {
    this.next = new AtomicLong(1);
  }

  /**
   * Constructor taking the first value to be returned by {@link #next()} in parameter
   *
   * @param firstValue first value to be returned
   */
  public IterationSequenceGenerator(long firstValue) {
    this.next = new AtomicLong(firstValue);
  }

  @Override
  public long next() {
    return next.getAndIncrement();
  }

  @Override
  public String getDescription() {
    return "Iterative sequence";
  }
}

Revert "changed iteration generator for redis to have only positive counters"


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

package com.google.sps;

/**
 * Custom exception class for GoogleShoppingQuerier class.
 */
public class ShoppingQuerierConnectionException extends Exception {
  public ShoppingQuerierConnectionException(String errorMessage, Throwable cause) {
    super(errorMessage, cause);
  }
}

Add new line at end on file


package tools.vitruv.applications.pcmjava.tests.pojotransformations.pcm2java.system;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)

@SuiteClasses({ AssemblyContextMappingTransformationTest.class,
	RequiredDelegationConnectorMappingTransformationTest.class, SystemMappingTransformationTest.class })
public class PCM2JavaSystemTestSuite {

}

package tools.vitruv.applications.pcmjava.tests.pojotransformations.pcm2java.system;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)

@SuiteClasses({ AssemblyContextMappingTransformationTest.class,
	SystemMappingTransformationTest.class })
public class PCM2JavaSystemTestSuite {

}

Remove not yet implemented delegation connector test from test suite.


package com.thuytrinh.transactionviewer.app;

import android.content.Context;
import android.content.res.Resources;
import android.util.Log;

import com.google.gson.Gson;
import com.thuytrinh.transactionviewer.api.MockRatesFetcher;
import com.thuytrinh.transactionviewer.api.MockTransactionsFetcher;
import com.thuytrinh.transactionviewer.api.RatesFetcher;
import com.thuytrinh.transactionviewer.api.TransactionsFetcher;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import rx.functions.Action1;

@Module
class AppModule {
  private final Context context;

  AppModule(Context context) {
    this.context = context;
  }

  @Provides Resources resources() {
    return context.getResources();
  }

  @Provides TransactionsFetcher transactionsFetcher() {
    return new MockTransactionsFetcher(context.getAssets(), new Gson());
  }

  @Provides RatesFetcher ratesFetcher() {
    return new MockRatesFetcher(context.getAssets(), new Gson());
  }

  @Provides @Singleton Action1<Throwable> errorHandler() {
    return error -> Log.e(App.class.getSimpleName(), error.getMessage(), error);
  }
}

package com.thuytrinh.transactionviewer.app;

import android.content.Context;
import android.content.res.Resources;
import android.util.Log;

import com.google.gson.Gson;
import com.thuytrinh.transactionviewer.api.MockRatesFetcher;
import com.thuytrinh.transactionviewer.api.MockTransactionsFetcher;
import com.thuytrinh.transactionviewer.api.RatesFetcher;
import com.thuytrinh.transactionviewer.api.TransactionsFetcher;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import rx.functions.Action1;

@Module
class AppModule {
  private final Context context;

  AppModule(Context context) {
    this.context = context;
  }

  @Provides Resources resources() {
    return context.getResources();
  }

  @Provides @Singleton Gson gson() {
    return new Gson();
  }

  @Provides TransactionsFetcher transactionsFetcher(Gson gson) {
    return new MockTransactionsFetcher(context.getAssets(), gson);
  }

  @Provides RatesFetcher ratesFetcher(Gson gson) {
    return new MockRatesFetcher(context.getAssets(), gson);
  }

  @Provides @Singleton Action1<Throwable> errorHandler() {
    return error -> Log.e(App.class.getSimpleName(), error.getMessage(), error);
  }
}

Use the same Gson instance


package de.christinecoenen.code.zapp;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;

import com.github.porokoro.paperboy.ViewTypes;
import com.github.porokoro.paperboy.builders.PaperboyChainBuilder;

public class ChangelogActivity extends AppCompatActivity {

	public static Intent getStartIntent(Context context) {
		return new Intent(context, ChangelogActivity.class);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_changelog);

		ActionBar actionBar = getSupportActionBar();
		if (actionBar != null) {
			actionBar.setHomeButtonEnabled(true);
			actionBar.setDisplayHomeAsUpEnabled(true);
		}

		if (savedInstanceState == null) {
			Fragment fragment = new PaperboyChainBuilder(this)
					.viewType(ViewTypes.HEADER)
					.buildFragment();

			getSupportFragmentManager()
					.beginTransaction()
					.add(R.id.activity_changelog, fragment)
					.commit();
		}
	}
}

package de.christinecoenen.code.zapp;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;

import com.github.porokoro.paperboy.ViewTypes;
import com.github.porokoro.paperboy.builders.PaperboyChainBuilder;

public class ChangelogActivity extends AppCompatActivity {

	public static Intent getStartIntent(Context context) {
		return new Intent(context, ChangelogActivity.class);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_changelog);

		if (savedInstanceState == null) {
			Fragment fragment = new PaperboyChainBuilder(this)
					.viewType(ViewTypes.HEADER)
					.buildFragment();

			getSupportFragmentManager()
					.beginTransaction()
					.add(R.id.activity_changelog, fragment)
					.commit();
		}
	}
}

Remove unnecessary call to action bar


package com.cloudmine.api.rest.response;

import com.cloudmine.api.rest.response.code.PaymentCode;
import org.apache.http.HttpResponse;

/**
 *
Copyright CloudMine LLC. All rights reserved
 *
 See LICENSE file included with SDK for details.
 */
public class PaymentResponse extends ResponseBase<PaymentCode> {
    protected PaymentResponse(HttpResponse response) {
        super(response);
    }

    public PaymentResponse(String messageBody, int statusCode) {
        super(messageBody, statusCode);
    }

    @Override
    public PaymentCode getResponseCode() {
        return PaymentCode.codeForStatus(getStatusCode());
    }
}

package com.cloudmine.api.rest.response;

import com.cloudmine.api.CMCreditCard;
import com.cloudmine.api.rest.response.code.PaymentCode;
import org.apache.http.HttpResponse;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 *
Copyright CloudMine LLC. All rights reserved
 *
 See LICENSE file included with SDK for details.
 */
public class PaymentResponse extends ResponseBase<PaymentCode> {

    private List<CMCreditCard> creditCards;

    protected PaymentResponse(HttpResponse response) {
        super(response);
    }

    public PaymentResponse(String messageBody, int statusCode) {
        super(messageBody, statusCode);
    }

    @Override
    public PaymentCode getResponseCode() {
        return PaymentCode.codeForStatus(getStatusCode());
    }

    public List<CMCreditCard> getCreditCards() {
        if(creditCards == null) {
            creditCards = new ArrayList<CMCreditCard>();
            Object cards = getObject("card");
            if(cards instanceof Collection) {
                for(Object card : (Collection)cards) {
                    if(card instanceof Map) {
                        Map<String, String> cardMap = (Map<String, String>) card;
                        String nameOnCard = cardMap.get("nameOnCard");
                        String token = cardMap.get("token");
                        String expirationDate = cardMap.get("expirationDate");
                        String last4Digits = cardMap.get("last4Digits");
                        String type = cardMap.get("type");
                        creditCards.add(new CMCreditCard(nameOnCard, token, expirationDate,last4Digits,type));
                    }
                }
            }
        }
        return creditCards;
    }
}

Add seeing loaded cards to payment response


package info.u_team.u_team_core.intern.init;

import info.u_team.u_team_core.UCoreMain;
import info.u_team.u_team_core.api.dye.*;
import net.minecraft.item.Item;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;

@EventBusSubscriber(modid = UCoreMain.MODID, bus = Bus.MOD, value = Dist.CLIENT)
public class UCoreColors {

	@SubscribeEvent
	public static void register(ColorHandlerEvent.Item event) {
		event.getItemColors().register((itemstack, index) -> {
			final Item item = itemstack.getItem();
			if (item instanceof IDyeableItem) {
				return ((IDyeableItem) item).getColor(itemstack);
			}
			return 0;
		}, DyeableItemsRegistry.getDyeableItems().toArray(new Item[DyeableItemsRegistry.getDyeableItems().size()]));
	}
}

package info.u_team.u_team_core.intern.init;

import info.u_team.u_team_core.UCoreMain;
import info.u_team.u_team_core.api.dye.*;
import net.minecraft.item.Item;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;

@EventBusSubscriber(modid = UCoreMain.MODID, bus = Bus.MOD, value = Dist.CLIENT)
public class UCoreColors {

	@SubscribeEvent
	public static void register(ColorHandlerEvent.Item event) {
		event.getItemColors().register((itemstack, index) -> {
			final Item item = itemstack.getItem();
			if (item instanceof IDyeableItem) {
				return ((IDyeableItem) item).getColor(itemstack);
			}
			return 0;
		}, DyeableItemsRegistry.getDyeableItems().stream().toArray(Item[]::new));
	}
}

Use streams to make the toArray method nicer


// Copyright (c) 2009 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.debug.ui.editors;

import org.eclipse.ui.editors.text.TextEditor;

/**
 * A simplistic Javascript editor which supports its own key binding scope.
 */
public class JsEditor extends TextEditor {

  /** The ID of this editor as defined in plugin.xml */
  public static final String EDITOR_ID =
      "org.chromium.debug.ui.editors.JsEditor"; //$NON-NLS-1$

  /** The ID of the editor context menu */
  public static final String EDITOR_CONTEXT = EDITOR_ID + ".context"; //$NON-NLS-1$

  /** The ID of the editor ruler context menu */
  public static final String RULER_CONTEXT = EDITOR_CONTEXT + ".ruler"; //$NON-NLS-1$

  protected void initializeEditor() {
    super.initializeEditor();
    setEditorContextMenuId(EDITOR_CONTEXT);
    setRulerContextMenuId(RULER_CONTEXT);
  }

  public JsEditor() {
    super();
    setSourceViewerConfiguration(new JsSourceViewerConfiguration());
    setKeyBindingScopes(new String[] { "org.eclipse.ui.textEditorScope", //$NON-NLS-1$
        "org.chromium.debug.ui.editors.JsEditor.context" }); //$NON-NLS-1$
  }

}

// Copyright (c) 2009 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.debug.ui.editors;

import org.eclipse.ui.editors.text.TextEditor;

/**
 * A simplistic Javascript editor which supports its own key binding scope.
 */
public class JsEditor extends TextEditor {

  /** The ID of this editor as defined in plugin.xml */
  public static final String EDITOR_ID =
      "org.chromium.debug.ui.editors.JsEditor"; //$NON-NLS-1$

  /** The ID of the editor context menu */
  public static final String EDITOR_CONTEXT = EDITOR_ID + ".context"; //$NON-NLS-1$

  /** The ID of the editor ruler context menu */
  public static final String RULER_CONTEXT = EDITOR_ID + ".ruler"; //$NON-NLS-1$

  @Override
  protected void initializeEditor() {
    super.initializeEditor();
    setEditorContextMenuId(EDITOR_CONTEXT);
    setRulerContextMenuId(RULER_CONTEXT);
  }

  public JsEditor() {
    super();
    setSourceViewerConfiguration(new JsSourceViewerConfiguration());
    setKeyBindingScopes(new String[] { "org.eclipse.ui.textEditorScope", //$NON-NLS-1$
        "org.chromium.debug.ui.editors.JsEditor.context" }); //$NON-NLS-1$
  }

}

Fix ruler menu for breakpoints


package poml.converter.project;

import poml.Converter;
import poml.in.Poml;
import poml.out.Xml;

public class Model4 {

  public static class Start implements Converter {
    @Override public String name() { return "#model4"; }
    @Override public void convert(Poml poml, Xml xml) {
      xml.out.println(
        "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" " +
        "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
        "xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 " +
        "http://maven.apache.org/xsd/maven-4.0.0.xsd\">");
      xml.out.println(sp2 + "<modelVersion>4.0.0</modelVersion>");
    }
  }
  public static class End implements Converter {
    @Override public String name() { return "/model4"; }
    @Override public void convert(Poml poml, Xml xml) {
      xml.out.println("</project>");
    }
  }
}

package poml.converter.project;

import poml.Converter;
import poml.in.Poml;
import poml.out.Xml;

public class Model4 {

  public static class Start implements Converter {
    @Override public String name() { return "#model4"; }
    @Override public void convert(Poml poml, Xml xml) {
      xml.out.println(
        "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" " +
        "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
        "xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 " +
        "http://maven.apache.org/xsd/maven-4.0.0.xsd\">");
      xml.out.println(sp2 + "<modelVersion>4.0.0</modelVersion>");
    }
  }
  public static class End implements Converter {
    @Override public String name() { return "/model4"; }
    @Override public void convert(Poml poml, Xml xml) {
      xml.out.print("</project>");
    }
  }
}

Update end tag of model4.


package org.robolectric.shadows;

import android.graphics.Color;
import org.robolectric.bytecode.RobolectricInternals;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

import static org.fest.reflect.core.Reflection.method;

@Implements(Color.class)
public class ShadowColor {
  @Implementation
  public static int rgb(int red, int green, int blue) {
    return argb(0xff, red, green, blue);
  }

  @Implementation
  public static int argb(int alpha, int red, int green, int blue) {
    return (alpha << 24) | (red << 16) | (green << 8) | blue;
  }

  @Implementation
  public static int parseColor(String colorString) {
    if (colorString.charAt(0) == '#' && colorString.length() == 4 || colorString.length() == 5) {
      StringBuilder buf = new StringBuilder();
      buf.append('#');
      for (int i = 1; i < colorString.length(); i++) {
        buf.append(colorString.charAt(i));
        buf.append(colorString.charAt(i));
      }
      colorString = buf.toString();
    }
    try {
      return method(RobolectricInternals.directMethodName(Color.class.getName(), "parseColor"))
          .withReturnType(int.class)
          .withParameterTypes(String.class)
          .in(Color.class)
          .invoke(colorString);
    } catch (Exception e) {
      throw new IllegalArgumentException("Can't parse value from color \"" + colorString + "\"", e);
    }
  }
}

package org.robolectric.shadows;

import android.graphics.Color;
import org.robolectric.bytecode.RobolectricInternals;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

import static org.fest.reflect.core.Reflection.method;

@Implements(Color.class)
public class ShadowColor {

  @Implementation
  public static int parseColor(String colorString) {
    if (colorString.charAt(0) == '#' && colorString.length() == 4 || colorString.length() == 5) {
      StringBuilder buf = new StringBuilder();
      buf.append('#');
      for (int i = 1; i < colorString.length(); i++) {
        buf.append(colorString.charAt(i));
        buf.append(colorString.charAt(i));
      }
      colorString = buf.toString();
    }
    try {
      return method(RobolectricInternals.directMethodName(Color.class.getName(), "parseColor"))
          .withReturnType(int.class)
          .withParameterTypes(String.class)
          .in(Color.class)
          .invoke(colorString);
    } catch (Exception e) {
      throw new IllegalArgumentException("Can't parse value from color \"" + colorString + "\"", e);
    }
  }
}

Remove some shadows methods in Color.


package com.hellosign.sdk.resource.support.types;

/**
 * The MIT License (MIT)
 *
 * Copyright (C) 2014 hellosign.com
 *
 * 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.
 */

public enum EventType {
	signature_request_viewed, signature_request_signed, signature_request_sent, signature_request_all_signed, file_error, test
}

package com.hellosign.sdk.resource.support.types;

/**
 * The MIT License (MIT)
 *
 * Copyright (C) 2014 hellosign.com
 *
 * 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.
 */

public enum EventType {
	signature_request_viewed,
	signature_request_signed,
	signature_request_sent,
	signature_request_all_signed,
	signature_request_invalid,
	template_created,
	template_error,
	file_error,
	test
}

Add signature_request_invalid, template_created, and template_error event enum values.


package au.gov.ga.geodesy;

import java.security.Permission;

import org.testng.IExecutionListener;

public class TestSuiteListener implements IExecutionListener {

    @SuppressWarnings("serial")
    public class ExitInterceptedException extends SecurityException {
        public ExitInterceptedException() {
            super("Keeping the JVM alive, so you can inspect the in-memory database at http://localhost:8082/. Type ctrl-c to exit.");
        }
    }

    public void onExecutionStart() {
        Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            public void uncaughtException(Thread t, Throwable x) {
                if (x.getClass() == ExitInterceptedException.class) {
                    new Thread() {
                        public void run() {
                            try {
                                Thread.sleep(Long.MAX_VALUE);
                            } catch (InterruptedException ok) {
                            }
                        }
                    }.start();
                }
            }
        });
    }

    public void onExecutionFinish() {
        if (System.getProperty("keepAlive") != null) {
            final SecurityManager securityManager = new SecurityManager() {
                public void checkPermission(Permission permission) {
                    if (permission.getName().startsWith("exitVM.")) {
                        throw new ExitInterceptedException();
                    }
                }
            };
            System.setSecurityManager(securityManager);
        }
    }
}

package au.gov.ga.geodesy;

import java.security.Permission;

import org.testng.IExecutionListener;

public class TestSuiteListener implements IExecutionListener {

    @SuppressWarnings("serial")
    public class ExitInterceptedException extends SecurityException {
        public ExitInterceptedException() {
            super("Keeping the JVM alive, so you can inspect the in-memory database at http://localhost:8082/."
                  + " Connection details: jdbc:h2:./h2-test-db, username: \"\", password: \"\". Type ctrl-c to exit.");
        }
    }

    public void onExecutionStart() {
        Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            public void uncaughtException(Thread t, Throwable x) {
                if (x.getClass() == ExitInterceptedException.class) {
                    new Thread() {
                        public void run() {
                            try {
                                Thread.sleep(Long.MAX_VALUE);
                            } catch (InterruptedException ok) {
                            }
                        }
                    }.start();
                }
            }
        });
    }

    public void onExecutionFinish() {
        if (System.getProperty("keepAlive") != null) {
            final SecurityManager securityManager = new SecurityManager() {
                public void checkPermission(Permission permission) {
                    if (permission.getName().startsWith("exitVM.")) {
                        throw new ExitInterceptedException();
                    }
                }
            };
            System.setSecurityManager(securityManager);
        }
    }
}

Print h2 connection info when using -DkeepAlive


package com.elmakers.mine.bukkit.api.action;

import com.elmakers.mine.bukkit.api.spell.Spell;
import org.bukkit.configuration.ConfigurationSection;

public interface SpellAction
{
    public void load(Spell spell, ConfigurationSection parameters);
    public ConfigurationSection getParameters(ConfigurationSection baseParameters);
    public boolean usesBrush();
    public boolean isUndoable();
}

package com.elmakers.mine.bukkit.api.action;

import com.elmakers.mine.bukkit.api.spell.Spell;
import org.bukkit.configuration.ConfigurationSection;

import java.util.Collection;

public interface SpellAction
{
    public void load(Spell spell, ConfigurationSection parameters);
    public ConfigurationSection getParameters(ConfigurationSection baseParameters);
    public void getParameterNames(Collection<String> parameters);
    public boolean usesBrush();
    public boolean isUndoable();
}

Add parameter inspection to actions and ActionSpell


package converter;

import converters.XmlToJsonConverter;
import org.junit.Test;

import static org.junit.Assert.assertTrue;

public class XmlToJsonConverterTest {

    /**
     * Test conversion from xml to json.
     */
    @Test
    public void convertXmlToJsonTest() {
        String xmlString =
                "<note>\n" +
                "<to>Tove</to>\n" +
                "<from>Jani</from>\n" +
                "<heading>Reminder</heading>\n" +
                "<body>Don't forget me this weekend!</body>\n" +
                "</note>";
        String jsonString = XmlToJsonConverter.convertXmlToJson(xmlString);
        String expectedJsonResult = "{\"note\":{\"heading\":\"Reminder\",\"from\":\"Jani\",\"to\":\"Tove\",\"body\":\"Don't forget me this weekend!\"}}";
        assertTrue(expectedJsonResult.equals(expectedJsonResult));
    }
}

package converter;

import processors.XmlToJsonConverter;
import org.junit.Test;

import static org.junit.Assert.assertTrue;

public class XmlToJsonConverterTest {

    /**
     * Test conversion from xml to json.
     */
    @Test
    public void convertXmlToJsonTest() {
        String xmlString =
                "<note>\n" +
                "<to>Tove</to>\n" +
                "<from>Jani</from>\n" +
                "<heading>Reminder</heading>\n" +
                "<body>Don't forget me this weekend!</body>\n" +
                "</note>";
        String jsonString = null;
        try {
            jsonString = new XmlToJsonConverter().process(xmlString, null);
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        String expectedJsonResult = "{\"note\":{\"heading\":\"Reminder\",\"from\":\"Jani\",\"to\":\"Tove\",\"body\":\"Don't forget me this weekend!\"}}";
        assertTrue(expectedJsonResult.equals(expectedJsonResult));
    }
}

Update test for new interface.


/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package info.zamojski.soft.towercollector.utils;

import android.content.Context;
import android.location.LocationManager;

public class GpsUtils {

    public static boolean isGpsEnabled(Context context) {
        LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
        return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
    }

    public static boolean isGpsAvailable(Context context) {
        LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
        return (locationManager.getAllProviders().contains(LocationManager.GPS_PROVIDER));
    }
}

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package info.zamojski.soft.towercollector.utils;

import android.Manifest;
import android.content.Context;
import android.location.LocationManager;
import android.support.v4.content.PermissionChecker;

public class GpsUtils {

    public static boolean isGpsEnabled(Context context) {

        if (PermissionChecker.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PermissionChecker.PERMISSION_GRANTED) {
            LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
            return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
        }
        // to cover the case when permission denied on API lower than 21
        return false;
    }

    public static boolean isGpsAvailable(Context context) {
        LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
        return (locationManager.getAllProviders().contains(LocationManager.GPS_PROVIDER));
    }
}

Fix crash when checking for GPS availability denied on API lower than 21.


package com.thoughtworks.acceptance;

import com.thoughtworks.acceptance.objects.SampleDynamicProxy;

public class DynamicProxyTest extends AbstractAcceptanceTest {

    public void testDynamicProxy() {
        assertBothWays(SampleDynamicProxy.newInstance(),
                "<dynamic-proxy>\n" +
                "  <interface>com.thoughtworks.acceptance.objects.SampleDynamicProxy$InterfaceOne</interface>\n" +
                "  <interface>com.thoughtworks.acceptance.objects.SampleDynamicProxy$InterfaceTwo</interface>\n" +
                "  <handler class=\"com.thoughtworks.acceptance.objects.SampleDynamicProxy\">\n" +
                "    <aField>hello</aField>\n" +
                "  </handler>\n" +
                "</dynamic-proxy>");
    }

}

package com.thoughtworks.acceptance;

import com.thoughtworks.acceptance.objects.SampleDynamicProxy;

public class DynamicProxyTest extends AbstractAcceptanceTest {
    public static class ClassWithProxyMember {
        SampleDynamicProxy.InterfaceOne one;
        SampleDynamicProxy.InterfaceTwo two;
    };

    public void testDynamicProxy() {
        assertBothWays(SampleDynamicProxy.newInstance(), ""
                + "<dynamic-proxy>\n"
                + "  <interface>com.thoughtworks.acceptance.objects.SampleDynamicProxy$InterfaceOne</interface>\n"
                + "  <interface>com.thoughtworks.acceptance.objects.SampleDynamicProxy$InterfaceTwo</interface>\n"
                + "  <handler class=\"com.thoughtworks.acceptance.objects.SampleDynamicProxy\">\n"
                + "    <aField>hello</aField>\n"
                + "  </handler>\n"
                + "</dynamic-proxy>");
    }

    public void TODOtestDynamicProxyAsFieldMember() {
        ClassWithProxyMember expected = new ClassWithProxyMember();
        expected.one = (SampleDynamicProxy.InterfaceOne)SampleDynamicProxy.newInstance();
        expected.two = (SampleDynamicProxy.InterfaceTwo)expected.one;
        xstream.alias("with-proxy", ClassWithProxyMember.class);
        assertBothWays(expected, ""
                + "<with-proxy>\n"
                + "  <one class=\"dynamic-proxy\">\n"
                + "    <interface>com.thoughtworks.acceptance.objects.SampleDynamicProxy$InterfaceOne</interface>\n"
                + "    <interface>com.thoughtworks.acceptance.objects.SampleDynamicProxy$InterfaceTwo</interface>\n"
                + "    <handler class=\"com.thoughtworks.acceptance.objects.SampleDynamicProxy\">\n"
                + "      <aField>hello</aField>\n"
                + "    </handler>\n"
                + "  </one>\n"
                + "  <two class=\"dynamic-proxy\" reference=\"../one\"/>\n"
                + "</with-proxy>");
    }

}

Add test case for proxy bug.


package com.laytonsmith.abstraction.enums;

import com.laytonsmith.annotations.MEnum;

@MEnum("TeleportCause")
public enum MCTeleportCause {
	COMMAND,
	END_PORTAL,
	ENDER_PEARL,
	NETHER_PORTAL,
	PLUGIN,
	SPECTATE,
	UNKNOWN
}

package com.laytonsmith.abstraction.enums;

import com.laytonsmith.annotations.MEnum;

@MEnum("TeleportCause")
public enum MCTeleportCause {
	COMMAND,
	END_PORTAL,
	ENDER_PEARL,
	NETHER_PORTAL,
	PLUGIN,
	SPECTATE,
	END_GATEWAY,
	UNKNOWN
}

Add END_GATEWAY to teleport causes


package ml.duncte123.skybot.commands.animals;

import ml.duncte123.skybot.Command;
import ml.duncte123.skybot.utils.AirUtils;
import ml.duncte123.skybot.utils.URLConnectionReader;
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
import org.json.JSONArray;
import org.json.JSONObject;

public class LlamaCommand extends Command {
    @Override
    public boolean called(String[] args, GuildMessageReceivedEvent event) {
        return true;
    }

    @Override
    public void action(String[] args, GuildMessageReceivedEvent event) {
        try {
            String jsonString = URLConnectionReader.getText("https://lucoa.systemexit.co.uk/animals/api/llama/random");
            JSONObject jsonObject = new JSONObject(jsonString);
            event.getChannel().sendMessage(AirUtils.embedImage(jsonObject.getString("file"))).queue();
        }
        catch (Exception e) {
            e.printStackTrace();
            event.getChannel().sendMessage(AirUtils.embedMessage("ERROR: " + e.getMessage())).queue();
        }
    }

    @Override
    public String help() {
        return "Here is a llama";
    }
}

package ml.duncte123.skybot.commands.animals;

import ml.duncte123.skybot.Command;
import ml.duncte123.skybot.utils.AirUtils;
import ml.duncte123.skybot.utils.URLConnectionReader;
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
import org.json.JSONArray;
import org.json.JSONObject;

public class LlamaCommand extends Command {
    @Override
    public boolean called(String[] args, GuildMessageReceivedEvent event) {
        return true;
    }

    @Override
    public void action(String[] args, GuildMessageReceivedEvent event) {
        try {
            String theLlama = (args.length<1 ? "random" : args[0]);
            String jsonString = URLConnectionReader.getText("https://lucoa.systemexit.co.uk/animals/api/llama/" + theLlama);
            JSONObject jsonObject = new JSONObject(jsonString);
            event.getChannel().sendMessage(AirUtils.embedImage(jsonObject.getString("file"))).queue();
        }
        catch (Exception e) {
            e.printStackTrace();
            event.getChannel().sendMessage(AirUtils.embedMessage("ERROR: " + e.getMessage())).queue();
        }
    }

    @Override
    public String help() {
        return "Here is a llama";
    }
}

Add option to search for llamas


package org.apache.diana.api.reader;

import org.apache.diana.api.ReaderField;

import java.util.Date;

/**
 * Class to reads and converts Date type
 *
 * @author Daniel Cunha danielsoro@apache.org
 */
public final class DateReader implements ReaderField {

    @Override
    public boolean isCompatible(Class clazz) {
        return Date.class.equals(clazz);
    }

    @Override
    public <T> T read(Class<T> clazz, Object value) {

        if (Date.class.isInstance(value)) {
            return (T) value;
        }

        if (Long.class.isInstance(value)) {
            return (T) new Date((Long) value);
        }
        return (T) new Date(value.toString());
    }
}

package org.apache.diana.api.reader;

import org.apache.diana.api.ReaderField;

import java.util.Date;

/**
 * Class to reads and converts Date type
 *
 * @author Daniel Cunha - danielsoro@apache.org
 */
public final class DateReader implements ReaderField {

    @Override
    public boolean isCompatible(Class clazz) {
        return Date.class.equals(clazz);
    }

    @Override
    public <T> T read(Class<T> clazz, Object value) {

        if (Date.class.isInstance(value)) {
            return (T) value;
        }

        if (Number.class.isInstance(value)) {
            return (T) new Date(((Number) value).longValue());
        }

        return (T) new Date(value.toString());
    }
}

Change Long check for Number


package com.github.aureliano.achmed.os.service;

import org.apache.log4j.Logger;

import com.github.aureliano.achmed.command.CommandFacade;
import com.github.aureliano.achmed.command.CommandResponse;

public class RedHatService extends LinuxService {

	private static final Logger logger = Logger.getLogger(RedHatService.class);
	private static final String SERVICE = "/sbin/service";

	public RedHatService() {
		super();
	}

	@Override
	public boolean isRunning() {
		if ((super.properties.getHasStatus() != null) && (super.properties.getHasStatus())) {
			CommandResponse res = CommandFacade.executeCommand(SERVICE, super.properties.getName(), "status");
			return (res.getExitStatusCode() == 0);
		}

		return super.isRunning();
	}

	@Override
	public CommandResponse enableBootstrap() {
		throw new UnsupportedOperationException("Not implemented yet.");
	}

	@Override
	public CommandResponse disableBootstrap() {
		throw new UnsupportedOperationException("Not implemented yet.");
	}

	@Override
	public boolean isEnabledInBootstrap() {
		throw new UnsupportedOperationException("Not implemented yet.");
	}
}

package com.github.aureliano.achmed.os.service;

import org.apache.log4j.Logger;

import com.github.aureliano.achmed.command.CommandFacade;
import com.github.aureliano.achmed.command.CommandResponse;
import com.github.aureliano.achmed.helper.StringHelper;

public class RedHatService extends LinuxService {

	private static final Logger logger = Logger.getLogger(RedHatService.class);
	private static final String SERVICE = "/sbin/service";

	public RedHatService() {
		super();
	}

	@Override
	public CommandResponse start() {
		if (this.isRunning()) {
			logger.debug("Service " + super.properties.getName() + " is already running.");
			return null;
		}

		if (StringHelper.isEmpty(super.properties.getBinary())) {
			return CommandFacade.executeCommand(SERVICE, super.properties.getName(), "start");
		}

		return super.start();
	}

	@Override
	public boolean isRunning() {
		if ((super.properties.getHasStatus() != null) && (super.properties.getHasStatus())) {
			CommandResponse res = CommandFacade.executeCommand(SERVICE, super.properties.getName(), "status");
			return (res.getExitStatusCode() == 0);
		}

		return super.isRunning();
	}

	@Override
	public CommandResponse enableBootstrap() {
		throw new UnsupportedOperationException("Not implemented yet.");
	}

	@Override
	public CommandResponse disableBootstrap() {
		throw new UnsupportedOperationException("Not implemented yet.");
	}

	@Override
	public boolean isEnabledInBootstrap() {
		throw new UnsupportedOperationException("Not implemented yet.");
	}
}

Implement method to start service.


// NEC Labs America Inc. CONFIDENTIAL

package com.necla.am.zwutils;

import com.necla.am.zwutils.Misc.Versioning;

public class _Namespace {

	public static final String PRODUCT = "ZWUtils - Jack of All Trades Utility Libraries";
	public static final String COMPONENT = "ZWUtils for Java";
	public static final String VERSION = "@VERSION@";
	public static final String BUILD = "@DATE@ @TIME@";

	static {
		Versioning.Namespace_Init(_Namespace.class);
	}

}

// NEC Labs America Inc. CONFIDENTIAL

package com.necla.am.zwutils;

import com.necla.am.zwutils.Misc.Versioning;

public class _Namespace {

	public static final String PRODUCT = "ZWUtils - Jack of All Trades Utility Libraries";
	public static final String COMPONENT = "ZWUtils for Java";
	public static final String VERSION = "@VERSION@".toString();
	public static final String BUILD = "@DATE@ @TIME@".toString();

	static {
		Versioning.Namespace_Init(_Namespace.class);
	}

}

Improve namespace programmatic access in Eclipse debug mode


/**
 * Waffle (https://github.com/dblock/waffle)
 *
 * Copyright (c) 2010 - 2014 Application Security, Inc.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Application Security, Inc.
 */
/**
 * Nothing for now, but in the future, this would include:
 *
 * org/eclipse/jetty/security/Authenticator.java

 * org/eclipse/jetty/security/LoginService.java

 */
package waffle.jetty;

/**
 * Waffle (https://github.com/dblock/waffle)
 *
 * Copyright (c) 2010 - 2014 Application Security, Inc.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Application Security, Inc.
 */
/**
 * Nothing for now, but in the future, this would include:
 *
 *

 *  org/eclipse/jetty/security/Authenticator.java
 *

 *

 *  org/eclipse/jetty/security/LoginService.java
 *

 */
package waffle.jetty;

Fix jetty javadocs so jdk8 builds work.


package com.suse.salt.netapi.datatypes.target;

/**
 * Possible values for the tgt_type or expr_form parameter in salt netapi calls.
 */
public enum TargetType {

    GLOB("glob"),
    PCRE("pcre"),
    LIST("list"),
    GRAIN("grain"),
    GRAIN_PCRE("grain_pcre"),
    PILLAR("pillar"),
    PILLAR_PCRE("pillar_pcre"),
    NODEGROUP("nodegroup"),
    RANGE("range"),
    COMPOUND("compound"),
    IPCIDR("ipcidr");

    private final String value;

    TargetType(String value) { this.value = value; }

    public String getValue() { return value; }
}

package com.suse.salt.netapi.datatypes.target;

/**
 * Possible values for the tgt_type or expr_form parameter in salt netapi calls.
 */
public enum TargetType {

    GLOB("glob"),
    PCRE("pcre"),
    LIST("list"),
    GRAIN("grain"),
    GRAIN_PCRE("grain_pcre"),
    PILLAR("pillar"),
    PILLAR_EXACT("pillar_exact"),
    PILLAR_PCRE("pillar_pcre"),
    NODEGROUP("nodegroup"),
    RANGE("range"),
    COMPOUND("compound"),
    IPCIDR("ipcidr"),
    DATA("data");

    private final String value;

    TargetType(String value) { this.value = value; }

    public String getValue() { return value; }
}

Add missing match types: data and pillar_exact


package net.hexogendev.hexogen.api.network;

import net.hexogendev.hexogen.api.Server;
import net.hexogendev.hexogen.api.entity.alive.player.Player;
import net.hexogendev.hexogen.api.world.Position;

public interface NetworkServer {

	public Server getServer();

	public Object getProtocolServer();

	public int getPort();

	public String getHostAddress();

	public void sendPacketForAll(IPacket packet);

	public void sendPacketDistance(Position pos, IPacket packet, int radius);

	public void sendPacketForAllExpect(IPacket packet, Player expect);

	public void sendPacketDistanceExpect(Position pos, IPacket packet, int radius, Player expect);

	public void shutdown();

}

package net.hexogendev.hexogen.api.network;

import net.hexogendev.hexogen.api.Server;
import net.hexogendev.hexogen.api.entity.alive.player.Player;
import net.hexogendev.hexogen.api.world.Position;
import net.hexogendev.hexogen.api.world.World;

public interface NetworkServer {

	public Server getServer();

	public Object getProtocolServer();

	public int getPort();

	public String getHostAddress();

	public void sendPacketForAll(IPacket packet);

	public void sendPacketForAll(World world, IPacket packet);

	public void sendPacketForAllExpect(IPacket packet, Player expect);

	public void sendPacketForAllExpect(World world, IPacket packet, Player expect);

	public void sendPacketDistance(Position pos, IPacket packet, int radius);

	public void sendPacketDistanceExpect(Position pos, IPacket packet, int radius, Player expect);

	public void shutdown();

}

Add sendPacket for world players


/**
 * License Agreement for Jaeksoft OpenSearchServer
 *
 * Copyright (C) 2011 Emmanuel Keller / Jaeksoft
 *
 * http://www.open-search-server.com
 *
 * This file is part of Jaeksoft OpenSearchServer.
 *
 * Jaeksoft OpenSearchServer is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 * Jaeksoft OpenSearchServer 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Jaeksoft OpenSearchServer.
 *  If not, see <http://www.gnu.org/licenses/>.
 **/

package com.jaeksoft.searchlib.index;

import com.jaeksoft.searchlib.schema.Schema;

public interface BeforeUpdateInterface {

	public void update(Schema schema, IndexDocument document);
}

/**
 * License Agreement for Jaeksoft OpenSearchServer
 *
 * Copyright (C) 2011 Emmanuel Keller / Jaeksoft
 *
 * http://www.open-search-server.com
 *
 * This file is part of Jaeksoft OpenSearchServer.
 *
 * Jaeksoft OpenSearchServer is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 * Jaeksoft OpenSearchServer 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Jaeksoft OpenSearchServer.
 *  If not, see <http://www.gnu.org/licenses/>.
 **/

package com.jaeksoft.searchlib.index;

import com.jaeksoft.searchlib.SearchLibException;
import com.jaeksoft.searchlib.schema.Schema;

public interface BeforeUpdateInterface {

	public void update(Schema schema, IndexDocument document)
			throws SearchLibException;
}

Add beforeupdate interface to writer


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

/**
 * Collection of exception messages.
 *
 * @author Ryan Gilera
 */
public enum ExceptionMsg {

    AUTHENTICATION_EXCEPTION_NO_USER("No such user found. Invalid credentials."),
    AUTHENTICATION_EXCEPTION_SYS_ERROR("System error occured "),
    NO_CURRENT_USER_EXCEPTION("No user is login"),
    WRONG_CURRENT_USER_TYPE_EXCEPTION("Wrong user type access."),
    EMPTY_SQL_RESULT("Empty SQL query result.");
    private final String msg;

    private ExceptionMsg(String msg) {
        this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

}

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

/**
 * Collection of exception messages.
 *
 * @author Ryan Gilera
 */
public enum ExceptionMsg {

    AUTHENTICATION_EXCEPTION_NO_USER("No such user found. Invalid credentials."),
    AUTHENTICATION_EXCEPTION_SYS_ERROR("System error occured "),
    NO_CURRENT_USER_EXCEPTION("No user is login"),
    WRONG_CURRENT_USER_TYPE_EXCEPTION("Wrong user type access."),
    EMPTY_SQL_RESULT("Empty SQL query result."),
    SQL_ERROR_CONNECTION("SQL: Related connection service failed."),
    SQL_NO_RESULT_FOUND("SQL: The last query resulted to empty set."),
    SQL_ERROR_QUERY("SQL: Error query action.");
    private final String msg;

    private ExceptionMsg(String msg) {
        this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

}

Add custom exception messages for the new exceptions created


package com.pedro.fizzbuzz;

/**
 *
 * FizzBuzzMachine it's a little piece of software created to return a String value if some of the next conditions
 * occurs.
 *
 * If the integer passed as argument it's equals to 3 or multiple of 3 FizzBuzzMachine returns Fizz.
 * If the integer passed as argument it's equals to 5 or multiple of 5 FizzBuzzMachine returns Buzz.
 * If the integer passed as argument it's multiple of 3 and 5 FizzBuzzMachine returns FizzBuzz.
 *
 * @author Pedro Vicente Gómez Sánchez.
 */
public class FizzBuzzMachine {

}

package com.pedro.fizzbuzz;

/**
 *
 * FizzBuzzMachine it's a little piece of software created to return a String value if some of the next conditions
 * occurs.
 *
 * If the integer passed as argument it's equals to 3 or multiple of 3 FizzBuzzMachine returns Fizz.
 * If the integer passed as argument it's equals to 5 or multiple of 5 FizzBuzzMachine returns Buzz.
 * If the integer passed as argument it's multiple of 3 and 5 FizzBuzzMachine returns FizzBuzz.
 * If the integer passed as argument isn't multiple of 3 or 5 returns the number.
 *
 * @author Pedro Vicente Gómez Sánchez.
 */
public class FizzBuzzMachine {

    /**
     * Main FizzBuzzMachine method. This method will check if the number passed as parameter is fulfilling the condition
     * and will return the Fizz, Buzz or FizzBuzz value.
     *
     * @param value to analyze.
     * @return
     *      Fizz if the value is multiple of 3
     *      Buzz if the value is multiple of 5
     *      FizzBuzz if the value is multiple of 3 and 5
     *      the value if the parameter isn't multiple of 3 or 5
     */
    public String execute(int value) {
        return null;
    }
}

Add the default case to the documentation


// Copyright 2014, Kevin Ko <kevin@faveset.com>

package com.faveset.khttp;

class HttpRequest {
    public enum Method {
        OPTIONS,
        GET,
        HEAD,
        POST,
        PUT,
        DELETE,
        TRACE,
        CONNECT
    }

    private Method mMethod;

    private String mUri;

    public HttpRequest() {}

    public Method getMethod() {
        return mMethod;
    }

    public String getUri() {
        return mUri;
    }

    public void setMethod(Method method) {
        mMethod = method;
    }

    public void setUri(String uri) {
        mUri = uri;
    }
}

// Copyright 2014, Kevin Ko <kevin@faveset.com>

package com.faveset.khttp;

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

class HttpRequest {
    public enum Method {
        OPTIONS,
        GET,
        HEAD,
        POST,
        PUT,
        DELETE,
        TRACE,
        CONNECT
    }

    private Method mMethod;

    private String mUri;

    private HashMap<String, List<String>> mHeaders;

    public HttpRequest() {
        mHeaders = new HashMap<String, List<String>>();
    }

    /**
     * Appends value to the mapping list for name, creating a mapping if
     * necessary.
     */
    public void appendHeader(String name, String value) {
        List<String> l = mHeaders.get(name);
        if (l == null) {
            l = new ArrayList<String>();
            mHeaders.put(name, l);
        }

        l.add(value);
    }

    public void clearHeaders() {
        mHeaders.clear();
    }

    /**
     * @return The list of values for the header named name or null if it
     * doesn't exist.  The returned list will always have non-zero length.
     */
    public List<String> getHeader(String name) {
        return mHeaders.get(name);
    }

    /**
     * Convenience method for returning the first header value or null if no
     * mapping exists.
     */
    public String getHeaderFirst(String name) {
        List<String> l = mHeaders.get(name);
        if (l == null) {
            return null;
        }
        return l.get(0);
    }

    public Method getMethod() {
        return mMethod;
    }

    public String getUri() {
        return mUri;
    }

    /**
     * Assigns value to the mapping for name.  This clears any existing list
     * values.
     */
    public void setHeader(String name, String value) {
        List<String> l = new ArrayList<String>();
        l.add(value);

        mHeaders.put(name, l);
    }

    /**
     * Assigns value to the mapping for name.  This overwrites any existing
     * mapping.
     */
    public void setHeaderList(String name, List<String> values) {
        mHeaders.put(name, values);
    }

    public void setMethod(Method method) {
        mMethod = method;
    }

    public void setUri(String uri) {
        mUri = uri;
    }
}

Add header storage and manipulation methods.


package net.stack3.buttonsample;

import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_activity);

        Button button1 = (Button)findViewById(R.id.normal_button);
        button1.setOnClickListener(normalButtonOnClickListener);
    }

    private OnClickListener normalButtonOnClickListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            Button button1 = (Button)v;
            button1.setText(R.string.clicked);
        }
    };

}

package net.stack3.buttonsample;

import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_activity);

        Button normalButton = (Button)findViewById(R.id.normal_button);
        normalButton.setOnClickListener(normalButtonOnClickListener);
    }

    private OnClickListener normalButtonOnClickListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            Button normalButton = (Button)v;
            normalButton.setText(R.string.clicked);
        }
    };

}

Rename variable button1 to normalButton.


package bestcoders.library.services.helpers;

import java.util.stream.Stream;

import bestcoders.library.Library;
import bestcoders.library.loans.LoanRecord;
import bestcoders.library.loans.LoanState;
import bestcoders.library.members.LibraryMember;

public class LibraryStreams {

    private final Library library;

    public LibraryStreams(final Library library) {
	this.library = library;
    }

    public Stream<LoanRecord> getLoansForMember(final Stream<LoanRecord> s, final LibraryMember m) {
	return s.filter(lr -> lr.getMember().equals(m));
    }

    Stream<LoanRecord> getLoansStream() {
	return library.getLoans().stream();
    }

    public Stream<LoanRecord> getOpenLoansStream() {
	return getLoansStream().filter(lr -> lr.getState() == LoanState.OPEN);
    }

}

package bestcoders.library.services.helpers;

import java.util.stream.Stream;

import bestcoders.library.Library;
import bestcoders.library.loans.LoanRecord;
import bestcoders.library.loans.LoanState;
import bestcoders.library.members.LibraryMember;

public class LibraryStreams {

    private final Library library;

    public LibraryStreams(final Library library) {
	this.library = library;
    }

    public Stream<LoanRecord> getLoansForMember(final Stream<LoanRecord> s, final LibraryMember m) {
	return s.filter(lr -> lr != null && lr.getMember().equals(m));
    }

    Stream<LoanRecord> getLoansStream() {
	return library.getLoans().stream();
    }

    public Stream<LoanRecord> getOpenLoansStream() {
	return getLoansStream().filter(lr -> lr != null && lr.getState() == LoanState.OPEN);
    }

}

Add null protection for loan records.


package org.sphinx;

import org.sphinx.api.ISphinxClient;
import org.sphinx.api.SphinxResult;
import org.sphinx.pool.PooledSphinxDataSource;
import org.testng.annotations.Test;

import static org.testng.Assert.*;

/**
 * SphinxQueryTest
 *
 * @author Brian Cowdery
 * @since 29-05-2015
 */
@Test(enabled = false, description = "Live integration test, not part of automated test suite.")
public class SphinxQueryTest {

    @Test
    public void testSphinxQuery() throws Exception {
        PooledSphinxDataSource dataSource = new PooledSphinxDataSource();
        dataSource.setHost("190.10.14.168");
        dataSource.setPort(9312);
        dataSource.setTestOnBorrow(true);
        dataSource.setTestOnReturn(true);
        dataSource.setMinIdle(0);
        dataSource.setMaxIdle(8);
        dataSource.setMaxTotal(8);

        ISphinxClient client = dataSource.getSphinxClient();
        assertNotNull(client);

        SphinxResult result = client.Query("SELECT name, postdate FROM releases WHERE MATCH('Futurama')");
        assertNotNull(result);
    }
}

package org.sphinx;

import org.sphinx.api.ISphinxClient;
import org.sphinx.api.SphinxResult;
import org.sphinx.pool.PooledSphinxDataSource;
import org.testng.annotations.Test;

import static org.testng.Assert.*;

/**
 * SphinxQueryTest
 *
 * @author Brian Cowdery
 * @since 29-05-2015
 */
@Test(enabled = false, description = "Live integration test, not part of automated test suite.")
public class SphinxQueryTest {
/*
    @Test
    public void testSphinxQuery() throws Exception {
        PooledSphinxDataSource dataSource = new PooledSphinxDataSource();
        dataSource.setHost("190.10.14.168");
        dataSource.setPort(9312);
        dataSource.setTestOnBorrow(true);
        dataSource.setTestOnReturn(true);
        dataSource.setMinIdle(0);
        dataSource.setMaxIdle(8);
        dataSource.setMaxTotal(8);

        ISphinxClient client = dataSource.getSphinxClient();
        assertNotNull(client);

        SphinxResult result = client.Query("SELECT name, postdate FROM releases WHERE MATCH('Futurama')");
        assertNotNull(result);
    }
*/
}

Comment out sphinx test. maven is ignoring eanbled=false


package se.vandmo.textchecker.maven;

import static java.util.Arrays.asList;

import java.io.File;
import java.util.Collection;

import se.vandmo.textchecker.maven.rules.ConsistentLineSeparator;
import se.vandmo.textchecker.maven.rules.EndsWithLineSeparator;
import se.vandmo.textchecker.maven.rules.NoTabs;
import se.vandmo.textchecker.maven.rules.NoTrailingWhitespaceOnNonBlankLines;
import se.vandmo.textchecker.maven.rules.NoWhitespaceOnBlankLines;
import se.vandmo.textchecker.maven.rules.NotExecutable;

public final class RulesResolver {

  public Collection<Rule> getRulesFor(File file) {
    return asList(
      new NoTabs(),
      new NoTrailingWhitespaceOnNonBlankLines(),
      new NoWhitespaceOnBlankLines(),
      new NotExecutable(),
      new ConsistentLineSeparator(),
      new EndsWithLineSeparator());
  }

}

package se.vandmo.textchecker.maven;

import static java.util.Arrays.asList;

import java.io.File;
import java.util.Collection;

import se.vandmo.textchecker.maven.rules.ConsistentLineSeparator;
import se.vandmo.textchecker.maven.rules.EndsWithLineSeparator;
import se.vandmo.textchecker.maven.rules.NoTabs;
import se.vandmo.textchecker.maven.rules.NoTrailingWhitespaceOnNonBlankLines;
import se.vandmo.textchecker.maven.rules.NoWhitespaceOnBlankLines;

public final class RulesResolver {

  public Collection<Rule> getRulesFor(File file) {
    return asList(
      new NoTabs(),
      new NoTrailingWhitespaceOnNonBlankLines(),
      new NoWhitespaceOnBlankLines(),
      new ConsistentLineSeparator(),
      new EndsWithLineSeparator());
  }

}

Remove NotExecutable check, bad on Windows


package com.thaiopensource.resolver;

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

/**
 *
 */
public class BasicResolver implements Resolver {
  static private final BasicResolver theInstance = new BasicResolver();

  protected BasicResolver() {
  }

  public static BasicResolver getInstance() {
    return theInstance;
  }

  public void resolve(Identifier id, Input input) throws IOException, ResolverException {
    if (!input.isResolved())
      input.setUri(resolveUri(id));
  }

  public void open(Input input) throws IOException, ResolverException {
    if (!input.isUriDefinitive())
      return;
    URI uri;
    try {
      uri = new URI(input.getUri());
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
    if (!uri.isAbsolute())
      throw new ResolverException("cannot open relative URI: " + uri);
    URL url = new URL(uri.toASCIIString());
    // XXX should set the encoding properly
    input.setByteStream(url.openStream());
  }

  public static String resolveUri(Identifier id) throws ResolverException {
    try {
      URI uri = new URI(id.getUriReference());
      String base = id.getBase();
      if (base != null)
        uri = new URI(base).resolve(uri);
      return uri.toString();
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
  }
}

package com.thaiopensource.resolver;

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

/**
 *
 */
public class BasicResolver implements Resolver {
  static private final BasicResolver theInstance = new BasicResolver();

  protected BasicResolver() {
  }

  public static BasicResolver getInstance() {
    return theInstance;
  }

  public void resolve(Identifier id, Input input) throws IOException, ResolverException {
    if (!input.isResolved())
      input.setUri(resolveUri(id));
  }

  public void open(Input input) throws IOException, ResolverException {
    if (!input.isUriDefinitive())
      return;
    URI uri;
    try {
      uri = new URI(input.getUri());
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
    if (!uri.isAbsolute())
      throw new ResolverException("cannot open relative URI: " + uri);
    URL url = new URL(uri.toASCIIString());
    // XXX should set the encoding properly
    // XXX if this is HTTP and we've been redirected, should do input.setURI with the new URI
    input.setByteStream(url.openStream());
  }

  public static String resolveUri(Identifier id) throws ResolverException {
    try {
      URI uri = new URI(id.getUriReference());
      String base = id.getBase();
      if (base != null)
        uri = new URI(base).resolve(uri);
      return uri.toString();
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
  }
}

Add note that we need to handle HTTP redirection


package com.seoz.sunshine;

import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * A placeholder fragment containing a simple view.
 */
public class MainActivityFragment extends Fragment {

    public MainActivityFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_main, container, false);
    }
}

package com.seoz.sunshine;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

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

/**
 * A placeholder fragment containing a simple view.
 */
public class MainActivityFragment extends Fragment {

    ArrayAdapter<String> mForecastAdapter;

    public MainActivityFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View rootView = inflater.inflate(R.layout.fragment_main, container, false);

        String[] data = {
                "Mon 6/23 - Sunny - 31/17",
                "Tue 6/24 - Foggy - 21/8",
                "Wed 6/25 - Cloudy - 22/17",
                "Thurs 6/26 - Rainy - 18/11",
                "Fri 6/27 - Foggy - 21/10",
                "Sat 6/28 - TRAPPED IN WEATHERSTATION - 23/18",
                "Sun 6/29 - Sunny - 20/7"
        };
        List<String> weekForecast = new ArrayList<String>(Arrays.asList(data));

        ArrayAdapter<String> mForecastAdapter =
                new ArrayAdapter<String>(
                        getActivity(), // The current context (this activity)
                        R.layout.list_item_forecast, // The name of the layout ID.
                        R.id.list_item_forecast_textview, // The ID of the textview to populate.
                        weekForecast);

        // Get a reference to the ListView, and attach this adapter to it.
        ListView listView = (ListView) rootView.findViewById(R.id.listview_forecast);
        listView.setAdapter(mForecastAdapter);

        return rootView;
    }
}

Add a ListView with dummy data.


package com.fasterxml.jackson.databind.node;

import com.fasterxml.jackson.databind.*;

public class TestJsonPointer
    extends BaseMapTest
{
    // !!! TODO
}

package com.fasterxml.jackson.databind.node;

import com.fasterxml.jackson.databind.*;

public class TestJsonPointer
    extends BaseMapTest
{
    // !!! TODO
    public void testIt() { }
}

Add a bogus method in otherwise empty test, to prevent build breakage


package com.infonuascape.osrshelper.tracker.rt;

import com.infonuascape.osrshelper.tracker.TrackerTimeEnum;
import com.infonuascape.osrshelper.utils.exceptions.ParserErrorException;
import com.infonuascape.osrshelper.utils.exceptions.PlayerNotFoundException;
import com.infonuascape.osrshelper.utils.players.PlayerSkills;

public class TrackerHelper {
	String userName = null;

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserName() {
		return userName;
	}

	public PlayerSkills getPlayerStats() throws PlayerNotFoundException, ParserErrorException {
		TrackerFetcher tf = new TrackerFetcher(getUserName(), TrackerTimeEnum.TrackerTime.Day);
		return tf.getPlayerTracker();
	}

	public PlayerSkills getPlayerStats(TrackerTimeEnum.TrackerTime time) throws PlayerNotFoundException,
			ParserErrorException {
		TrackerFetcher tf = new TrackerFetcher(getUserName(), time);
		return tf.getPlayerTracker();
	}

}

package com.infonuascape.osrshelper.tracker.rt;

import com.infonuascape.osrshelper.tracker.TrackerTimeEnum;
import com.infonuascape.osrshelper.utils.exceptions.APIError;
import com.infonuascape.osrshelper.utils.exceptions.ParserErrorException;
import com.infonuascape.osrshelper.utils.exceptions.PlayerNotFoundException;
import com.infonuascape.osrshelper.utils.players.PlayerSkills;

public class TrackerHelper {
	String userName = null;

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserName() {
		return userName;
	}

	public PlayerSkills getPlayerStats() throws PlayerNotFoundException, ParserErrorException, APIError {
		TrackerFetcher tf = new TrackerFetcher(getUserName(), TrackerTimeEnum.TrackerTime.Day);
		return tf.getPlayerTracker();
	}

	public PlayerSkills getPlayerStats(TrackerTimeEnum.TrackerTime time) throws PlayerNotFoundException,
			ParserErrorException, APIError {
		TrackerFetcher tf = new TrackerFetcher(getUserName(), time);
		return tf.getPlayerTracker();
	}

}

Use APIError over ParseError to display proper errors


package ch.ethz.scu.obit.common.version;

public class VersionInfo {

	// Program version
	public static final String version = "0.5.8";

	// Version status: "alpha", "beta", or "" for a stable release
	public static final String status = "";

	// Copyright string
	public static final String copyright = "Copyright " +
			Character.toString('\u00A9') +
			" 2012 - 2015, Single Cell Unit, " +
			"D-BSSE, ETH Zurich (Basel)";

	// Properties (XML) file version
	public static final int propertiesVersion = 4;

}

package ch.ethz.scu.obit.common.version;

public class VersionInfo {

	// Program version
	public static final String version = "0.6.0";

	// Version status: "alpha", "beta", or "" for a stable release
	public static final String status = "beta";

	// Copyright string
	public static final String copyright = "Copyright " +
			Character.toString('\u00A9') +
			" 2012 - 2015, Single Cell Unit, " +
			"D-BSSE, ETH Zurich (Basel)";

	// Properties (XML) file version
	public static final int propertiesVersion = 4;

}

Increase version to 0.6.0 beta.


package liquibase.datatype.core;

import liquibase.database.Database;
import liquibase.database.core.DerbyDatabase;
import liquibase.database.core.MSSQLDatabase;
import liquibase.database.core.OracleDatabase;
import liquibase.database.core.PostgresDatabase;
import liquibase.datatype.DataTypeInfo;
import liquibase.datatype.DatabaseDataType;
import liquibase.datatype.LiquibaseDataType;

@DataTypeInfo(name="tinyint", aliases = "java.sql.Types.TINYINT", minParameters = 0, maxParameters = 1, priority = LiquibaseDataType.PRIORITY_DEFAULT)
public class TinyIntType  extends LiquibaseDataType {

    private boolean autoIncrement;

    public boolean isAutoIncrement() {
        return autoIncrement;
    }

    public void setAutoIncrement(boolean autoIncrement) {
        this.autoIncrement = autoIncrement;
    }

    @Override
    public DatabaseDataType toDatabaseDataType(Database database) {
        if (database instanceof DerbyDatabase || database instanceof PostgresDatabase) {
            return new DatabaseDataType("SMALLINT");
        }
        if (database instanceof MSSQLDatabase) {
            return new DatabaseDataType("TINYINT");
        }
        if (database instanceof OracleDatabase) {
            return new DatabaseDataType("NUMBER",3);
        }
        return super.toDatabaseDataType(database);
    }
}

package liquibase.datatype.core;

import liquibase.database.Database;
import liquibase.database.core.DerbyDatabase;
import liquibase.database.core.MSSQLDatabase;
import liquibase.database.core.OracleDatabase;
import liquibase.database.core.PostgresDatabase;
import liquibase.datatype.DataTypeInfo;
import liquibase.datatype.DatabaseDataType;
import liquibase.datatype.LiquibaseDataType;

@DataTypeInfo(name="tinyint", aliases = "java.sql.Types.TINYINT", minParameters = 0, maxParameters = 1, priority = LiquibaseDataType.PRIORITY_DEFAULT)
public class TinyIntType  extends LiquibaseDataType {

    private boolean autoIncrement;

    public boolean isAutoIncrement() {
        return autoIncrement;
    }

    public void setAutoIncrement(boolean autoIncrement) {
        this.autoIncrement = autoIncrement;
    }

    @Override
    public DatabaseDataType toDatabaseDataType(Database database) {
        if (database instanceof DerbyDatabase || database instanceof PostgresDatabase || database instanceof FirebirdDatabase) {
            return new DatabaseDataType("SMALLINT");
        }
        if (database instanceof MSSQLDatabase) {
            return new DatabaseDataType("TINYINT");
        }
        if (database instanceof OracleDatabase) {
            return new DatabaseDataType("NUMBER",3);
        }
        return super.toDatabaseDataType(database);
    }
}

Use smallint for Firebird if tinyint is requested


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

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

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

import static org.junit.Assert.*;

/**
 * Instrumentation test, which will execute on an Android device.
 *
 * @see Testing documentation
 */
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
    @Test
    public void useAppContext() throws Exception {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getTargetContext();

        assertEquals("com.cliabhach.emptyhusk", appContext.getPackageName());
    }
}

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

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

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

import static org.junit.Assert.*;

/**
 * Instrumentation test, which will execute on an Android device.
 *
 * @see Testing documentation
 */
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
    @Test
    public void useAppContext() throws Exception {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getTargetContext();

        assertEquals("com.fuzz.emptyhusk", appContext.getPackageName());
    }
}

Correct an app name reference in an example test


package org.wikipedia.interlanguage;

import android.support.annotation.NonNull;

public final class AcceptLanguageUtil {
    private static final float APP_LANGUAGE_QUALITY = .9f;
    private static final float SYSTEM_LANGUAGE_QUALITY = .8f;

    /**
     * @return The value that should go in the Accept-Language header.
     */
    @NonNull
    public static String getAcceptLanguage(@NonNull String siteLanguageCode,
                                           @NonNull String appLanguageCode,
                                           @NonNull String systemLanguageCode) {
        String acceptLanguage = siteLanguageCode;
        acceptLanguage = appendToAcceptLanguage(acceptLanguage, appLanguageCode, APP_LANGUAGE_QUALITY);
        acceptLanguage = appendToAcceptLanguage(acceptLanguage, systemLanguageCode, SYSTEM_LANGUAGE_QUALITY);
        return acceptLanguage;
    }

    @NonNull
    private static String appendToAcceptLanguage(@NonNull String acceptLanguage,
                                                 @NonNull String languageCode, float quality) {
        // If accept-language already contains the language, just return accept-language.
        if (acceptLanguage.contains(languageCode)) {
            return acceptLanguage;
        }

        // If accept-language is empty, don't append. Just return the language.
        if (acceptLanguage.isEmpty()) {
            return languageCode;
        }

        // Accept-language is nonempty, append the language.
        return String.format("%s,%s;q=%.1f", acceptLanguage, languageCode, quality);
    }

    private AcceptLanguageUtil() { }
}

package org.wikipedia.interlanguage;

import android.support.annotation.NonNull;

import java.util.Locale;

public final class AcceptLanguageUtil {
    private static final float APP_LANGUAGE_QUALITY = .9f;
    private static final float SYSTEM_LANGUAGE_QUALITY = .8f;

    /**
     * @return The value that should go in the Accept-Language header.
     */
    @NonNull
    public static String getAcceptLanguage(@NonNull String siteLanguageCode,
                                           @NonNull String appLanguageCode,
                                           @NonNull String systemLanguageCode) {
        String acceptLanguage = siteLanguageCode;
        acceptLanguage = appendToAcceptLanguage(acceptLanguage, appLanguageCode, APP_LANGUAGE_QUALITY);
        acceptLanguage = appendToAcceptLanguage(acceptLanguage, systemLanguageCode, SYSTEM_LANGUAGE_QUALITY);
        return acceptLanguage;
    }

    @NonNull
    private static String appendToAcceptLanguage(@NonNull String acceptLanguage,
                                                 @NonNull String languageCode, float quality) {
        // If accept-language already contains the language, just return accept-language.
        if (acceptLanguage.contains(languageCode)) {
            return acceptLanguage;
        }

        // If accept-language is empty, don't append. Just return the language.
        if (acceptLanguage.isEmpty()) {
            return languageCode;
        }

        // Accept-language is nonempty, append the language.
        return String.format(Locale.ROOT, "%s,%s;q=%.1f", acceptLanguage, languageCode, quality);
    }

    private AcceptLanguageUtil() { }
}

Fix issue with Accept-Language header for certain system languages.


package xyz.igorgee.shapejs;

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

import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class ShapeJS {

    private static final MediaType MEDIA_TYPE_JPG = MediaType.parse("image/jpg");
    private static final String ENDPOINT = "http://52.90.86.247/image";
    public static final String SHAPE_JS_IMAGE_KEY = "shapeJS_img";

    private final OkHttpClient client = new OkHttpClient.Builder()
            .readTimeout(20, TimeUnit.SECONDS)
            .build();

    public InputStream uploadImage(File image) throws IOException {
        RequestBody requestBody = new MultipartBody.Builder()
                .setType(MultipartBody.FORM)
                .addFormDataPart(SHAPE_JS_IMAGE_KEY, image.getName(),
                        RequestBody.create(MEDIA_TYPE_JPG, image))
                .build();

        Request request = new Request.Builder()
                .url(ENDPOINT)
                .post(requestBody)
                .build();

        Response response = client.newCall(request).execute();

        if (!response.isSuccessful()) throw new IOException("Unsuccessful response");

        return response.body().byteStream();
    }
}

package xyz.igorgee.shapejs;

import android.util.Log;

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

import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class ShapeJS {

    private static final MediaType MEDIA_TYPE_JPG = MediaType.parse("image/jpg");
    private static final String ENDPOINT = "http://52.90.86.247/image";
    public static final String SHAPE_JS_IMAGE_KEY = "shapeJS_img";

    private final OkHttpClient client = new OkHttpClient.Builder()
            .readTimeout(20, TimeUnit.SECONDS)
            .build();

    public InputStream uploadImage(File image) throws IOException {
        RequestBody requestBody = new MultipartBody.Builder()
                .setType(MultipartBody.FORM)
                .addFormDataPart(SHAPE_JS_IMAGE_KEY, image.getName(),
                        RequestBody.create(MEDIA_TYPE_JPG, image))
                .build();

        Request request = new Request.Builder()
                .url(ENDPOINT)
                .post(requestBody)
                .build();

        Response response = client.newCall(request).execute();

        Log.d("RESPONSE HEAD", String.valueOf(response.code()));
        Log.d("RESPONSE MESSAGE", response.message());

        if (!response.isSuccessful()) throw new IOException("Unsuccessful response");
        return response.body().byteStream();
    }
}

Add response logging for upload of image


package de.xikolo.models;

import com.squareup.moshi.Json;

import de.xikolo.models.base.RealmAdapter;
import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;
import moe.banana.jsonapi2.JsonApi;
import moe.banana.jsonapi2.Resource;

public class Quiz extends RealmObject {

    @PrimaryKey
    public String id;

    public String instructions;

    public int timeLimit;

    public int allowedAttempts;

    public boolean showWelcomePage;

    @JsonApi(type = "quizzes")
    public static class JsonModel extends Resource implements RealmAdapter<Quiz> {

        public String instructions;

        @Json(name = "time_limit")
        public int timeLimit;

        @Json(name = "allowed_attempts")
        public int allowedAttempts;

        @Json(name = "max_points")
        public int maxPoints;

        @Json(name = "show_welcome_page")
        public boolean showWelcomePage;

        @Override
        public Quiz convertToRealmObject() {
            Quiz quiz = new Quiz();
            quiz.id = getId();
            quiz.instructions = instructions;
            quiz.timeLimit = timeLimit;
            quiz.allowedAttempts = allowedAttempts;
            quiz.showWelcomePage = showWelcomePage;

            return quiz;
        }

    }

}

package de.xikolo.models;

import com.squareup.moshi.Json;

import de.xikolo.models.base.RealmAdapter;
import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;
import moe.banana.jsonapi2.JsonApi;
import moe.banana.jsonapi2.Resource;

public class Quiz extends RealmObject {

    @PrimaryKey
    public String id;

    public String instructions;

    public int timeLimit;

    public int allowedAttempts;

    public boolean showWelcomePage;

    @JsonApi(type = "quizzes")
    public static class JsonModel extends Resource implements RealmAdapter<Quiz> {

        public String instructions;

        @Json(name = "time_limit")
        public int timeLimit;

        @Json(name = "allowed_attempts")
        public int allowedAttempts;

        @Json(name = "show_welcome_page")
        public boolean showWelcomePage;

        @Override
        public Quiz convertToRealmObject() {
            Quiz quiz = new Quiz();
            quiz.id = getId();
            quiz.instructions = instructions;
            quiz.timeLimit = timeLimit;
            quiz.allowedAttempts = allowedAttempts;
            quiz.showWelcomePage = showWelcomePage;

            return quiz;
        }

    }

}

Remove leftover from APIv4 migration


package com.kickstarter.libs;

import android.os.Parcelable;
import android.support.annotation.Nullable;

import org.joda.time.DateTime;

import auto.parcel.AutoParcel;

@AutoParcel
public abstract class RelativeDateOptions implements Parcelable {
  public abstract boolean abbreviated();
  public abstract boolean absolute();
  public abstract @Nullable DateTime relativeToDateTime();
  public abstract int threshold();

  @AutoParcel.Builder
  public abstract static class Builder {
    public abstract Builder abbreviated(boolean __);
    public abstract Builder absolute(boolean __);
    public abstract Builder relativeToDateTime(DateTime __);
    public abstract Builder threshold(int __);
    public abstract RelativeDateOptions build();
  }

  public static Builder builder() {
    return new AutoParcel_RelativeDateOptions.Builder()
      .abbreviated(false)
      .absolute(false)
      .threshold(THIRTY_DAYS_IN_SECONDS);
  }

  public abstract Builder toBuilder();

  private final static int THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30;
}

package com.kickstarter.libs;

import android.os.Parcelable;
import android.support.annotation.Nullable;

import org.joda.time.DateTime;

import auto.parcel.AutoParcel;

@AutoParcel
public abstract class RelativeDateOptions implements Parcelable {
  // Abbreviates string, e.g.: "in 1 hr"
  public abstract boolean abbreviated();

  // Don't output tense, e.g.: "1 hour" instead of "in 1 hour"
  public abstract boolean absolute();

  // Compare against this date instead of the current time
  public abstract @Nullable DateTime relativeToDateTime();

  // Number of seconds difference permitted before an attempt to describe the relative date is abandoned.
  // For example, "738 days ago" is not helpful to users. The threshold defaults to 30 days.
  public abstract int threshold();

  @AutoParcel.Builder
  public abstract static class Builder {
    public abstract Builder abbreviated(boolean __);
    public abstract Builder absolute(boolean __);
    public abstract Builder relativeToDateTime(DateTime __);
    public abstract Builder threshold(int __);
    public abstract RelativeDateOptions build();
  }

  public static Builder builder() {
    return new AutoParcel_RelativeDateOptions.Builder()
      .abbreviated(false)
      .absolute(false)
      .threshold(THIRTY_DAYS_IN_SECONDS);
  }

  public abstract Builder toBuilder();

  private final static int THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30;
}

Add comments explaining relative date options