package com.mapzen.android.sample;

import com.mapzen.android.MapFragment;
import com.mapzen.android.MapManager;
import com.mapzen.tangram.MapController;

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

/**
 * Basic SDK demo, tracks user's current location on map.
 */
public class BasicMapzenActivity extends AppCompatActivity {

    MapFragment mapFragment;
    MapController mapController;
    MapManager mapManager;

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

        mapFragment = (MapFragment) getSupportFragmentManager().findFragmentById(R.id.fragment);
        mapController = mapFragment.getMap();
        mapManager = mapFragment.getMapManager();
        configureMap();
    }

    private void configureMap() {
        mapController.setMapZoom(17);
        mapManager.setMyLocationEnabled(true);
    }
}

package com.mapzen.android.sample;

import com.mapzen.android.MapFragment;
import com.mapzen.android.MapManager;
import com.mapzen.tangram.MapController;
import com.mapzen.tangram.MapView;

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

/**
 * Basic SDK demo, tracks user's current location on map.
 */
public class BasicMapzenActivity extends AppCompatActivity {

    MapFragment mapFragment;
    MapController mapController;
    MapManager mapManager;

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

        mapFragment = (MapFragment) getSupportFragmentManager().findFragmentById(R.id.fragment);
        mapFragment.getMapAsync(new MapView.OnMapReadyCallback() {
            @Override public void onMapReady(MapController mapController) {
                BasicMapzenActivity.this.mapController = mapController;
                configureMap();
            }
        });
    }

    private void configureMap() {
        mapManager = mapFragment.getMapManager();
        mapManager.setMyLocationEnabled(true);
    }
}

Use getMapAsync, original file was renamed


package com.nikolavp.approval.reporters;

import com.nikolavp.approval.Approval;
import org.junit.Assume;
import org.junit.Test;

import java.awt.*;
import java.nio.file.FileSystems;

/**
 *
 * User: nikolavp
 * Date: 26/02/14
 * Time: 14:28
 */

public class ReportersExamplesIT {

    @Test
    public void testGvimApprovalProcess() throws Exception {
        Assume.assumeTrue(Desktop.isDesktopSupported());
        Approval approval = new Approval(Reporters.gvim());

        approval.verify("some test content".getBytes(), FileSystems.getDefault().getPath("target", "verifications", "testGvimApprovalProcess.txt"));
    }

    @Test
    public void testConsoleApprovalProcess() throws Exception {
        Assume.assumeTrue(Desktop.isDesktopSupported());
        Approval approval = new Approval(Reporters.console());
        approval.verify("some test content".getBytes(), FileSystems.getDefault().getPath("target", "verifications", "testConsoleApprovalProcess.txt"));
    }

    @Test
    public void testGeditApprovalProcess() throws Exception {
        Assume.assumeTrue(Desktop.isDesktopSupported());
        Approval approval = new Approval(Reporters.gedit());
        approval.verify("some test content".getBytes(), FileSystems.getDefault().getPath("target", "verifications", "testGeditApprovalProcess.txt"));
    }
}

package com.nikolavp.approval.reporters;

import com.nikolavp.approval.Approval;
import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;

import java.awt.*;
import java.nio.file.FileSystems;

/**
 *
 * User: nikolavp
 * Date: 26/02/14
 * Time: 14:28
 */
@Ignore
public class ReportersExamplesIT {

    @Test
    public void testGvimApprovalProcess() throws Exception {
        Assume.assumeTrue(Desktop.isDesktopSupported());
        Approval approval = new Approval(Reporters.gvim());

        approval.verify("some test content\n".getBytes(), FileSystems.getDefault().getPath("target", "verifications", "testGvimApprovalProcess.txt"));
    }

    @Test
    public void testConsoleApprovalProcess() throws Exception {
        Assume.assumeTrue(Desktop.isDesktopSupported());
        Approval approval = new Approval(Reporters.console());
        approval.verify("some test content\n".getBytes(), FileSystems.getDefault().getPath("target", "verifications", "testConsoleApprovalProcess.txt"));
    }

    @Test
    public void testGeditApprovalProcess() throws Exception {
        Assume.assumeTrue(Desktop.isDesktopSupported());
        Approval approval = new Approval(Reporters.gedit());
        approval.verify("some test content\n".getBytes(), FileSystems.getDefault().getPath("target", "verifications", "testGeditApprovalProcess.txt"));
    }
}

Add new lines here because they are added by some editors(vim for example)


package com.projectning.service.exceptions;

import com.projectning.util.ErrorMessage;

@SuppressWarnings("serial")
public class NotFoundException extends SdkException
{
  private NotFoundExceptionType typeNotFound = NotFoundExceptionType.NOT_SPECIFIED;

  // TODO: Could modify message to prepend with typeNotFound.toString()
  public NotFoundException()
  {
    super(ErrorMessage.UNKNOWN_ERROR.getMsg());
  }

  public NotFoundException(NotFoundExceptionType typeNotFound)
  {
    super();
    this.typeNotFound = typeNotFound;
  }

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

  public NotFoundException(NotFoundExceptionType typeNotFound, String message)
  {
    super(message);

    this.typeNotFound = typeNotFound;
  }

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

  public NotFoundException(NotFoundExceptionType typeNotFound, Throwable cause)
  {
    super(cause);
    this.typeNotFound = typeNotFound;
  }

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

  public NotFoundException(NotFoundExceptionType typeNotFound, String message, Throwable cause)
  {
    super(message, cause);
    this.typeNotFound = typeNotFound;
  }

  public NotFoundExceptionType getType()
  {
    return this.typeNotFound;
  }

  @Override
  public String getMessage()
  {
    return this.typeNotFound.toString() + ": " + super.getMessage();
  }
}

package com.projectning.service.exceptions;

import com.projectning.util.ErrorMessage;

@SuppressWarnings("serial")
public class NotFoundException extends SdkException
{
  private NotFoundExceptionType typeNotFound = NotFoundExceptionType.NOT_SPECIFIED;

  // TODO: Could modify message to prepend with typeNotFound.toString()
  public NotFoundException()
  {
    super(ErrorMessage.UNKNOWN_ERROR.getMsg());
  }

  public NotFoundException(NotFoundExceptionType typeNotFound)
  {
    super();
    this.typeNotFound = typeNotFound;
  }

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

  public NotFoundException(NotFoundExceptionType typeNotFound, String message)
  {
    super(message);

    this.typeNotFound = typeNotFound;
  }

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

  public NotFoundException(NotFoundExceptionType typeNotFound, Throwable cause)
  {
    super(cause);
    this.typeNotFound = typeNotFound;
  }

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

  public NotFoundException(NotFoundExceptionType typeNotFound, String message, Throwable cause)
  {
    super(message, cause);
    this.typeNotFound = typeNotFound;
  }

  public NotFoundExceptionType getType()
  {
    return this.typeNotFound;
  }

  /*
  @Override
  public String getMessage()
  {
    return this.typeNotFound.toString() + ": " + super.getMessage();
  }
  */
}

Comment out method that put extra string into error message


package com.edinarobotics.zed.commands;

public class FixedPointVisionTrackingCommand extends VisionTrackingCommand {
    private double fixedXSetpoint;
    private double fixedYSetpoint;

    public FixedPointVisionTrackingCommand(double xSetpoint, double ySetpoint) {
        super();
        this.fixedXSetpoint = xSetpoint;
        this.fixedYSetpoint = ySetpoint;
    }

    public FixedPointVisionTrackingCommand(double xSetpoint, double ySetpoint, byte goalType) {
        super(goalType);
        this.fixedXSetpoint = xSetpoint;
        this.fixedYSetpoint = ySetpoint;
    }

    protected double getXSetpoint(double distance) {
        return fixedXSetpoint;
    }

    protected double getYSetpoint(double distance) {
        return fixedYSetpoint;
    }
}

package com.edinarobotics.zed.commands;

public class FixedPointVisionTrackingCommand extends VisionTrackingCommand {
    private double fixedXSetpoint;
    private double fixedYSetpoint;

    public static final double PYRAMID_BACK_MIDDLE_X = 0.0273556;
    public static final double PYRAMID_BACK_MIDDLE_Y = -0.29411;
    public static final double PYRAMID_BACK_RIGHT_X = -0.063829;
    public static final double PYRAMID_BACK_RIGHT_Y = -0.226891;

    public FixedPointVisionTrackingCommand(double xSetpoint, double ySetpoint) {
        super();
        this.fixedXSetpoint = xSetpoint;
        this.fixedYSetpoint = ySetpoint;
    }

    public FixedPointVisionTrackingCommand(double xSetpoint, double ySetpoint, byte goalType) {
        super(goalType);
        this.fixedXSetpoint = xSetpoint;
        this.fixedYSetpoint = ySetpoint;
    }

    protected double getXSetpoint(double distance) {
        return fixedXSetpoint;
    }

    protected double getYSetpoint(double distance) {
        return fixedYSetpoint;
    }
}

Add fixed vision tracking point constants to the fixed point command.

These constants make it possible to centralize the coordinates used
for fixed point vision tracking.


package org.opennms.netmgt.vulnscand;

import junit.framework.TestCase;

import org.opennms.core.queue.FifoQueue;
import org.opennms.core.queue.FifoQueueImpl;
import org.opennms.netmgt.config.VulnscandConfigFactory;

public class SchedulerTest extends TestCase {

	protected void setUp() throws Exception {

		System.setProperty("opennms.home", "src/test/test-configurations/vulnscand");

		VulnscandConfigFactory.init();

		super.setUp();

	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void FIXMEtestCreate() throws Exception {
		FifoQueue q = new FifoQueueImpl();
		Scheduler scheduler = new Scheduler(q);
		Vulnscand vulnscand = null;
		vulnscand.initialize();

	}

}

package org.opennms.netmgt.vulnscand;

import junit.framework.TestCase;

import org.opennms.core.queue.FifoQueue;
import org.opennms.core.queue.FifoQueueImpl;
import org.opennms.netmgt.config.VulnscandConfigFactory;

public class SchedulerTest extends TestCase {

	protected void setUp() throws Exception {

		System.setProperty("opennms.home", "src/test/test-configurations/vulnscand");

		VulnscandConfigFactory.init();

		super.setUp();

	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

    // FIXME
	public void FIXMEtestCreate() throws Exception {
		FifoQueue q = new FifoQueueImpl();
		Scheduler scheduler = new Scheduler(q);
		Vulnscand vulnscand = null;
		vulnscand.initialize();

	}

}

Add a "FIXME" comment for the disabled test so it shows up as a note in Eclipse (this idea was suggested awhile ago by brozow).


package com.pspdfkit.vangogh.api;

import com.pspdfkit.vangogh.rx.AnimationCompletable;
import io.reactivex.Completable;

/**
 * Class containing convenient animation scheduling methods.
 */
public final class AnimationSchedulers {

    /**
     * Animates given animations at the same time.
     * @param animations Animation to execute together.
     * @return Completable finishing once the last animation is completed.
     */
    public static Completable together(AnimationCompletable... animations) {
        return Completable.mergeArray(animations);
    }

    /**
     * Animates given animations one after another
     * @param animations Animation to execute sequentially.
     * @return Completable finishing once the last animation is completed.
     */
    public static Completable sequentially(AnimationCompletable... animations) {
        return Completable.concatArray(animations);
    }

}

package com.pspdfkit.vangogh.api;

import com.pspdfkit.vangogh.rx.AnimationCompletable;
import io.reactivex.Completable;

/**
 * Class containing convenient animation scheduling methods.
 */
public final class AnimationSchedulers {

    /**
     * Animates given animations at the same time.
     * @param animations Animations to execute together.
     * @return Completable finishing once the last animation is completed.
     */
    public static Completable together(Completable... animations) {
        return Completable.mergeArray(animations);
    }

    /**
     * Animates given animations one after another
     * @param animations Animations to execute sequentially.
     * @return Completable finishing once the last animation is completed.
     */
    public static Completable sequentially(Completable... animations) {
        return Completable.concatArray(animations);
    }

}

Enable scheduling Completables, not just AnimationCompletables


package com.smooch.rnsmooch;

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

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

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

        modules.add(new ReactNativeSmooch(reactContext));
        return modules;
    }

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

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return new ArrayList<>();
    }
}

package com.smooch.rnsmooch;

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

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

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

        modules.add(new ReactNativeSmooch(reactContext));
        return modules;
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return new ArrayList<>();
    }
}

Remove method that was removed from interface

See https://github.com/facebook/react-native/commit/ce6fb337a146e6f261f2afb564aa19363774a7a8#diff-63e621165603dc1a84832d6c400fae31


package io.cucumber.messages;

import org.junit.Test;

import java.time.Duration;
import java.time.Instant;
import java.time.temporal.TemporalUnit;

import static io.cucumber.messages.TimeConversion.durationToJavaDuration;
import static io.cucumber.messages.TimeConversion.javaDurationToDuration;
import static io.cucumber.messages.TimeConversion.javaInstantToTimestamp;
import static io.cucumber.messages.TimeConversion.timestampToJavaInstant;
import static org.junit.Assert.assertEquals;

public class TimeConversionTest {
    @Test
    public void convertsToAndFromTimestamp() {
        Instant javaInstant = Instant.now();
        Messages.Timestamp timestamp = javaInstantToTimestamp(javaInstant);
        Instant javaInstantAgain = timestampToJavaInstant(timestamp);

        assertEquals(javaInstant, javaInstantAgain);
    }

    @Test
    public void convertsToAndFromDuration() {
        Duration javaDuration = Duration.ofMillis(1234);
        Messages.Duration duration = javaDurationToDuration(javaDuration);
        Duration javaDurationAgain = durationToJavaDuration(duration);

        assertEquals(javaDuration, javaDurationAgain);
    }
}

package io.cucumber.messages;

import org.junit.Test;

import java.time.Duration;
import java.time.Instant;
import java.time.temporal.TemporalUnit;

import static io.cucumber.messages.TimeConversion.durationToJavaDuration;
import static io.cucumber.messages.TimeConversion.javaDurationToDuration;
import static io.cucumber.messages.TimeConversion.javaInstantToTimestamp;
import static io.cucumber.messages.TimeConversion.timestampToJavaInstant;
import static org.junit.Assert.assertEquals;

public class TimeConversionTest {
    @Test
    public void convertsToAndFromTimestamp() {
        Instant javaInstant = Instant.now();
        Messages.Timestamp timestamp = javaInstantToTimestamp(javaInstant);
        Instant javaInstantAgain = timestampToJavaInstant(timestamp);

        assertEquals(javaInstant, javaInstantAgain);
    }

    @Test
    public void convertsToAndFromDuration() {
        Duration javaDuration = Duration.ofSeconds(3, 161000);
        Messages.Duration duration = javaDurationToDuration(javaDuration);
        Duration javaDurationAgain = durationToJavaDuration(duration);

        assertEquals(javaDuration, javaDurationAgain);
    }
}

messages: Add better Java test for time conversion


package pl.edu.uj.JImageStream.model;

import pl.edu.uj.JImageStream.api.ImageStream;
import pl.edu.uj.JImageStream.util.Util;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

//todo needs some added functionality, return bufferedImage, etc
public class StreamableImage {

    private BufferedImage bufferedImage;

    //todo extract to IOImageUtilsClass, maybe
    public StreamableImage(File file) throws IOException {
        bufferedImage = Util.convert(ImageIO.read(file), BufferedImage.TYPE_4BYTE_ABGR_PRE);
    }

    public StreamableImage(BufferedImage bufferedImage) {
        this.bufferedImage = bufferedImage;
    }

    //todo same, maybe
    public void save(String format, String file) throws IOException {
        ImageIO.write(bufferedImage, format, new File(file));
    }

    public int getHeight() {
        return bufferedImage.getHeight();
    }

    public int getWidth() {
        return bufferedImage.getWidth();
    }

    public ImageStream stream() {
        return new ImageStream(bufferedImage, false);
    }

    public ImageStream parallelStream() {
        return new ImageStream(bufferedImage, true);
    }

}

package pl.edu.uj.JImageStream.model;

import pl.edu.uj.JImageStream.api.ImageStream;
import pl.edu.uj.JImageStream.util.Util;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

//todo needs some added functionality, return bufferedImage, etc
public class StreamableImage {

    private BufferedImage bufferedImage;

    //todo extract to IOImageUtilsClass, maybe
    public StreamableImage(File file) throws IOException {
        bufferedImage = Util.convert(ImageIO.read(file), BufferedImage.TYPE_INT_ARGB_PRE);
    }

    public StreamableImage(BufferedImage bufferedImage) {
        this.bufferedImage = bufferedImage;
    }

    //todo same, maybe
    public void save(String format, String file) throws IOException {
        ImageIO.write(bufferedImage, format, new File(file));
    }

    public int getHeight() {
        return bufferedImage.getHeight();
    }

    public int getWidth() {
        return bufferedImage.getWidth();
    }

    public ImageStream stream() {
        return new ImageStream(bufferedImage, false);
    }

    public ImageStream parallelStream() {
        return new ImageStream(bufferedImage, true);
    }

}

Fix mistake in ColorModel from ABGR into ARGB


/*
 * 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.authentication;

import com.github.daytron.revworks.data.UserType;

/**
 *
 * @author Ryan Gilera
 */
class StudentUser extends User {

    private final String studentID;

    public StudentUser(String id, String studentID, String firstname,
            String lastname, UserType userType) {
        super(id, firstname, lastname, userType);
        this.studentID = studentID;
    }

    public String getStudentID() {
        return studentID;
    }

}

/*
 * 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.authentication;

import com.github.daytron.revworks.data.UserType;

/**
 * The child class of {@link User} for Administrators user role.
 *
 * @author Ryan Gilera
 */
class AdminUser extends User {

    private final String adminEmail;

     /**
     * Creates a new AdminUser object with parameter values namely the user id,
     * admin's email, first name and last name.
     *
     * @param userId The identifying id for a user
     * @param lecturerId The identifying id for a lecturer
     * @param email The email assigned by the College which acts as a username
     * @param firstname The first name of the lecturer
     * @param lastname The last name of the lecturer
     */
    public AdminUser(String id, String adminEmail, String firstname,
            String lastname) {
        super(id, firstname, lastname, UserType.ADMIN);
        this.adminEmail = adminEmail;
    }

    /**
     * Returns admin's email address.
     *
     * @return String object for admin's email information
     */
    public String getadminEmail() {
        return adminEmail;
    }

}

Add admin user child class

Add admin user child class


/**
 * Copyright 2011, Aiki IT, FotoRenamer
 *

 * 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 de.aikiit.fotorenamer.gui;

import org.junit.Test;

import static org.junit.Assert.assertNotNull;

/**
 * Test directory selector.
 *
 * @author hirsch
 * @version 2011-04-08, 00:22
 */
public class ImageDirectorySelectorTest {
    @Test
    public void performInit() {
        assertNotNull(new ImageDirectorySelector(null));
    }

}

/**
 * Copyright 2011, Aiki IT, FotoRenamer
 *

 * 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 de.aikiit.fotorenamer.gui;

import org.junit.Ignore;
import org.junit.Test;

import static org.junit.Assert.assertNotNull;

/**
 * Test directory selector.
 *
 * @author hirsch
 * @version 2011-04-08, 00:22
 */
@Ignore("Not working on travis since no X11 present")
public class ImageDirectorySelectorTest {
    @Test
    public void performInit() {
        assertNotNull(new ImageDirectorySelector(null));
    }

}

Fix buildfailure by ignoring test on travis.

de.aikiit.fotorenamer.gui.ImageDirectorySelectorTest

performInit(de.aikiit.fotorenamer.gui.ImageDirectorySelectorTest)  Time elapsed: 2.873 sec  <<< ERROR!

java.awt.HeadlessException:

No X11 DISPLAY variable was set, but this program performed an operation which requires it.

    at de.aikiit.fotorenamer.gui.ImageDirectorySelectorTest.performInit(ImageDirectorySelectorTest.java:31)


package com.kii.thingif.command;

/**
 * Represents base cass of Action.
 */
public interface Action{
}

package com.kii.thingif.command;

/**
 * Marks a class as group of actions of command. The class implements Acton defines single actions
 * as fields of the class.
 *
The class must define {@link ActionAnnotation} for each field of the class, SDK uses the
 * defined annotations to serialize the class to json data or deserialize json data to a instance
 * of the class.
 *
 *
Serialize Principles

 *

 *
Name of action after serialized.
 *

 *

 *             If value of actionName of {@link ActionAnnotation} is not an empty string, SDK uses
 *             this value as key of action in serialized json object.
 *

 *

 *             If value of actionName annotation is empty string, SDK will name of attribute of
 *             the class as key of action in serialized json object.
 *

 *

 *

 *
Value of action is serialized with Gson.
 *

 *

 *             If action value is null, SDK does not include the action into serialized json data.
 *

 *

 *             If action value is primitive type(like int, boolean, float, double), SDK serializes
 *             it by its type.
 *

 *

 *             If action value is simple data type(like String, Number or subclass of Number(Integer,
 *             Float, etc.)), SDK serializes it by its type.
 *

 *

 *             If action value is customized object defined by developer, SDK serializes it using Gson.
 *

 *

 *            If action value is Collection type, SDK serializes it using Gson.
 *

 *

 *            If action value is array(like int[]), SDK serialized it using Gson.
 *

 *

 *

 *

 */
public interface Action {
}

Add description of serialize and deserialize(not completed)


package com.jpardogo.android.listbuddies.models;

import android.content.Context;
import android.graphics.Color;

import com.jpardogo.android.listbuddies.R;
import com.jpardogo.android.listbuddies.adapters.CustomizeSpinnersAdapter;

import java.util.Random;

/**
 * Created by jpardogo on 22/02/2014.
 */
public class KeyValuePair {
    private String key;
    private Object value;

    public KeyValuePair(String key, Object value) {
        this.key = key;
        this.value = value;
    }

    public int getColor(Context context) {
        int color = -1;
        if (value instanceof CustomizeSpinnersAdapter.OptionTypes) {
            switch ((CustomizeSpinnersAdapter.OptionTypes) value) {
                case BLACK:
                    color = context.getResources().getColor(R.color.black);
                    break;
                case RANDOM:
                    Random rnd = new Random();
                    color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
                    break;
            }
        } else {
            throw new ClassCastException("Wrong type of value, the value must be CustomizeSpinnersAdapter.OptionTypes");
        }
        return color;
    }

    public String getKey() {
        return key;
    }

    public int getScrollOption() {
        return (Integer) value;
    }
}

package com.jpardogo.android.listbuddies.models;

import android.content.Context;

import com.jpardogo.android.listbuddies.R;
import com.jpardogo.android.listbuddies.adapters.CustomizeSpinnersAdapter;

/**
 * Created by jpardogo on 22/02/2014.
 */
public class KeyValuePair {
    private String key;
    private Object value;

    public KeyValuePair(String key, Object value) {
        this.key = key;
        this.value = value;
    }

    public int getColor(Context context) {
        int color = -1;
        if (value instanceof CustomizeSpinnersAdapter.OptionTypes) {
            switch ((CustomizeSpinnersAdapter.OptionTypes) value) {
                case BLACK:
                    color = context.getResources().getColor(R.color.black);
                    break;
                case INSET:
                    color = context.getResources().getColor(R.color.inset);
                    break;
            }
        } else {
            throw new ClassCastException("Wrong type of value, the value must be CustomizeSpinnersAdapter.OptionTypes");
        }
        return color;
    }

    public String getKey() {
        return key;
    }

    public int getScrollOption() {
        return (Integer) value;
    }
}

Change random for inset color

Change random for inset color


package me.yamakaja.runtimetransformer;

import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;

/**
 * Created by Yamakaja on 19.05.17.
 */
public class RuntimeTransformer {

    public RuntimeTransformer(Class<?>... transformers) {
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        if (systemClassLoader instanceof URLClassLoader) {
            URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();

            try {
                Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
                method.setAccessible(true);

                File file = new File(new File(System.getProperty("java.home")).getParent(), "lib/tools.jar");
                if (!file.exists())
                    throw new RuntimeException("Not running with JDK!");

                method.invoke(urlClassLoader, file.toURI().toURL());
            } catch (Throwable throwable) {
                throwable.printStackTrace();
            }
        }

        TransformerUtils.attachAgent(TransformerUtils.saveAgentJar(), transformers);
    }

}

package me.yamakaja.runtimetransformer;

import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Path;

/**
 * Created by Yamakaja on 19.05.17.
 */
public class RuntimeTransformer {

    private static final String ATTACH_MOD_PATH = "jmods/jdk.attach.jmod";

    public RuntimeTransformer(Class<?>... transformers) {
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();

        File javaHome = new File(System.getProperty("java.home"));
        if (systemClassLoader instanceof URLClassLoader) {
            URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();

            try {
                Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
                method.setAccessible(true);

                File toolsJar = new File(javaHome, "lib/tools.jar");
                if (!toolsJar.exists())
                    throw new RuntimeException("Not running with JDK!");

                method.invoke(urlClassLoader, toolsJar.toURI().toURL());
            } catch (Throwable throwable) {
                throwable.printStackTrace();
            }
        } else {
            Path attachMod = javaHome.toPath().resolve(ATTACH_MOD_PATH);
            if (Files.notExists(attachMod)) {
                throw new RuntimeException("Not running with JDK!");
            }
        }

        TransformerUtils.attachAgent(TransformerUtils.saveAgentJar(), transformers);
    }

}

Verify if the JDK attach mod is installed


package org.synyx.urlaubsverwaltung;

import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.containers.MariaDBContainer;

import static org.testcontainers.containers.MariaDBContainer.NAME;

public abstract class TestContainersBase {

    static final MariaDBContainer<?> mariaDB = new MariaDBContainer<>(NAME + ":10.5")
        .withCommand("--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci");

    @DynamicPropertySource
    static void mariaDBProperties(DynamicPropertyRegistry registry) {
        mariaDB.start();
        registry.add("spring.datasource.url", mariaDB::getJdbcUrl);
        registry.add("spring.datasource.username", mariaDB::getUsername);
        registry.add("spring.datasource.password", mariaDB::getPassword);
    }
}

package org.synyx.urlaubsverwaltung;

import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.containers.MariaDBContainer;

import static org.testcontainers.containers.MariaDBContainer.NAME;

public abstract class TestContainersBase {

    static final MariaDBContainer<?> mariaDB = new MariaDBContainer<>(NAME + ":10.5")
        .withCommand("--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--max-connections=300");

    @DynamicPropertySource
    static void mariaDBProperties(DynamicPropertyRegistry registry) {
        mariaDB.start();
        registry.add("spring.datasource.url", mariaDB::getJdbcUrl);
        registry.add("spring.datasource.username", mariaDB::getUsername);
        registry.add("spring.datasource.password", mariaDB::getPassword);
    }
}

Increase max connections to 300 for mariadb


package com.indeed.proctor.store;

import java.util.Objects;
import java.util.Set;

/**
 * Details of a single revision
 */
public class RevisionDetails {
    private final Revision revision;
    private final Set<String> modifiedTests;

    public RevisionDetails(
            final Revision revision,
            final Set<String> modifiedTests
    ) {
        this.revision = revision;
        this.modifiedTests = modifiedTests;
    }

    public Revision getRevision() {
        return revision;
    }

    public Set<String> getModifiedTests() {
        return modifiedTests;
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final RevisionDetails that = (RevisionDetails) o;
        return Objects.equals(revision, that.revision) &&
                Objects.equals(modifiedTests, that.modifiedTests);
    }

    @Override
    public int hashCode() {
        return Objects.hash(revision, modifiedTests);
    }

    @Override
    public String toString() {
        return com.google.common.base.Objects.toStringHelper(this)
                .add("revision", revision)
                .add("modifiedTests", modifiedTests)
                .toString();
    }
}

package com.indeed.proctor.store;

import javax.annotation.Nonnull;
import java.util.Objects;
import java.util.Set;

/**
 * Details of a single revision
 */
public class RevisionDetails {
    @Nonnull
    private final Revision revision;
    @Nonnull
    private final Set<String> modifiedTests;

    public RevisionDetails(
            @Nonnull final Revision revision,
            @Nonnull final Set<String> modifiedTests
    ) {
        this.revision = revision;
        this.modifiedTests = modifiedTests;
    }

    @Nonnull
    public Revision getRevision() {
        return revision;
    }

    @Nonnull
    public Set<String> getModifiedTests() {
        return modifiedTests;
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final RevisionDetails that = (RevisionDetails) o;
        return Objects.equals(revision, that.revision) &&
                Objects.equals(modifiedTests, that.modifiedTests);
    }

    @Override
    public int hashCode() {
        return Objects.hash(revision, modifiedTests);
    }

    @Override
    public String toString() {
        return com.google.common.base.Objects.toStringHelper(this)
                .add("revision", revision)
                .add("modifiedTests", modifiedTests)
                .toString();
    }
}

Add nonnull for fields in the model

PROC-592: Add nonnull for fields in the model


// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.restapi;

import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;

/**
 * @author bjorncs
 */
public abstract class RestApiRequestHandler<T extends RestApiRequestHandler<T>> extends LoggingRequestHandler {

    private final RestApi restApi;

    @FunctionalInterface public interface RestApiProvider<T> { RestApi createRestApi(T self); }

    /**
     * RestApi will usually refer to handler methods of subclass, which are not accessible before super constructor has completed.
     * This is hack to leak reference to subclass instance's "this" reference.
     * Caller must ensure that provider instance does not try to access any uninitialized fields.
     */
    @SuppressWarnings("unchecked")
    protected RestApiRequestHandler(LoggingRequestHandler.Context context, RestApiProvider<T> provider) {
        super(context);
        this.restApi = provider.createRestApi((T)this);
    }

    protected RestApiRequestHandler(LoggingRequestHandler.Context context, RestApi restApi) {
        super(context);
        this.restApi = restApi;
    }

    @Override public final HttpResponse handle(HttpRequest request) { return restApi.handleRequest(request); }
}

// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.restapi;

import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;

/**
 * @author bjorncs
 */
public abstract class RestApiRequestHandler<T extends RestApiRequestHandler<T>> extends LoggingRequestHandler {

    private final RestApi restApi;

    @FunctionalInterface public interface RestApiProvider<T> { RestApi createRestApi(T self); }

    /**
     * RestApi will usually refer to handler methods of subclass, which are not accessible before super constructor has completed.
     * This is hack to leak reference to subclass instance's "this" reference.
     * Caller must ensure that provider instance does not try to access any uninitialized fields.
     */
    @SuppressWarnings("unchecked")
    protected RestApiRequestHandler(LoggingRequestHandler.Context context, RestApiProvider<T> provider) {
        super(context);
        this.restApi = provider.createRestApi((T)this);
    }

    protected RestApiRequestHandler(LoggingRequestHandler.Context context, RestApi restApi) {
        super(context);
        this.restApi = restApi;
    }

    @Override public final HttpResponse handle(HttpRequest request) { return restApi.handleRequest(request); }

    protected RestApi restApi() { return restApi; }
}

Add getter for restapi instance

Add getter for restapi instance


package rocks.nt.apm.jmeter.config.influxdb;

/**
 * Constants (Tag, Field, Measurement) names for the requests measurement.
 *
 * @author Alexander Wert
 *
 */
public interface RequestMeasurement {

	/**
	 * Measurement name.
	 */
	String MEASUREMENT_NAME = "requestsRaw";

	/**
	 * Tags.
	 *
	 * @author Alexander Wert
	 *
	 */
	public interface Tags {
		/**
		 * Request name tag.
		 */
		String REQUEST_NAME = "requestName";
	}

	/**
	 * Fields.
	 *
	 * @author Alexander Wert
	 *
	 */
	public interface Fields {
		/**
		 * Response time field.
		 */
		String RESPONSE_TIME = "responseTime";

		/**
		 * Error count field.
		 */
		String ERROR_COUNT = "errorCount";

		/**
		 * Thread name field
		 */
		String THREAD_NAME = "threadName";

		/**
		 * Test name field
		 */
		String TEST_NAME = "testName";

		 * Node name field
		 */
		String NODE_NAME = "nodeName";
	}
}

package rocks.nt.apm.jmeter.config.influxdb;

/**
 * Constants (Tag, Field, Measurement) names for the requests measurement.
 *
 * @author Alexander Wert
 *
 */
public interface RequestMeasurement {

	/**
	 * Measurement name.
	 */
	String MEASUREMENT_NAME = "requestsRaw";

	/**
	 * Tags.
	 *
	 * @author Alexander Wert
	 *
	 */
	public interface Tags {
		/**
		 * Request name tag.
		 */
		String REQUEST_NAME = "requestName";
	}

	/**
	 * Fields.
	 *
	 * @author Alexander Wert
	 *
	 */
	public interface Fields {
		/**
		 * Response time field.
		 */
		String RESPONSE_TIME = "responseTime";

		/**
		 * Error count field.
		 */
		String ERROR_COUNT = "errorCount";

		/**
		 * Thread name field
		 */
		String THREAD_NAME = "threadName";

		/**
		 * Test name field
		 */
		String TEST_NAME = "testName";

		/**
		 * Node name field
		 */
		String NODE_NAME = "nodeName";
	}
}

Fix build again after merge error in Github.


package com.openxc.measurements;

import junit.framework.TestCase;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

public class BrakePedalStatusTest extends TestCase {
    BrakePedalStatus measurement;

    @Override
    public void setUp() {
        measurement = new BrakePedalStatus(new Boolean(false));
    }

    public void testGet() {
        assertThat(measurement.getValue().booleanValue(), equalTo(false));
    }

    public void testHasNoRange() {
        assertFalse(measurement.hasRange());
    }
}

package com.openxc.measurements;

import junit.framework.TestCase;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

public class BrakePedalStatusTest extends TestCase {
    BrakePedalStatus measurement;

    @Override
    public void setUp() {
        measurement = new BrakePedalStatus(new Boolean(false));
    }

    public void testGet() {
        assertThat(measurement.getValue().booleanValue(), equalTo(false));
    }

    public void testHasNoRange() {
        assertFalse(measurement.hasRange());
    }

    public void testGenericName() {
        assertEquals(measurement.getGenericName(), measurement.ID);
    }
}

Test that genericName method is overridden.


package eu.f3rog.blade.sample.arg;

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

import java.util.Random;

import blade.Blade;
import blade.F;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import eu.f3rog.blade.sample.R;

@Blade
public class TestArgActivity extends AppCompatActivity {

    @BindView(R.id.edt_num)
    EditText mEditNumber;
    @BindView(R.id.edt_text)
    EditText mEditText;

    @OnClick(R.id.btn_show_fragment)
    public void showFragment() {
        int number = Integer.parseInt(mEditNumber.getText().toString());
        String text = mEditText.getText().toString();
        Data data = new Data(number, text);

        double randomDouble = new Random().nextDouble();

        getSupportFragmentManager().beginTransaction()
                .replace(R.id.frag, F.newDataFragment(randomDouble, data))
                .commit();
    }

    @OnClick(R.id.btn_show_dialog)
    public void b2() {
        F.newSampleDialogFragment("Hello mate :)").show(getSupportFragmentManager(), "some-tag");
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test_arg);
        ButterKnife.bind(this);
    }

}

package eu.f3rog.blade.sample.arg;

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

import java.util.Random;

import blade.Blade;
import blade.F;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import eu.f3rog.blade.sample.R;

@Blade
public class TestArgActivity extends AppCompatActivity {

    @BindView(R.id.edt_num)
    EditText mEditNumber;
    @BindView(R.id.edt_text)
    EditText mEditText;

    @OnClick(R.id.btn_show_fragment)
    public void showFragment() {
        if (mEditNumber.getText().length() == 0) {
            Toast.makeText(this, "Input a number!", Toast.LENGTH_SHORT).show();
            mEditNumber.requestFocus();
            return;
        }
        int number = Integer.parseInt(mEditNumber.getText().toString());
        String text = mEditText.getText().toString();
        Data data = new Data(number, text);

        double randomDouble = new Random().nextDouble();

        getSupportFragmentManager().beginTransaction()
                .replace(R.id.frag, F.newDataFragment(randomDouble, data))
                .commit();
    }

    @OnClick(R.id.btn_show_dialog)
    public void b2() {
        F.newSampleDialogFragment("Hello mate :)").show(getSupportFragmentManager(), "some-tag");
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test_arg);
        ButterKnife.bind(this);
    }

}

Fix crash when Arg "Enter Number" field is left empty.


package com.michelboudreau.alternator;

public class AlternatorDBServer
{
    public static void main(final String[] args) throws Exception
    {
        int port = 9090;

        // TODO: Parse args for alternate port.
        AlternatorDB db = new AlternatorDB(port);
        db.start();

        System.out.println(
                String.format("AlternatorDB has started and is listening on port %d.", port));
    }
}

package com.michelboudreau.alternator;

import java.io.File;

public class AlternatorDBServer {

    /**
     * Allow the database to be persisted to disk when the server shuts down.
     */
    private static final boolean sandboxStatusSaveToDisk = false;

    /**
     * Discard the database contents when the server shuts down.
     */
    private static final boolean sandboxStatusDiscardData = true;

    private static final int defaultPort = 9090;

    public static void main(final String[] args) throws Exception {

        File persistenceFile = null;

        int port = defaultPort;

        if (args.length >= 1) {
            String persistencePath = args[0];
            persistenceFile = new File(persistencePath);
        }

        AlternatorDB db = new AlternatorDB(port, persistenceFile, sandboxStatusSaveToDisk);
        db.start();

        if (persistenceFile != null) {
            System.out.println(
                    String.format("+++++ AlternatorDB loaded data from file: %s", persistenceFile.getCanonicalPath()));
        }

        System.out.println(
                String.format("+++++ AlternatorDB has started and is listening on port %d.", port));

        if (persistenceFile != null) {
            System.out.println(
                    String.format("Press the Enter key to exit gracefully and save data to file: %s", persistenceFile.getCanonicalPath()));
        }
        System.out.print("Use Control-C to force exit (without saving data changes): ");
        String input = System.console().readLine();

        System.out.println("----- AlternatorDB is shutting down...");

        db.stop();

        if (persistenceFile != null) {
            System.out.println(
                    String.format("----- Data was saved to file: %s", persistenceFile.getCanonicalPath()));
        }
    }
}

Support a persistence file in executable JAR console operation.


package jp.ac.nii.prl.mape.controller.service;

import java.net.URI;

import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import jp.ac.nii.prl.mape.controller.model.MAPEKComponent;

@Service("knowledgeBaseService")
public class KnowledgeBaseServiceImpl implements KnowledgeBaseService {

	/* (non-Javadoc)
	 * @see jp.ac.nii.prl.mape.controller.service.KnowledgeBaseService#put(java.lang.String, java.lang.String)
	 */
	@Override
	public void put(MAPEKComponent kb, String bx, String view) {
		RestTemplate template = new RestTemplate();
		URI location = template.postForLocation(kb.getBaseUrl() + "/bx", view);
		view = template.getForObject(location, String.class);
	}

	/* (non-Javadoc)
	 * @see jp.ac.nii.prl.mape.controller.service.KnowledgeBaseService#get(java.lang.String)
	 */
	@Override
	public String get(MAPEKComponent kb, String bx) {
		RestTemplate template = new RestTemplate();
		String view = template.getForObject(kb.getBaseUrl() + "/bx", String.class);
		return view;
	}
}

package jp.ac.nii.prl.mape.controller.service;

import java.net.URI;

import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import jp.ac.nii.prl.mape.controller.model.MAPEKComponent;

@Service("knowledgeBaseService")
public class KnowledgeBaseServiceImpl implements KnowledgeBaseService {

	/* (non-Javadoc)
	 * @see jp.ac.nii.prl.mape.controller.service.KnowledgeBaseService#put(java.lang.String, java.lang.String)
	 */
	@Override
	public void put(MAPEKComponent kb, String bx, String view) {
		RestTemplate template = new RestTemplate();
		URI location = template.postForLocation(kb.getUrl() + "/get/" + bx, view);
		view = template.getForObject(location, String.class);
	}

	/* (non-Javadoc)
	 * @see jp.ac.nii.prl.mape.controller.service.KnowledgeBaseService#get(java.lang.String)
	 */
	@Override
	public String get(MAPEKComponent kb, String bx) {
		RestTemplate template = new RestTemplate();
		System.out.println(kb.getUrl() + "/get/" + bx);
		String view = template.getForObject(kb.getUrl() + "/get/" + bx, String.class);
		return view;
	}
}

Fix URLs in KB service calls

Fix URLs in KB service calls


package eu.livotov.labs.android.d3s;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

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

import static java.util.regex.Pattern.CASE_INSENSITIVE;
import static java.util.regex.Pattern.DOTALL;
import static java.util.regex.Pattern.compile;

/**
 * Utilities to find 3DS values in ACS webpages.
 */
final class D3SRegexUtils {

    /**
     * Pattern to find the value of an attribute named value from an html tag with an attribute named name and a value of PaRes.
     */
    private static final Pattern paresFinder = compile("<input(?=.+?name=\"PaRes\")(?=.+?value=\"(\\S+?)\").+>", DOTALL | CASE_INSENSITIVE);

    /**
     * Finds the PaRes in an html page.
     *
     * @param html String representation of the html page to search within.
     * @return PaRes or null if not found
     */
    @Nullable
    static String findPaRes(@NonNull String html) {
        if (html.trim().isEmpty()) return null;

        String paRes = null;
        Matcher paresMatcher = paresFinder.matcher(html);
        if (paresMatcher.find()) {
            paRes = paresMatcher.group(1);
        }

        return paRes;
    }
}

package eu.livotov.labs.android.d3s;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

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

import static java.util.regex.Pattern.CASE_INSENSITIVE;
import static java.util.regex.Pattern.DOTALL;
import static java.util.regex.Pattern.compile;

/**
 * Utilities to find 3DS values in ACS webpages.
 */
final class D3SRegexUtils {

    /**
     * Pattern to find the value of an attribute named value from an html tag with an attribute named name and a value of PaRes.
     */
    private static final Pattern paresFinder = compile("<input(?=.+?name=\"PaRes\")(?=.+?value=\"(\\S+?)\").+>", DOTALL | CASE_INSENSITIVE);

    /**
     * Finds the PaRes in an html page.
     * <p>
     * Note: If more than one PaRes is found in a page only the first will be returned.
     *
     * @param html String representation of the html page to search within.
     * @return PaRes or null if not found
     */
    @Nullable
    static String findPaRes(@NonNull String html) {
        if (html.trim().isEmpty()) return null;

        String paRes = null;
        Matcher paresMatcher = paresFinder.matcher(html);
        if (paresMatcher.find()) {
            paRes = paresMatcher.group(1);
        }

        return paRes;
    }
}

Add additional comment about only matching first value


package org.knowm.xchange.examples.gdax;

import java.io.IOException;

import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeFactory;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.dto.marketdata.Ticker;
import org.knowm.xchange.gdax.GDAXExchange;
import org.knowm.xchange.gdax.dto.marketdata.GDAXProductTicker;
import org.knowm.xchange.gdax.service.GDAXMarketDataServiceRaw;
import org.knowm.xchange.service.marketdata.MarketDataService;

public class GDAXTickerDemo {

  public static void main(String[] args) throws IOException {

    Exchange exchange = ExchangeFactory.INSTANCE.createExchange(GDAXExchange.class.getName());
    MarketDataService marketDataService = exchange.getMarketDataService();

    generic(marketDataService);
    raw((GDAXMarketDataServiceRaw) marketDataService);
  }

  private static void generic(MarketDataService marketDataService) throws IOException {

    Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);

    System.out.println(ticker.toString());
  }

  private static void raw(GDAXMarketDataServiceRaw marketDataService) throws IOException {

    GDAXProductTicker bitstampTicker = marketDataService.getCoinbaseExProductTicker(CurrencyPair.BTC_USD);

    System.out.println(bitstampTicker.toString());
  }

}

package org.knowm.xchange.examples.gdax;

import java.io.IOException;

import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeFactory;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.dto.marketdata.Ticker;
import org.knowm.xchange.gdax.GDAXExchange;
import org.knowm.xchange.gdax.dto.marketdata.GDAXProductTicker;
import org.knowm.xchange.gdax.service.GDAXMarketDataServiceRaw;
import org.knowm.xchange.service.marketdata.MarketDataService;

public class GDAXTickerDemo {

  public static void main(String[] args) throws IOException {

    Exchange exchange = ExchangeFactory.INSTANCE.createExchange(GDAXExchange.class.getName());
    MarketDataService marketDataService = exchange.getMarketDataService();

    generic(marketDataService);
    raw((GDAXMarketDataServiceRaw) marketDataService);
  }

  private static void generic(MarketDataService marketDataService) throws IOException {

    Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_USD);

    System.out.println(ticker.toString());
  }

  private static void raw(GDAXMarketDataServiceRaw marketDataService) throws IOException {

    GDAXProductTicker gdaxTicker = marketDataService.getCoinbaseExProductTicker(CurrencyPair.BTC_USD);

    System.out.println(gdaxTicker.toString());
  }

}

Update GDAXProductTicker obj name from bitstampTicker to gdaxTicker

Looks to be a copy paste mistake. Updated the name to reference gdax as opposed to bitstamp in this gdax example.


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

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

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

 */
public class Request {

    @Nullable
    private final String jsonrpc;

    @Nullable
    private final String method;

    @NotNull
    private final JsonNode params;

    @Nullable
    private final ValueNode id;

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

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

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

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

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

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

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

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

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

 */
public class Request {

    @Nullable
    private final String jsonrpc;

    @Nullable
    private final String method;

    @Nullable
    private final JsonNode params;

    @Nullable
    private final ValueNode id;

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

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

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

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

    @NotNull
    public JsonNode getParams() {
        return params != null ? params : NullNode.getInstance();
    }

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

Check that params can be null

Check that params can be null


package org.puller;

public class Comic {
    private final String title;
    private final String price;

    public Comic(final String title, final String price) {
        this.title = title;
        this.price = price;
    }

    @Override
    public String toString() {
        return String.format("%s - %s", title, price);
    }
}

package org.puller;

public class Comic implements Comparable<Comic> {
    private static final String DOLLAR_SYMBOL = "\\$";

    private final String title;
    private final String price;

    public Comic(final String title, final String price) {
        this.title = title;
        this.price = price;
    }

    public String getRawPrice() {
        return price.replaceAll(DOLLAR_SYMBOL, "");
    }

    @Override
    public String toString() {
        return String.format("%s - %s", title, price);
    }

    @Override
    public int compareTo(Comic comic) {
        return title.compareTo(comic.title);
    }
}

Add method to obtain raw comic price

Add method to obtain raw comic price


package io.vertx.example.core.eventbus.pointtopoint;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
import io.vertx.example.util.Runner;

/*
 * @author Tim Fox
 */
public class Sender extends AbstractVerticle {

  // Convenience method so you can run it in your IDE
  public static void main(String[] args) {
    Runner.runClusteredExample(Sender.class);
  }

  @Override
  public void start() throws Exception {
    EventBus eb = vertx.eventBus();

    // Send a message every second

    vertx.setPeriodic(1000, v -> {

      eb.send("ping-address", "ping!", reply -> {
        System.out.println("Received reply " + reply.result().body());
      });

    });
  }
}

package io.vertx.example.core.eventbus.pointtopoint;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
import io.vertx.example.util.Runner;

/*
 * @author Tim Fox
 */
public class Sender extends AbstractVerticle {

  // Convenience method so you can run it in your IDE
  public static void main(String[] args) {
    Runner.runClusteredExample(Sender.class);
  }

  @Override
  public void start() throws Exception {
    EventBus eb = vertx.eventBus();

    // Send a message every second

    vertx.setPeriodic(1000, v -> {

      eb.send("ping-address", "ping!", reply -> {
        if (reply.succeeded()) {
          System.out.println("Received reply " + reply.result().body());
        } else {
          System.out.println("No reply");
        }
      });

    });
  }
}

Improve reply handler in pointtopoint examples


package com.io7m.jcanephora;

import javax.media.opengl.GLContext;

import org.junit.After;
import org.junit.Before;

import com.io7m.jaux.Constraints.ConstraintError;
import com.io7m.jcanephora.contracts.FramebuffersContract;
import com.io7m.jlog.Log;

public final class JOGL30RenderbuffersTest extends FramebuffersContract
{
  private GLContext context;

  @Override public GLInterface getGL()
    throws GLException,
      ConstraintError
  {
    return new GLInterfaceJOGL30(this.context, JOGL30TestLog.getLog());
  }

  @Override public Log getLog()
  {
    return JOGL30TestLog.getLog();
  }

  @Before public void setUp()
    throws Exception
  {
    this.context = JOGL30.createOffscreenDisplay(640, 480);
  }

  @After public void tearDown()
    throws Exception
  {
    JOGL30.destroyDisplay(this.context);
  }
}

package com.io7m.jcanephora;

import javax.media.opengl.GLContext;

import org.junit.After;
import org.junit.Before;

import com.io7m.jaux.Constraints.ConstraintError;
import com.io7m.jcanephora.contracts.RenderbuffersContract;
import com.io7m.jlog.Log;

public final class JOGL30RenderbuffersTest extends RenderbuffersContract
{
  private GLContext context;

  @Override public GLInterface getGL()
    throws GLException,
      ConstraintError
  {
    return new GLInterfaceJOGL30(this.context, JOGL30TestLog.getLog());
  }

  @Override public Log getLog()
  {
    return JOGL30TestLog.getLog();
  }

  @Before public void setUp()
    throws Exception
  {
    this.context = JOGL30.createOffscreenDisplay(640, 480);
  }

  @After public void tearDown()
    throws Exception
  {
    JOGL30.destroyDisplay(this.context);
  }
}

Correct extends statement; Renderbuffers, not Framebuffers


package co.phoenixlab.discord.commands.tempstorage;

import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.Future;

public class ServerTimeout {

    private final String serverId;
    private final String userId;
    private final Instant startTime;
    private final Duration duration;
    private final Instant endTime;
    private final String issuedByUserId;
    private final Future<Void> timerFuture;

    public ServerTimeout(Duration duration, Instant startTime, String userId, String serverId, String issuedByUserId,
                         Future<Void> timerFuture) {
        this.duration = duration;
        this.startTime = startTime;
        this.userId = userId;
        this.serverId = serverId;
        this.timerFuture = timerFuture;
        this.endTime = startTime.plus(duration);
        this.issuedByUserId = issuedByUserId;
    }

    public String getServerId() {
        return serverId;
    }

    public String getUserId() {
        return userId;
    }

    public Instant getStartTime() {
        return startTime;
    }

    public Duration getDuration() {
        return duration;
    }

    public Instant getEndTime() {
        return endTime;
    }

    public String getIssuedByUserId() {
        return issuedByUserId;
    }

    public Future<Void> getTimerFuture() {
        return timerFuture;
    }
}

package co.phoenixlab.discord.commands.tempstorage;

import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.Future;

public class ServerTimeout {

    private final String serverId;
    private final String userId;
    private final Instant startTime;
    private final Duration duration;
    private final Instant endTime;
    private final String issuedByUserId;
    private final transient Future<Void> timerFuture;

    public ServerTimeout(Duration duration, Instant startTime, String userId, String serverId, String issuedByUserId,
                         Future<Void> timerFuture) {
        this.duration = duration;
        this.startTime = startTime;
        this.userId = userId;
        this.serverId = serverId;
        this.timerFuture = timerFuture;
        this.endTime = startTime.plus(duration);
        this.issuedByUserId = issuedByUserId;
    }

    public String getServerId() {
        return serverId;
    }

    public String getUserId() {
        return userId;
    }

    public Instant getStartTime() {
        return startTime;
    }

    public Duration getDuration() {
        return duration;
    }

    public Instant getEndTime() {
        return endTime;
    }

    public String getIssuedByUserId() {
        return issuedByUserId;
    }

    public Future<Void> getTimerFuture() {
        return timerFuture;
    }
}

Make the Future transient so not serialized


package com.ferreusveritas.dynamictrees.compat;

import java.util.List;

import com.ferreusveritas.dynamictrees.blocks.BlockRooty;

import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;

public class WailaRootyHandler implements IWailaDataProvider {

	@Override
	public List<String> getWailaBody(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
		IBlockState state = accessor.getWorld().getBlockState(accessor.getPosition());
		if(state.getBlock() instanceof BlockRooty) {
			BlockRooty rooty = (BlockRooty) state.getBlock();
			int life = rooty.getSoilLife(state, accessor.getWorld(), accessor.getPosition());
			tooltip.add("Soil Life: " + MathHelper.floor(life / 16.0) + "%");
		}

		return tooltip;
	}
}

package com.ferreusveritas.dynamictrees.compat;

import java.util.List;

import com.ferreusveritas.dynamictrees.blocks.BlockRooty;

import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;

public class WailaRootyHandler implements IWailaDataProvider {

	@Override
	public List<String> getWailaBody(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
		IBlockState state = accessor.getWorld().getBlockState(accessor.getPosition());
		if(state.getBlock() instanceof BlockRooty) {
			BlockRooty rooty = (BlockRooty) state.getBlock();
			int life = rooty.getSoilLife(state, accessor.getWorld(), accessor.getPosition());
			tooltip.add("Soil Life: " + MathHelper.floor(life * 6.25f) + "%");
		}

		return tooltip;
	}
}

Fix waila rooty dirt life calculation

Fix waila rooty dirt life calculation


package com.alorma.github.sdk.services.pullrequest;

import com.alorma.github.sdk.bean.dto.response.Commit;
import com.alorma.github.sdk.bean.info.IssueInfo;
import com.alorma.github.sdk.services.client.GithubListClient;
import java.util.List;
import retrofit.RestAdapter;

/**
 * Created by Bernat on 17/06/2015.
 */
public class GetPullRequestCommits extends GithubListClient<List<Commit>> {

  private IssueInfo info;
  private int page;

  public GetPullRequestCommits(IssueInfo info) {
    this(info, 0);
  }

  public GetPullRequestCommits(IssueInfo info, int page) {
    super();
    this.info = info;
    this.page = page;
  }

  @Override
  protected ApiSubscriber getApiObservable(RestAdapter restAdapter) {
    return new ApiSubscriber() {
      @Override
      protected void call(RestAdapter restAdapter) {
        PullRequestsService pullRequestsService = restAdapter.create(PullRequestsService.class);
        if (page == 0) {
          pullRequestsService.commits(info.repoInfo.owner, info.repoInfo.name, info.num, this);
        } else {
          pullRequestsService.commits(info.repoInfo.owner, info.repoInfo.name, info.num, nextPage,
              this);
        }
      }
    };
  }
}

package com.alorma.github.sdk.services.pullrequest;

import com.alorma.github.sdk.bean.dto.response.Commit;
import com.alorma.github.sdk.bean.info.IssueInfo;
import com.alorma.github.sdk.services.client.GithubListClient;
import java.util.List;
import retrofit.RestAdapter;

public class GetPullRequestCommits extends GithubListClient<List<Commit>> {

  private IssueInfo info;
  private int page;

  public GetPullRequestCommits(IssueInfo info) {
    this(info, 0);
  }

  public GetPullRequestCommits(IssueInfo info, int page) {
    super();
    this.info = info;
    this.page = page;
  }

  @Override
  protected ApiSubscriber getApiObservable(RestAdapter restAdapter) {
    return new ApiSubscriber() {
      @Override
      protected void call(RestAdapter restAdapter) {
        PullRequestsService pullRequestsService = restAdapter.create(PullRequestsService.class);
        if (page == 0) {
          pullRequestsService.commits(info.repoInfo.owner, info.repoInfo.name, info.num, this);
        } else {
          pullRequestsService.commits(info.repoInfo.owner, info.repoInfo.name, info.num, nextPage,
              this);
        }
      }
    };
  }

  @Override
  public String getAcceptHeader() {
    return "application/vnd.github.cryptographer-preview+sha.json";
  }
}

Update PullRequest commits to verification preview


package codechicken.lib.render;

import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;

public class PlaceholderTexture extends TextureAtlasSprite
{
    protected PlaceholderTexture(String par1)
    {
        super(par1);
    }

    @Override
    public boolean load(IResourceManager manager, ResourceLocation location)
    {
        return false;
    }
}

package codechicken.lib.render;

import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;

public class PlaceholderTexture extends TextureAtlasSprite
{
    protected PlaceholderTexture(String par1) {
        super(par1);
    }

    @Override
    public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) {
        return true;
    }

    @Override
    public boolean load(IResourceManager manager, ResourceLocation location) {
        return true;
    }
}

Fix texture not found exceptions in console when using placeholder texture


package de.abas.examples.inputbox;

import de.abas.erp.api.gui.InputBox;
import de.abas.erp.db.DbContext;
import de.abas.examples.common.AbstractAjoAccess;

public class InputBoxExample extends AbstractAjoAccess {

	DbContext ctx;

	@Override
	public int run(String[] args) {
		ctx = getDbContext();

		InputBox inputBox = new InputBox(ctx, "Normal Text goes here:");
		String input = inputBox.read();
		ctx.out().println("You entered: " + input);

		InputBox viewProtectedInputBox = new InputBox(ctx, "View Protected Text goes here:");
		String viewProtectedInput = viewProtectedInputBox.read(true);
		ctx.out().println("It was view protected, but I can still read it. You entered: " + viewProtectedInput);

		return 0;
	}

}

package de.abas.examples.inputbox;

import de.abas.erp.api.gui.InputBox;
import de.abas.erp.db.DbContext;
import de.abas.examples.common.AbstractAjoAccess;

public class InputBoxExample extends AbstractAjoAccess {

	@Override
	public int run(String[] args) {
		DbContext ctx = getDbContext();

		InputBox inputBox = new InputBox(ctx, "Normal Text goes here:");
		String input = inputBox.read();
		ctx.out().println("You entered: " + input);

		InputBox viewProtectedInputBox = new InputBox(ctx, "View Protected Text goes here:");
		String viewProtectedInput = viewProtectedInputBox.read(true);
		ctx.out().println("It was view protected, but I can still read it. You entered: " + viewProtectedInput);

		return 0;
	}

}

Refactor InputBox example: make DbContext local to method


package com.pm.server.player;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;

import com.pm.server.datatype.Coordinate;
import com.pm.server.datatype.PlayerState;
import com.pm.server.utils.JsonUtils;

@Component
public abstract class PlayerImpl implements Player {

	protected Integer id = 0;
	protected Coordinate location;
	protected PlayerState state = PlayerState.UNINITIALIZED;

	private final static Logger log =
			LogManager.getLogger(PlayerImpl.class.getName());

	public void setId(Integer id) {

		log.trace("Setting id to {}", id);

		this.id = id;
	}

	public int getId() {
		return id;
	}

	public void setLocation(Coordinate location) {

		String locationString = JsonUtils.objectToJson(location);
		if(locationString != null) {
			log.trace("Setting location to {}", locationString);
		}

		this.location = location;
	}

	public Coordinate getLocation() {
		return location;
	}

	public void setState(PlayerState state) throws NullPointerException {

		if(state == null) {
			String errorMessage = "setState() was given a null state.";
			log.warn(errorMessage);
			throw new NullPointerException(errorMessage);
		}
		this.state = state;

	}

	public PlayerState getState() {
		return state;
	}

}

package com.pm.server.player;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;

import com.pm.server.datatype.Coordinate;
import com.pm.server.datatype.PlayerState;
import com.pm.server.utils.JsonUtils;

@Component
public abstract class PlayerImpl implements Player {

	protected Integer id = 0;
	protected Coordinate location;
	protected PlayerState state = PlayerState.UNINITIALIZED;

	private final static Logger log =
			LogManager.getLogger(PlayerImpl.class.getName());

	public void setId(Integer id) {

		log.trace("Setting id to {}", id);

		this.id = id;
	}

	public int getId() {
		return id;
	}

	public void setLocation(Coordinate location) {

		String locationString = JsonUtils.objectToJson(location);
		if(locationString != null) {
			log.trace("Setting location to {}", locationString);
		}

		this.location = location;
	}

	public Coordinate getLocation() {
		return location;
	}

	public void setState(PlayerState state) throws NullPointerException {

		if(state == null) {
			String errorMessage = "setState() was given a null state.";
			log.warn(errorMessage);
			throw new NullPointerException(errorMessage);
		}

		log.trace("Setting location to {}", state);
		this.state = state;

	}

	public PlayerState getState() {
		return state;
	}

}

Add additional log message to Player setState


package net.rdrei.android.wakimail;

import org.acra.ACRA;
import org.acra.annotation.ReportsCrashes;

import android.app.Application;
import android.os.StrictMode;

/**
 * Sets up settings that are required for the application to run.
 *
 * @author pascal
 */
@ReportsCrashes(formUri = "http://www.bugsense.com/api/acra?api_key=2b0a6e7c", formKey = "")
public class WAKiMailApplication extends Application {
	@Override
	public void onCreate() {
		super.onCreate();

		if (BuildConfig.DEBUG) {
			enableStrictMode();
		} else {
			// Only if DEBUG is disabled.
			ACRA.init(this);
		}
	}

	private void enableStrictMode() {
		StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
				.detectAll().penaltyLog().build());
		StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
				.detectLeakedSqlLiteObjects()
				// Only on 11+ if I'm not mistaken.
				.detectLeakedClosableObjects().penaltyLog().penaltyDeath()
				.build());
	}
}

package net.rdrei.android.wakimail;

import org.acra.ACRA;
import org.acra.annotation.ReportsCrashes;

import android.app.Application;
import android.content.pm.ApplicationInfo;
import android.os.StrictMode;

/**
 * Sets up settings that are required for the application to run.
 *
 * @author pascal
 */
@ReportsCrashes(formUri = "http://www.bugsense.com/api/acra?api_key=2b0a6e7c", formKey = "")
public class WAKiMailApplication extends Application {
	@Override
	public void onCreate() {
		super.onCreate();

		if (isDebuggable()) {
			enableStrictMode();
		} else {
			// Only if DEBUG is disabled.
			ACRA.init(this);
		}
	}

	private boolean isDebuggable() {
		final int applicationFlags = this.getApplicationInfo().flags;
		return (applicationFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
	}

	private void enableStrictMode() {
		StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
				.detectAll().penaltyLog().build());
		StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
				.detectLeakedSqlLiteObjects()
				// Only on 11+ if I'm not mistaken.
				.detectLeakedClosableObjects().penaltyLog().penaltyDeath()
				.build());
	}
}

Use portable way to detect DEBUG mode

Use portable way to detect DEBUG mode


package com.tozny.sdk;

import com.google.api.client.http.GenericUrl;
import com.google.api.client.util.Key;

/**
 * A parent class for Realm and User API urls to extend.
 * All Tozny API calls have a required 'method' property.
 */
public class ToznyApiUrl extends GenericUrl {
    public static final String TOZNY_PRODUCTION_API_URL = "https://api.tozny.com";

    public ToznyApiUrl(String toznyApiUrl, String method) {
        super(toznyApiUrl);
        this.method = method;
    }

    @Key
    public String method;
}

package com.tozny.sdk;

import com.google.api.client.http.GenericUrl;
import com.google.api.client.util.Key;

/**
 * A parent class for Realm and User API urls to extend.
 * All Tozny API calls have a required 'method' property.
 */
public class ToznyApiUrl extends GenericUrl {
    public static final String TOZNY_PRODUCTION_API_URL = "https://api.tozny.com/";

    public ToznyApiUrl(String toznyApiUrl, String method) {
        super(toznyApiUrl);
        this.method = method;
    }

    @Key
    public String method;
}

Add trailing slash to Tozny API URL.

Add trailing slash to Tozny API URL.

- Fixes unit tests on JDK 7.


package protocolsupport.protocol.utils.spoofedata;

import java.lang.reflect.Type;
import java.util.Collection;
import java.util.function.Function;

import org.bukkit.Bukkit;

import com.destroystokyo.paper.event.player.PlayerHandshakeEvent;
import com.destroystokyo.paper.profile.ProfileProperty;
import com.google.gson.reflect.TypeToken;

import protocolsupport.utils.Utils;

public class PaperSpoofedDataParser implements Function<String, SpoofedData> {

	protected static final Type properties_type = new TypeToken<Collection<ProfileProperty>>() {}.getType();

	@Override
	public SpoofedData apply(String hostname) {
		if (PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) {
			PlayerHandshakeEvent handshakeEvent = new PlayerHandshakeEvent(hostname, false);
			Bukkit.getPluginManager().callEvent(handshakeEvent);
			if (!handshakeEvent.isCancelled()) {
				if (handshakeEvent.isFailed()) {
					return new SpoofedData(handshakeEvent.getFailMessage());
				}
				return new SpoofedData(
					handshakeEvent.getServerHostname(),
					handshakeEvent.getSocketAddressHostname(),
					handshakeEvent.getUniqueId(),
					Utils.GSON.fromJson(handshakeEvent.getPropertiesJson(), properties_type)
				);
			}
		}
		return null;
	}

}

package protocolsupport.protocol.utils.spoofedata;

import java.lang.reflect.Type;
import java.util.Collection;
import java.util.function.Function;

import org.bukkit.Bukkit;

import com.destroystokyo.paper.event.player.PlayerHandshakeEvent;
import com.google.gson.reflect.TypeToken;

import protocolsupport.api.utils.ProfileProperty;
import protocolsupport.utils.Utils;

public class PaperSpoofedDataParser implements Function<String, SpoofedData> {

	protected static final Type properties_type = new TypeToken<Collection<ProfileProperty>>() {}.getType();

	@Override
	public SpoofedData apply(String hostname) {
		if (PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) {
			PlayerHandshakeEvent handshakeEvent = new PlayerHandshakeEvent(hostname, false);
			Bukkit.getPluginManager().callEvent(handshakeEvent);
			if (!handshakeEvent.isCancelled()) {
				if (handshakeEvent.isFailed()) {
					return new SpoofedData(handshakeEvent.getFailMessage());
				}
				return new SpoofedData(
					handshakeEvent.getServerHostname(),
					handshakeEvent.getSocketAddressHostname(),
					handshakeEvent.getUniqueId(),
					Utils.GSON.fromJson(handshakeEvent.getPropertiesJson(), properties_type)
				);
			}
		}
		return null;
	}

}

Fix wrong properties type used

Fix wrong properties type used


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

import com.google.gwt.core.client.GWT;

/**
 * Test for data binding and Ajax which is run in gwt
 */
public class AjaxTestGwt extends AjaxTests {

  @Override
  public String getModuleName() {
    return "com.google.gwt.query.QueryTest";
  }

  public AjaxTestGwt() {
    echoUrl = (GWT.isClient() ? GWT.getHostPageBaseURL() : "http://localhost:3333/") + servletPath;
    echoUrlCORS = echoUrl.replaceFirst("http://[\\d\\.]+:", "http://localhost:") + "?cors=true";
  }
}

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

import com.google.gwt.core.client.GWT;

/**
 * Test for data binding and Ajax which is run in gwt
 */
public class AjaxTestGwt extends AjaxTests {

  @Override
  public String getModuleName() {
    return "com.google.gwt.query.QueryTest";
  }

  protected void gwtSetUp() throws Exception {
    echoUrl = GWT.getHostPageBaseURL() + servletPath;
    echoUrlCORS = echoUrl.replaceFirst("http://[\\d\\.]+:", "http://localhost:") + "?cors=true";
  }
}

Use gwtSetup instead of constructor in gwt test


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

package com.google.samples.apps.iosched.server.userdata;

/**
 * API keys.
 */
public class Ids {
    public static final String ANDROID_CLIENT_ID = "237695054204-m87hbqe20bqpib715p3hiddpjjfih2l9"
            + ".apps.googleusercontent.com";
    public static final String IOS_CLIENT_ID = "237695054204-pjm3begvj1k28pg88ncnacdi6gl5nbcf"
            + ".apps.googleusercontent.com";
    public static final String WEB_CLIENT_ID = "596109260910-n1vrfjs8d7105jh5j7qf42ph32sltjp0"
            + ".apps.googleusercontent.com";
    public static final String ANDROID_AUDIENCE = ANDROID_CLIENT_ID;
}

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

package com.google.samples.apps.iosched.server.userdata;

/**
 * API keys.
 */
public class Ids {
    public static final String ANDROID_CLIENT_ID = "237695054204-m87hbqe20bqpib715p3hiddpjjfih2l9"
            + ".apps.googleusercontent.com";
    public static final String IOS_CLIENT_ID = "596109260910-n1vrfjs8d7105jh5j7qf42ph32sltjp0"
            + ".apps.googleusercontent.com";
    public static final String WEB_CLIENT_ID = "755839215930-ctkg839m67rtqmgm55c6eg1j7cvu5mmf"
            + ".apps.googleusercontent.com";
    public static final String ANDROID_AUDIENCE = ANDROID_CLIENT_ID;
}

Fix client IDs for Web/iOS clients.

Fix client IDs for Web/iOS clients.

- Updated the IOS_CLIENT_ID with its new value.
- Reverted change to WEB_CLIENT_ID (accidently wrote the iOS client ID here in
  commit 891b02f)

Change-Id: Iac3f79c35386ddd93ce5989e0a9cde1b837f6d8c


package com.bungleton.yarrgs.parser;

import java.lang.reflect.Field;

public class FlagParser extends OptionParser
{
    public FlagParser (Field field)
    {
        super(field);
    }

    @Override
    public String getBasic ()
    {
        return shortArg;
    }

    @Override
    public String getDetail ()
    {
        return String.format("  %s ,%-10s %s", shortArg, longArg, getUsage());
    }

}

package com.bungleton.yarrgs.parser;

import java.lang.reflect.Field;

public class FlagParser extends OptionParser
{
    public FlagParser (Field field)
    {
        super(field);
    }

    @Override
    public String getBasic ()
    {
        return shortArg;
    }

    @Override
    public String getDetail ()
    {
        return String.format("  %s, %-10s %s", shortArg, longArg, getUsage());
    }

}

Correct comma spacing for flag detail

Correct comma spacing for flag detail


/**
 * 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/. OpenMRS is also distributed under
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
 *
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
 * graphic logo is a trademark of OpenMRS Inc.
 */
package org.openmrs.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Controller to display the uncaughtException page and ensure that it always displays
 * via the spring dispatcherServlet.
 */
@Controller
public class UncaughtExceptionController {

	private static final long serialVersionUID = 1L;

	@RequestMapping(value = "/uncaughtException", method = RequestMethod.POST)
	public void displayUncaughtException() {

	}
}

/**
 * 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/. OpenMRS is also distributed under
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
 *
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
 * graphic logo is a trademark of OpenMRS Inc.
 */
package org.openmrs.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Controller to display the uncaughtException page and ensure that it always displays
 * via the spring dispatcherServlet.
 */
@Controller
public class UncaughtExceptionController {

	private static final long serialVersionUID = 1L;

	@RequestMapping(value = "/uncaughtException", method = {RequestMethod.POST,RequestMethod.GET})
	public void displayUncaughtException() {

	}
}

TRUNK-4408: Change Logging Advice so that it doesn't log all exceptions


package io.openvidu.server.utils;

import io.openvidu.java.client.Recording.OutputMode;
import io.openvidu.java.client.RecordingProperties;
import io.openvidu.server.core.Session;

public final class RecordingUtils {

	public final static boolean IS_COMPOSED(OutputMode outputMode) {
		return (OutputMode.COMPOSED.equals(outputMode) || OutputMode.COMPOSED_QUICK_START.equals(outputMode));
	}

	public final static RecordingProperties RECORDING_PROPERTIES_WITH_MEDIA_NODE(Session session) {
		RecordingProperties recordingProperties = session.getSessionProperties().defaultRecordingProperties();
		if (recordingProperties.mediaNode() == null) {
			recordingProperties = new RecordingProperties.Builder(recordingProperties)
					.mediaNode(session.getMediaNodeId()).build();
		}
		return recordingProperties;
	}

}

package io.openvidu.server.utils;

import io.openvidu.java.client.Recording.OutputMode;
import io.openvidu.java.client.RecordingProperties;
import io.openvidu.server.core.Session;

public final class RecordingUtils {

	public final static boolean IS_COMPOSED(OutputMode outputMode) {
		return (OutputMode.COMPOSED.equals(outputMode) || OutputMode.COMPOSED_QUICK_START.equals(outputMode));
	}

	public final static RecordingProperties RECORDING_PROPERTIES_WITH_MEDIA_NODE(Session session) {
		RecordingProperties recordingProperties = session.getSessionProperties().defaultRecordingProperties();
		if (recordingProperties.mediaNode() == null || recordingProperties.mediaNode().isEmpty()) {
			recordingProperties = new RecordingProperties.Builder(recordingProperties)
					.mediaNode(session.getMediaNodeId()).build();
		}
		return recordingProperties;
	}

}

Check if mediaNode property is empty

openvidu-ce: Check if mediaNode property is empty


package com.bendb.dropwizard.redis;

import com.bendb.dropwizard.redis.jersey.JedisPoolBinder;
import io.dropwizard.Configuration;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import redis.clients.jedis.JedisPool;

public abstract class JedisBundle<C extends Configuration>
        implements ConfiguredBundle<C>, JedisConfiguration<C> {
    private JedisPool pool;

    public JedisPool getPool() {
        return pool;
    }

    @Override
    public void initialize(Bootstrap<?> bootstrap) {
    }

    @Override
    public void run(C configuration, Environment environment) throws Exception {
        pool = getJedisFactory(configuration).build(environment);

        environment.healthChecks().register("redis", new JedisHealthCheck(pool));
        environment.jersey().register(new JedisPoolBinder(pool));
    }
}

package com.bendb.dropwizard.redis;

import com.bendb.dropwizard.redis.jersey.JedisPoolBinder;
import com.codahale.metrics.Gauge;
import io.dropwizard.Configuration;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import redis.clients.jedis.JedisPool;

public abstract class JedisBundle<C extends Configuration>
        implements ConfiguredBundle<C>, JedisConfiguration<C> {
    private JedisPool pool;

    public JedisPool getPool() {
        return pool;
    }

    @Override
    public void initialize(Bootstrap<?> bootstrap) {
    }

    @Override
    public void run(C configuration, Environment environment) throws Exception {
        pool = getJedisFactory(configuration).build(environment);

        environment.metrics().register("redis.connection.idle", (Gauge) () -> pool.getNumIdle());
        environment.metrics().register("redis.connection.active", (Gauge) () -> pool.getNumActive());
        environment.metrics().register("redis.connection.wait", (Gauge) () -> pool.getNumWaiters());

        environment.healthChecks().register("redis", new JedisHealthCheck(pool));
        environment.jersey().register(new JedisPoolBinder(pool));
    }
}

Add metrics to monitor Redis connections


package org.synyx.urlaubsverwaltung.core.startup;

import org.apache.log4j.Logger;

import org.springframework.beans.factory.annotation.Value;

import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * This service is executed every time the application is started.
 *
 * @author  Aljona Murygina - murygina@synyx.de
 */
@Service
public class StartupService {

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

    @Value("${db.username}")
    private String dbUser;

    @Value("${db.url}")
    private String dbUrl;

    @Value("${email.boss}")
    private String emailBoss;

    @Value("${email.office}")
    private String emailOffice;

    @Value("${email.all}")
    private String emailAll;

    @Value("${email.manager}")
    private String emailManager;

    @PostConstruct
    public void logStartupInfo() {

        LOG.info("Using database " + dbUrl + " with user " + dbUser);

        LOG.info("Using following email addresses for notification:");
        LOG.info("Email boss: " + emailBoss);
        LOG.info("Email office: " + emailOffice);
        LOG.info("Email all: " + emailAll);
        LOG.info("Email manager: " + emailManager);
    }
}

package org.synyx.urlaubsverwaltung.core.startup;

import org.apache.log4j.Logger;

import org.springframework.beans.factory.annotation.Value;

import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * This service is executed every time the application is started.
 *
 * @author  Aljona Murygina - murygina@synyx.de
 */
@Service
public class StartupService {

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

    @Value("${db.username}")
    private String dbUser;

    @Value("${db.url}")
    private String dbUrl;

    @Value("${email.manager}")
    private String emailManager;

    @PostConstruct
    public void logStartupInfo() {

        LOG.info("Using database " + dbUrl + " with user " + dbUser);
        LOG.info("Using following email address for technical notification: " + emailManager);
    }
}

Adjust start up service: remove obsolete mail addresses

* Mail addresses for bosses and office are no longer
  configured in a properties file, so no need to log
  them anymore in start up service.


package to.etc.domui.server;

import org.eclipse.jdt.annotation.NonNull;

import javax.servlet.FilterConfig;
import java.io.File;
import java.net.URL;

public class FilterConfigParameters implements ConfigParameters {
	@NonNull
	private FilterConfig m_fc;

	@NonNull
	private File m_webFileRoot;

	public FilterConfigParameters(@NonNull FilterConfig fc, @NonNull File webFileRoot) {
		m_fc = fc;
		m_webFileRoot = webFileRoot;
	}

	@Override
	public String getString(@NonNull String name) {
		return m_fc.getInitParameter(name);
	}

	@NonNull
	@Override
	public File getWebFileRoot() {
		return m_webFileRoot;
	}

	@NonNull
	@Override
	public URL getResourcePath(@NonNull String path) throws Exception {
		URL url = m_fc.getServletContext().getResource(path);
		return url;
	}
}

package to.etc.domui.server;

import org.eclipse.jdt.annotation.NonNull;

import javax.servlet.FilterConfig;
import java.io.File;
import java.net.URL;

public class FilterConfigParameters implements ConfigParameters {
	@NonNull
	private FilterConfig m_fc;

	@NonNull
	private File m_webFileRoot;

	public FilterConfigParameters(@NonNull FilterConfig fc, @NonNull File webFileRoot) {
		m_fc = fc;
		m_webFileRoot = webFileRoot;
	}

	@Override
	public String getString(@NonNull String name) {
		return m_fc.getInitParameter(name);
	}

	@NonNull
	@Override
	public File getWebFileRoot() {
		return m_webFileRoot;
	}

	@NonNull
	@Override
	public URL getResourcePath(@NonNull String path) throws Exception {
		if(path.startsWith("/"))
			return m_fc.getServletContext().getResource(path);
		return m_fc.getServletContext().getResource("/" + path);		// Always nice to have a relative path start with /. Morons.
	}
}

Make sure the relative path passed to getResource() starts with a /, sigh. Very bad design.