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

import com.google.common.net.HostAndPort;
import org.testcontainers.containers.MongoDBContainer;

import java.io.Closeable;

public class MongoServer
        implements Closeable
{
    private static final int MONGO_PORT = 27017;

    private final MongoDBContainer dockerContainer;

    public MongoServer()
    {
        this("3.4.0");
    }

    public MongoServer(String mongoVersion)
    {
        this.dockerContainer = new MongoDBContainer("mongo:" + mongoVersion)
                .withEnv("MONGO_INITDB_DATABASE", "tpch")
                .withCommand("--bind_ip 0.0.0.0");
        this.dockerContainer.start();
    }

    public HostAndPort getAddress()
    {
        return HostAndPort.fromParts(dockerContainer.getContainerIpAddress(), dockerContainer.getMappedPort(MONGO_PORT));
    }

    @Override
    public void close()
    {
        dockerContainer.close();
    }
}

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

import com.google.common.net.HostAndPort;
import org.testcontainers.containers.MongoDBContainer;

import java.io.Closeable;

public class MongoServer
        implements Closeable
{
    private static final int MONGO_PORT = 27017;

    private final MongoDBContainer dockerContainer;

    public MongoServer()
    {
        this("3.4.0");
    }

    public MongoServer(String mongoVersion)
    {
        this.dockerContainer = new MongoDBContainer("mongo:" + mongoVersion)
                .withStartupAttempts(3)
                .withEnv("MONGO_INITDB_DATABASE", "tpch")
                .withCommand("--bind_ip 0.0.0.0");
        this.dockerContainer.start();
    }

    public HostAndPort getAddress()
    {
        return HostAndPort.fromParts(dockerContainer.getContainerIpAddress(), dockerContainer.getMappedPort(MONGO_PORT));
    }

    @Override
    public void close()
    {
        dockerContainer.close();
    }
}

Increase startup attempts from 1 to 3 in MongoDB container


package com.sys1yagi.databindingsample.databinding;

import com.squareup.picasso.Picasso;
import com.sys1yagi.databindingsample.tools.RoundedCornerTransformation;

import android.content.Context;
import android.databinding.BindingAdapter;
import android.widget.ImageView;

public class ImageLoadAdapter {

    @BindingAdapter({"imageUrl"})
    public static void bindImage(ImageView view, String url) {
        Picasso.with(view.getContext()).load(url).into(view);
    }

    @BindingAdapter({"imageUrl", "corner"})
    public static void bindImage(ImageView view, String url, int corner) {
        Context context = view.getContext();
        Picasso.with(context).load(url)
                .transform(new RoundedCornerTransformation(corner))
                .into(view);
    }
}

package com.sys1yagi.databindingsample.databinding;

import com.squareup.picasso.Picasso;
import com.sys1yagi.databindingsample.tools.RoundedCornerTransformation;

import android.content.Context;
import android.databinding.BindingAdapter;
import android.widget.ImageView;

public class ImageLoadAdapter {

    @BindingAdapter({"bind:imageUrl"})
    public static void bindImage(ImageView view, String url) {
        Picasso.with(view.getContext()).load(url).into(view);
    }

    @BindingAdapter({"bind:imageUrl", "bind:corner"})
    public static void bindImage(ImageView view, String url, int corner) {
        Context context = view.getContext();
        Picasso.with(context).load(url)
                .transform(new RoundedCornerTransformation(corner))
                .into(view);
    }
}

Revert namespace. Should write to distinguish the android namespace.


/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The SF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
/**
 * Contains in implementation of a SlingRepository based on Apache Oak.
 * The package is not exported.
 */
package org.apache.sling.oak.server;

Add missing license headers to org.apache.sling.jcr.oak.server

git-svn-id: 6eed74fe9a15c8da84b9a8d7f2960c0406113ece@1668819 13f79535-47bb-0310-9956-ffa450edef68


package zero.zd.zquestionnaire;

import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;

import java.io.File;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = MainActivity.class.getSimpleName();

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

        // create a folder
        File folder = new File(Environment.getExternalStorageDirectory().getPath() + "/ZQuestionnaire/");
        if (!folder.exists()) {
            if (!folder.mkdirs()) {
                Log.e(TAG, "Failed on creating folders.");
            }
        }
    }

    public void onClickAnswer(View view) {
        startActivity(LoadQnaActivity.getStartIntent(MainActivity.this));
    }

    public void onClickBuilder(View view) {
        startActivity(QnaBuilderActivity.getStartIntent(MainActivity.this));
    }

}

package zero.zd.zquestionnaire;

import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;

import java.io.File;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = MainActivity.class.getSimpleName();

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

        // create a folder
        File folder = new File(Environment.getExternalStorageDirectory().getPath() + "/ZQuestionnaire/");
        if (!folder.exists()) {
            if (!folder.mkdirs()) Log.e(TAG, "Failed on creating folders.");
        }
    }

    public void onClickAnswer(View view) {
        startActivity(LoadQnaActivity.getStartIntent(MainActivity.this));
    }

    public void onClickBuilder(View view) {
        startActivity(QnaBuilderActivity.getStartIntent(MainActivity.this));
    }

}

Add Logs on Files Creation of Folders

:speaker: Add Logs on Files Creation of Folders


package net.safedata.springboot.training.d02.s04.exceptions;

import net.safedata.springboot.training.d02.s04.dto.MessageDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * The most common exception handlers
 *
 * @author bogdan.solga
 */
@ControllerAdvice
public class ExceptionHandlers {

    private final static Logger LOGGER = LoggerFactory.getLogger(ExceptionHandlers.class);

    @ExceptionHandler(NotFoundException.class)
    @ResponseStatus(value = HttpStatus.NOT_FOUND)
    @ResponseBody
    public MessageDTO notFoundException(final NotFoundException e) {
        return new MessageDTO(e.getMessage());
    }

    @ExceptionHandler(IllegalArgumentException.class)
    @ResponseStatus(value = HttpStatus.BAD_REQUEST)
    @ResponseBody
    public MessageDTO illegalArgumentException(final IllegalArgumentException e) {
        return new MessageDTO(e.getMessage());
    }

    @ExceptionHandler(Exception.class)
    @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
    @ResponseBody
    public MessageDTO internalServerError(final Exception e) {
        LOGGER.error(e.getMessage(), e);

        return new MessageDTO("Oops!");
    }
}

package net.safedata.springboot.training.d02.s04.exceptions;

import net.safedata.springboot.training.d02.s04.dto.MessageDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * The most common exception handlers
 *
 * @author bogdan.solga
 */
@ControllerAdvice
public class ExceptionHandlers {

    private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionHandlers.class);

    @ExceptionHandler(NotFoundException.class)
    @ResponseStatus(value = HttpStatus.NOT_FOUND)
    @ResponseBody
    public MessageDTO notFoundException(final NotFoundException e) {
        return new MessageDTO(e.getMessage());
    }

    @ExceptionHandler(IllegalArgumentException.class)
    @ResponseStatus(value = HttpStatus.BAD_REQUEST)
    @ResponseBody
    public MessageDTO illegalArgumentException(final IllegalArgumentException e) {
        return new MessageDTO(e.getMessage());
    }

    @ExceptionHandler(Exception.class)
    @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
    @ResponseBody
    public MessageDTO internalServerError(final Exception e) {
        LOGGER.error(e.getMessage(), e);

        return new MessageDTO("Oops!");
    }
}

Use the specifiers in the JCC order

[clean] Use the specifiers in the JCC order


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

import com.google.android.exoplayer2.upstream.DataSink;

/**
 * A {@link DataSink.Factory} that produces {@link CacheDataSink}.
 */
public final class CacheDataSinkFactory implements DataSink.Factory {

  private final Cache cache;
  private final long maxCacheFileSize;

  /**
   * @see CacheDataSink#CacheDataSink(Cache, long)
   */
  public CacheDataSinkFactory(Cache cache, long maxCacheFileSize) {
    this.cache = cache;
    this.maxCacheFileSize = maxCacheFileSize;
  }

  @Override
  public DataSink createDataSink() {
    return new CacheDataSink(cache, maxCacheFileSize);
  }

}

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

import com.google.android.exoplayer2.upstream.DataSink;

/**
 * A {@link DataSink.Factory} that produces {@link CacheDataSink}.
 */
public final class CacheDataSinkFactory implements DataSink.Factory {

  private final Cache cache;
  private final long maxCacheFileSize;

  /**
   * @see CacheDataSink#CacheDataSink(Cache, long)
   */
  public CacheDataSinkFactory(Cache cache, long maxCacheFileSize) {
    this.cache = cache;
    this.maxCacheFileSize = maxCacheFileSize;
  }

  @Override
  public DataSink createDataSink() {
    return new CacheDataSink(cache, maxCacheFileSize);
  }

}

Change Sink to Source in license header

Change Sink to Source in license header


package bogush;

import java.io.*;
import java.nio.file.Path;

class LineCounter {
    static int count(Path file) throws IOException {
        try (InputStream is = new BufferedInputStream(new FileInputStream(file.toFile()))) {
            boolean empty = true;
            byte bytes[] = new byte[1024];
            int readChars;
            int count = 0;
            while ((readChars = is.read(bytes)) != -1) {
                empty = false;
                for (int i = 0; i < readChars; ++i) {
                    if (bytes[i] == '\n') {
                        ++count;
                    }
                }
            }
            return (count == 0 && !empty) ? 1 : count;
        }
    }
}

package bogush;

import java.io.*;
import java.nio.file.Path;

class LineCounter {
    static int count(Path file) throws IOException {
        try (InputStream is = new BufferedInputStream(new FileInputStream(file.toFile()))) {
            boolean empty = true;
            byte bytes[] = new byte[1024];
            int readChars;
            int count = 1;
            while ((readChars = is.read(bytes)) != -1) {
                empty = false;
                for (int i = 0; i < readChars; ++i) {
                    if (bytes[i] == '\n') {
                        ++count;
                    }
                }
            }
            if (empty) {
                return 0;
            } else {
                return count;
            }
        }
    }
}

Fix to count 0 on empty files and (amount of line-breaks + 1) on non-empty files


package com.rt2zz.reactnativecontacts;

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.Arrays;
import java.util.Collections;
import java.util.List;

public class ReactNativeContacts implements ReactPackage {

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

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

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

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

package com.rt2zz.reactnativecontacts;

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.Arrays;
import java.util.Collections;
import java.util.List;

public class ReactNativeContacts implements ReactPackage {

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

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

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

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

Fix Compilation Error in React Native 0.47.0


/*
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.yangtools.concepts;

public interface Registration<T> extends AutoCloseable {

    T getInstance();

    /**
     * Unregisters object
     *
     */
    @Override
    public void close() throws Exception;
}

/*
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.yangtools.concepts;

/**
 * Class representing a registration of an object. Such a registration is
 * a proper resource and should be cleaned up when no longer required, so
 * references to the object can be removed. This mechanism lies above the
 * usual Java reference mechanism, as the entity where the object is
 * registered may reside outside of the Java Virtual Machine.
 */
public interface Registration<T> extends AutoCloseable {
    /**
     * Return the object instance.
     *
     * @return Registered object.
     */
    T getInstance();

    /**
     * Unregisters the object. This operation is required not to invoke
     * blocking operations. Implementations which require interaction
     * with outside world must provide guarantees that any work is done
     * behind the scenes and the unregistration process looks as if it
     * has already succeeded once this method returns.
     */
    @Override
    void close() throws Exception;
}

Add registration interface contract definition

This clarifies the contractual details of Registration interface.
Notably it clarifies that the close() method is non-blocking.

Change-Id: Ie898c4ae2baf40c6d40e83a583f5046a9c1e0d84
Signed-off-by: Robert Varga <b8bd3df785fdc0ff42dd1710c5d91998513c57ef@cisco.com>


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

package co.phoenixlab.discord.api.endpoints;

import co.phoenixlab.discord.api.entities.SelfUser;
import co.phoenixlab.discord.api.request.EditProfileRequest;

import java.awt.image.BufferedImage;

public interface UsersEndpoint {

    BufferedImage getAvatar(long userId, String avatar)
            throws ApiException;

    SelfUser editProfile(EditProfileRequest request)
            throws ApiException;

}

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

package co.phoenixlab.discord.api.endpoints;

import co.phoenixlab.discord.api.entities.Presence;
import co.phoenixlab.discord.api.entities.SelfUser;
import co.phoenixlab.discord.api.request.EditProfileRequest;

import java.awt.image.BufferedImage;

public interface UsersEndpoint {

    BufferedImage getAvatar(long userId, String avatar)
            throws ApiException;

    SelfUser editProfile(EditProfileRequest request)
            throws ApiException;

    void updatePresence(Presence request)
            throws ApiException;

}

Add endpoint for updating own presence

Add endpoint for updating own presence


package flyway.asdistats;

import fi.nls.oskari.domain.map.view.Bundle;
import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;
import org.oskari.helpers.AppSetupHelper;

/**
 * Add statsgrid bundle to views that don't have it.
 */
public class V1_0__add_statsgrid_to_geoportal extends BaseJavaMigration {

    public void migrate(Context context) throws Exception {
        AppSetupHelper.addBundleToDefaultAndUserApps(
                context.getConnection(), new Bundle("statsgrid"));
    }
}

package flyway.asdistats;

import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;
import org.oskari.helpers.AppSetupHelper;

/**
 * Add statsgrid bundle to views that don't have it.
 */
public class V1_0__add_statsgrid_to_geoportal extends BaseJavaMigration {

    public void migrate(Context context) throws Exception {
        AppSetupHelper.addBundleToApps(context.getConnection(), "statsgrid");
    }
}

Use string version so we dont need import


package org.spoofax.jsglr2.testset;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Scanner;

import org.spoofax.jsglr2.testset.testinput.TestInput;

public abstract class TestSetInput<ContentType, Input extends TestInput<ContentType>> {

    public enum Type {
        SINGLE, // A single file from the org.spoofax.jsglr2.integration samples resources directory
        INCREMENTAL, // Multiple revisions of a single file, from a folder in the same samples resources directory
        MULTIPLE, // All files with a certain extension from an absolute path
        SIZED // Custom input string of dynamic size based on given argument
    }

    public final Type type;

    protected abstract Input getInput(String filename, ContentType input);

    public abstract List<Input> getInputs() throws IOException;

    protected TestSetInput(Type type) {
        this.type = type;
    }

    protected String getFileAsString(String filename) throws IOException {
        InputStream inputStream = getClass().getResourceAsStream("/samples/" + filename);

        return inputStreamAsString(inputStream);
    }

    protected String inputStreamAsString(InputStream inputStream) throws IOException {
        try(Scanner s = new Scanner(inputStream)) {
            s.useDelimiter("\\A");

            return s.hasNext() ? s.next() : "";
        }
    }

}

package org.spoofax.jsglr2.testset;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Scanner;

import org.spoofax.jsglr2.testset.testinput.TestInput;

public abstract class TestSetInput<ContentType, Input extends TestInput<ContentType>> {

    public enum Type {
        SINGLE, // A single file from the org.spoofax.jsglr2.integration samples resources directory
        INCREMENTAL, // Multiple revisions of a single file, from a folder in the same samples resources directory
        MULTIPLE, // All files with a certain extension from an absolute path
        SIZED // Custom input string of dynamic size based on given argument
    }

    public final Type type;

    protected abstract Input getInput(String filename, ContentType input);

    public abstract List<Input> getInputs() throws IOException;

    protected TestSetInput(Type type) {
        this.type = type;
    }

    protected String getFileAsString(String filename) throws IOException {
        InputStream inputStream = getClass().getResourceAsStream("/samples/" + filename);

        return inputStreamAsString(inputStream);
    }

    protected String inputStreamAsString(InputStream inputStream) throws IOException {
        try(Scanner s = new Scanner(inputStream)) {
            s.useDelimiter("\\A");

            // Replace all characters with codepoint value > 255 with a question mark to avoid parse failures,
            // assuming that they only appear in places where any character is allowed (strings, comments, ...)
            return s.hasNext() ? s.next().replaceAll("[^\\x00-\\xFF]", "?") : "";
        }
    }

}

Replace unicode characters in benchmark data


package org.cyclops.cyclopscore.metadata;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.ForgeRegistries;

/**
 * Item translation key exporter.
 */
public class RegistryExportableItemTranslationKeys implements IRegistryExportable {

    @Override
    public JsonObject export() {
        JsonObject element = new JsonObject();

        JsonArray elements = new JsonArray();
        element.add("items", elements);
        for (ResourceLocation key : ForgeRegistries.ITEMS.getKeys()) {
            Item value = ForgeRegistries.ITEMS.getValue(key);
            ItemStack itemStack = new ItemStack(value);
            String translationKey = itemStack.getTranslationKey();
            if (!translationKey.endsWith(".name")) {
                translationKey += ".name";
            }

            JsonObject object = new JsonObject();
            object.addProperty("translationKey", translationKey);
            object.add("item", IRegistryExportable.serializeItemStack(itemStack));
            elements.add(object);
        }

        return element;
    }

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

}

package org.cyclops.cyclopscore.metadata;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.ForgeRegistries;

/**
 * Item translation key exporter.
 */
public class RegistryExportableItemTranslationKeys implements IRegistryExportable {

    @Override
    public JsonObject export() {
        JsonObject element = new JsonObject();

        JsonArray elements = new JsonArray();
        element.add("items", elements);
        for (ResourceLocation key : ForgeRegistries.ITEMS.getKeys()) {
            Item value = ForgeRegistries.ITEMS.getValue(key);
            ItemStack itemStack = new ItemStack(value);
            String translationKey = itemStack.getTranslationKey();

            JsonObject object = new JsonObject();
            object.addProperty("translationKey", translationKey);
            object.add("item", IRegistryExportable.serializeItemStack(itemStack));
            elements.add(object);
        }

        return element;
    }

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

}

Fix incorrect translation key metadata export


/*-
 * Copyright 2016 Diamond Light Source Ltd.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.eclipse.dawnsci.analysis.api.processing;

import java.util.List;

/**
 * Interface to set up an operation processing run
 */
public interface IOperationBean {

	public void setDataKey(String dataKey);

	public void setFilePath(String fileName);

	public void setOutputFilePath(String outputFilePath);

	public void setDatasetPath(String datasetPath);

	public void setSlicing(String slicing);

	public void setPersistencePath(String persistencePath);

	public void setAxesNames(List<String>[] axesNames);

	public void setDeletePersistenceFile(boolean deletePersistenceFile);

	public void setXmx(String xmx);

	public void setDataDimensions(int[] dataDimensions);

	public void setReadable(boolean readable);

	public void setName(String name);

	public void setRunDirectory(String visitDir);

	public void setParallelizable(boolean parallelizable);

}

/*-
 * Copyright 2016 Diamond Light Source Ltd.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.eclipse.dawnsci.analysis.api.processing;

import java.util.List;

/**
 * Interface to set up an operation processing run
 */
public interface IOperationBean {

	public void setDataKey(String dataKey);

	public void setFilePath(String fileName);

	public void setOutputFilePath(String outputFilePath);

	public void setDatasetPath(String datasetPath);

	public void setSlicing(String slicing);

	public void setProcessingPath(String persistencePath);

	public void setAxesNames(List<String>[] axesNames);

	public void setDeleteProcessingFile(boolean deletePersistenceFile);

	public void setXmx(String xmx);

	public void setDataDimensions(int[] dataDimensions);

	public void setReadable(boolean readable);

	public void setName(String name);

	public void setRunDirectory(String visitDir);

	public void setParallelizable(boolean parallelizable);

}

Change persistence to processing for clarity

Signed-off-by: Jacob Filik <3a868c14e39a7f9b8bacb473ae15a5c5ce613b42@diamond.ac.uk>


package com.mangopay.entities.subentities;

import com.mangopay.core.Dto;
import com.mangopay.core.interfaces.IPayInPaymentDetails;
import com.mangopay.core.enumerations.DirectDebitType;

/**
 * Class representing the Direct-Debit type for mean of payment in PayIn entity.
 */
public class PayInPaymentDetailsDirectDebit extends Dto implements IPayInPaymentDetails {

    /**
     * Direct debit type.
     */
    public DirectDebitType DirectDebitType;

    /**
     * Mandate identifier.
     */
    public String MandateId;
}

package com.mangopay.entities.subentities;

import com.mangopay.core.Dto;
import com.mangopay.core.interfaces.IPayInPaymentDetails;
import com.mangopay.core.enumerations.DirectDebitType;

/**
 * Class representing the Direct-Debit type for mean of payment in PayIn entity.
 */
public class PayInPaymentDetailsDirectDebit extends Dto implements IPayInPaymentDetails {

    /**
     * Direct debit type.
     */
    public DirectDebitType DirectDebitType;

    /**
     * Mandate identifier.
     */
    public String MandateId;

    /**
     * An optional value to be specified on the user's bank statement
     */
    public String StatementDescriptor;
}

Add StatementDescriptor field for direct debits


package in.twizmwaz.cardinal.module.modules.appliedRegion.type;

import in.twizmwaz.cardinal.module.modules.appliedRegion.AppliedRegion;
import in.twizmwaz.cardinal.module.modules.filter.FilterModule;
import in.twizmwaz.cardinal.module.modules.filter.FilterState;
import in.twizmwaz.cardinal.module.modules.regions.RegionModule;
import in.twizmwaz.cardinal.module.modules.regions.type.BlockRegion;
import in.twizmwaz.cardinal.util.ChatUtils;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;

public class UseRegion extends AppliedRegion {

    public UseRegion(RegionModule region, FilterModule filter, String message) {
        super(region, filter, message);
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        if (event.getClickedBlock() == null) return;
        if (region.contains(new BlockRegion(null, event.getClickedBlock().getLocation().toVector())) && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) && filter.evaluate(event.getPlayer(), event.getClickedBlock(), event).equals(FilterState.DENY)) {
            event.setCancelled(true);
            ChatUtils.sendWarningMessage(event.getPlayer(), message);
        }
    }
}

package in.twizmwaz.cardinal.module.modules.appliedRegion.type;

import in.twizmwaz.cardinal.module.modules.appliedRegion.AppliedRegion;
import in.twizmwaz.cardinal.module.modules.filter.FilterModule;
import in.twizmwaz.cardinal.module.modules.filter.FilterState;
import in.twizmwaz.cardinal.module.modules.regions.RegionModule;
import in.twizmwaz.cardinal.module.modules.regions.type.BlockRegion;
import in.twizmwaz.cardinal.util.ChatUtils;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;

public class UseRegion extends AppliedRegion {

    public UseRegion(RegionModule region, FilterModule filter, String message) {
        super(region, filter, message);
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        if (event.getClickedBlock() == null || (event.getItem() != null && event.getItem().getType().isBlock())) return;
        if (region.contains(new BlockRegion(null, event.getClickedBlock().getLocation().toVector())) && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) && filter.evaluate(event.getPlayer(), event.getClickedBlock(), event).equals(FilterState.DENY)) {
            event.setCancelled(true);
            ChatUtils.sendWarningMessage(event.getPlayer(), message);
        }
    }
}

Fix use regions cancelling interaction with blocks


package org.broadinstitute.sting.gatk.walkers.CNV;

import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.Test;

import java.util.Arrays;

public class SymbolicAllelesIntegrationTest extends WalkerTest {

    public static String baseTestString(String reference, String VCF) {
        return "-T CombineVariants" +
                " -R " + reference +
                " --variant:vcf " + validationDataLocation + VCF +
                " -filteredRecordsMergeType KEEP_IF_ANY_UNFILTERED" +
                " -genotypeMergeOptions REQUIRE_UNIQUE" +
                " -setKey null" +
                " -o %s" +
                " -NO_HEADER";
    }

    @Test
    public void test1() {
        WalkerTestSpec spec = new WalkerTestSpec(
                baseTestString(b36KGReference, "symbolic_alleles_1.vcf"),
                1,
                Arrays.asList("89a1c56f264ac27a2a4be81072473b6f"));
        executeTest("Test symbolic alleles", spec);
    }

    @Test
    public void test2() {
        WalkerTestSpec spec = new WalkerTestSpec(
                baseTestString(b36KGReference, "symbolic_alleles_2.vcf"),
                1,
                Arrays.asList("3008d6f5044bc14801e5c58d985dec72"));
        executeTest("Test symbolic alleles mixed in with non-symbolic alleles", spec);
    }
}

package org.broadinstitute.sting.gatk.walkers.CNV;

import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.Test;

import java.util.Arrays;

public class SymbolicAllelesIntegrationTest extends WalkerTest {

    public static String baseTestString(String reference, String VCF) {
        return "-T CombineVariants" +
                " -R " + reference +
                " --variant:vcf " + validationDataLocation + VCF +
                " -filteredRecordsMergeType KEEP_IF_ANY_UNFILTERED" +
                " -genotypeMergeOptions REQUIRE_UNIQUE" +
                " -setKey null" +
                " -o %s" +
                " -NO_HEADER";
    }

    @Test
    public void test1() {
        WalkerTestSpec spec = new WalkerTestSpec(
                baseTestString(b36KGReference, "symbolic_alleles_1.vcf"),
                1,
                Arrays.asList("89a1c56f264ac27a2a4be81072473b6f"));
        executeTest("Test symbolic alleles", spec);
    }

    @Test
    public void test2() {
        WalkerTestSpec spec = new WalkerTestSpec(
                baseTestString(b36KGReference, "symbolic_alleles_2.vcf"),
                1,
                Arrays.asList("6645babc8c7d46be0da223477c7b1291"));
        executeTest("Test symbolic alleles mixed in with non-symbolic alleles", spec);
    }
}

Revert "Updating md5 for fixed file" because this was fixed properly in unstable (but will break SnpEff if put into Stable).

This reverts commit 6b4182c6ab3e214da4c73bc6f3687ac6d1c0b72c.


package devopsdistilled.operp.server.data.repo.items;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import devopsdistilled.operp.server.data.entity.items.Brand;
import devopsdistilled.operp.server.data.entity.items.Item;
import devopsdistilled.operp.server.data.entity.items.Product;

@Repository
public interface ItemRepository extends JpaRepository<Item, Long> {

	List<Item> findByProductAndBrand(Product product, Brand brand);

	List<Item> findByItemName(String itemName);

}

package devopsdistilled.operp.server.data.repo.items;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import devopsdistilled.operp.server.data.entity.items.Brand;
import devopsdistilled.operp.server.data.entity.items.Item;
import devopsdistilled.operp.server.data.entity.items.Product;

@Repository
public interface ItemRepository extends JpaRepository<Item, Long> {

	Item findByProductAndBrand(Product product, Brand brand);

	Item findByItemName(String itemName);

}

Change return type of declared method to new unique constraints

OPEN - task 32: Add "Create Item" functionalities
http://github.com/DevOpsDistilled/OpERP/issues/issue/32


package com.nulabinc.backlog4j.internal.json;

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

/**
 * @author nulab-inc
 */
public abstract class AbstractJSONImplTest {

    protected InternalFactoryJSONImpl factory = new InternalFactoryJSONImpl();
    protected TimeZone timeZone = TimeZone.getTimeZone("Asia/Tokyo") ;

    protected String getJsonString(String resourceFilePath) throws IOException {
        String fileName = SpaceJSONImplTest.class.getClassLoader().getResource(resourceFilePath).getPath();

        byte[] fileContentBytes = Files.readAllBytes(Paths.get(fileName));
        String fileContentStr = new String(fileContentBytes, StandardCharsets.UTF_8);
        return fileContentStr;
    }
}

package com.nulabinc.backlog4j.internal.json;

import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TimeZone;

/**
 * @author nulab-inc
 */
public abstract class AbstractJSONImplTest {

    protected InternalFactoryJSONImpl factory = new InternalFactoryJSONImpl();
    protected TimeZone timeZone = TimeZone.getTimeZone("Asia/Tokyo");

    protected String getJsonString(String resourceFilePath) throws IOException {
        InputStreamReader r = null;
        try {
            r = new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceFilePath), "UTF-8");
            CharArrayWriter writer = new CharArrayWriter();
            char buff[] = new char[4096];
            int size;
            while ((size = r.read(buff)) > 0) {
                writer.write(buff, 0, size);
            }
            return writer.toString();
        } finally {
            if (r != null) {
                r.close();
            }
        }
    }
}

Fix to work in Windows

Fix to work in Windows

https://github.com/nulab/backlog4j/issues/49


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

/**
 * @author David BRASSELY (brasseld at gmail.com)
 */
public class Member {

	/**
	 * The name of user member
	 */
    private String username;

    /**
     * The role give to the user
     */
    private TeamRole role;

    public TeamRole getRole() {
        return role;
    }

    public void setRole(TeamRole role) {
        this.role = role;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
}

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

import java.util.Date;

/**
 * @author David BRASSELY (brasseld at gmail.com)
 */
public class Member {

	/**
	 * The name of user member
	 */
    private String username;

    /**
     * The role give to the user
     */
    private TeamRole role;

    /**
     * The membership creation date
     */
    private Date createdAt;

    /**
     * The membership last updated date
     */
    private Date updatedAt;

    public TeamRole getRole() {
        return role;
    }

    public void setRole(TeamRole role) {
        this.role = role;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }
}

Add created_at and updated_at fields

feat(membership): Add created_at and updated_at fields


package org.vaadin.mcont.demo;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Title;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Table;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@Theme("demo")
@Title("MCont Add-on Demo")
@SuppressWarnings("serial")
public class DemoUI extends UI
{

    @Override
    protected void init(VaadinRequest request) {
    	Table table = new Table();
    	// TODO create and set container

    	final VerticalLayout layout = new VerticalLayout();
        layout.setStyleName("demoContentLayout");
        layout.setSizeFull();
        layout.addComponent(table);
        setContent(layout);

    }

}

Reformat source code according to Vaadin conventions


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

package com.faveset.khttp;

class InvalidRequestException extends Exception {
    public InvalidRequestException(String reason) {
        super(reason);
    }
}

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

package com.faveset.khttp;

class InvalidRequestException extends Exception {
    private int mErrorCode;

    public InvalidRequestException(String reason) {
        super(reason);
    }

    public InvalidRequestException(String reason, int errorCode) {
        super(reason);
        mErrorCode = errorCode;
    }

    /**
     * @return The error code or 0 if none.
     */
    public int getErrorCode() {
        return mErrorCode;
    }
}

Add http error code to constructor.

Add http error code to constructor.


package seedu.taskell.logic.commands;

import seedu.taskell.commons.core.EventsCenter;
import seedu.taskell.commons.core.Messages;
import seedu.taskell.commons.events.ui.IncorrectCommandAttemptedEvent;
import seedu.taskell.model.Model;

/**
 * Represents a command with hidden internal logic and the ability to be executed.
 */
public abstract class Command {
    protected Model model;

    /**
     * Constructs a feedback message to summarise an operation that displayed a listing of tasks.
     *
     * @param displaySize used to generate summary
     * @return summary message for tasks displayed
     */
    public static String getMessageForTaskListShownSummary(int displaySize) {
        return String.format(Messages.MESSAGE_TASKS_LISTED_OVERVIEW, displaySize);
    }

    /**
     * Executes the command and returns the result message.
     *
     * @return feedback message of the operation result for display
     */
    public abstract CommandResult execute();

    /**
     * Provides any needed dependencies to the command.
     * Commands making use of any of these should override this method to gain
     * access to the dependencies.
     */
    public void setData(Model model) {
        this.model = model;
    }

    /**
     * Raises an event to indicate an attempt to execute an incorrect command
     */
    protected void indicateAttemptToExecuteIncorrectCommand() {
        EventsCenter.getInstance().post(new IncorrectCommandAttemptedEvent(this));
    }
}

package seedu.taskell.logic.commands;

import seedu.taskell.commons.core.EventsCenter;
import seedu.taskell.commons.core.Messages;
import seedu.taskell.commons.events.ui.IncorrectCommandAttemptedEvent;
import seedu.taskell.commons.events.ui.JumpToListRequestEvent;
import seedu.taskell.model.Model;

/**
 * Represents a command with hidden internal logic and the ability to be executed.
 */
public abstract class Command {
    protected Model model;

    /**
     * Constructs a feedback message to summarise an operation that displayed a listing of tasks.
     *
     * @param displaySize used to generate summary
     * @return summary message for tasks displayed
     */
    public static String getMessageForTaskListShownSummary(int displaySize) {
        return String.format(Messages.MESSAGE_TASKS_LISTED_OVERVIEW, displaySize);
    }

    /**
     * Executes the command and returns the result message.
     *
     * @return feedback message of the operation result for display
     */
    public abstract CommandResult execute();

    /**
     * Provides any needed dependencies to the command.
     * Commands making use of any of these should override this method to gain
     * access to the dependencies.
     */
    public void setData(Model model) {
        this.model = model;
    }

    /**
     * Raises an event to indicate an attempt to execute an incorrect command
     */
    protected void indicateAttemptToExecuteIncorrectCommand() {
        EventsCenter.getInstance().post(new IncorrectCommandAttemptedEvent(this));
    }

    //@@author A0139257X-reused
    /**
     * Raises an event to jump to the given index
     */
    protected void jumpToIndex(int index) {
        EventsCenter.getInstance().post(new JumpToListRequestEvent(index));
    }
    //@@author
}

Add method to scroll to selected index

Add method to scroll to selected index


package liquibase.database.typeconversion.core;

import liquibase.database.Database;
import liquibase.database.structure.type.UUIDType;
import liquibase.exception.DatabaseException;

public class Postgres83TypeConverter extends PostgresTypeConverter {

    @Override
    public int getPriority() {
        return super.getPriority()+1;
    }

    @Override
    public boolean supports(Database database) {
        if (database.getConnection() == null) {
            return false;
        }
        try {
            return super.supports(database) && database.getDatabaseMajorVersion() >= 8 && database.getDatabaseMinorVersion() >= 3;
        } catch (DatabaseException e) {
            return false;
        }
    }

    @Override
    public UUIDType getUUIDType() {
        return new UUIDType("UUID");
    }

}

package liquibase.database.typeconversion.core;

import liquibase.database.Database;
import liquibase.database.structure.type.UUIDType;
import liquibase.exception.DatabaseException;

public class Postgres83TypeConverter extends PostgresTypeConverter {

    @Override
    public int getPriority() {
        return super.getPriority()+1;
    }

    @Override
    public boolean supports(Database database) {
        if (database==null || database.getConnection() == null) {
            return false;
        }
        try {
            return super.supports(database) && database.getDatabaseMajorVersion() >= 8 && database.getDatabaseMinorVersion() >= 3;
        } catch (DatabaseException e) {
            return false;
        }
    }

    @Override
    public UUIDType getUUIDType() {
        return new UUIDType("UUID");
    }

}

Check for null database to allow ValidatingVisitorTest to pass

git-svn-id: a91d99a4c51940524e539abe295d6ea473345dd2@1386 e6edf6fb-f266-4316-afb4-e53d95876a76


package no.steria.skuldsku.testrunner.common;

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

import no.steria.skuldsku.testrunner.httprunner.result.HttpCallResult;

public final class HttpClientIdentifierMapper implements ClientIdentifierMapper {

    private final Map<String, String> map;

    public HttpClientIdentifierMapper(List<HttpCallResult> results) {
        map = new HashMap<>();
        for (HttpCallResult r : results) {
            map.put(r.getExpected().getClientIdentifier(), r.getActual().getClientIdentifier());
        }
        map.put(null, null);
        map.put("", "");
    }

    @Override
    public String translateToActual(String expectedClientIdentifier) {
        return map.get(expectedClientIdentifier);
    }

}

package no.steria.skuldsku.testrunner.common;

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

import no.steria.skuldsku.testrunner.httprunner.result.HttpCallResult;

public final class HttpClientIdentifierMapper implements ClientIdentifierMapper {

    private final Map<String, String> map;

    public HttpClientIdentifierMapper(List<HttpCallResult> results) {
        map = new HashMap<>();
        for (HttpCallResult r : results) {
            map.put(r.getExpected().getClientIdentifier(), r.getActual().getClientIdentifier());
        }
        map.put(null, null);
        map.put("", "");
    }

    @Override
    public String translateToActual(String expectedClientIdentifier) {
        final String value = map.get(expectedClientIdentifier);
        return (value != null) ? value : expectedClientIdentifier;
    }

}

Use expected identifier as actual if no match can be found.


package com.pushtorefresh.storio.db.operation.delete;

import android.support.annotation.NonNull;

import java.util.Collections;
import java.util.Map;

public class DeleteCollectionOfObjectsResult<T> {

    @NonNull private final Map<T, DeleteResult> results;

    public DeleteCollectionOfObjectsResult(@NonNull Map<T, DeleteResult> results) {
        this.results = Collections.unmodifiableMap(results);
    }

    @NonNull public Map<T, DeleteResult> results() {
        return results;
    }

    public boolean wasDeleted(T object) {
        return results.containsKey(object);
    }

    public boolean wasNotDeleted(T object) {
        return !results.containsKey(object);
    }
}

package com.pushtorefresh.storio.db.operation.delete;

import android.support.annotation.NonNull;

import java.util.Collections;
import java.util.Map;

public class DeleteCollectionOfObjectsResult<T> {

    @NonNull private final Map<T, DeleteResult> results;

    public DeleteCollectionOfObjectsResult(@NonNull Map<T, DeleteResult> results) {
        this.results = Collections.unmodifiableMap(results);
    }

    @NonNull public Map<T, DeleteResult> results() {
        return results;
    }

    public boolean wasDeleted(@NonNull T object) {
        return results.containsKey(object);
    }

    public boolean wasNotDeleted(@NonNull T object) {
        return !results.containsKey(object);
    }
}

Add @NonNull annotations for wasDeleted() and wasNotDeleted()


package org.optaplanner.benchmark.impl.report;

public class ReportHelper {

    /**
     * Escape illegal HTML element id characters, such as a dot.
     * <p/>
     * This escape function guarantees that 2 distinct strings will result into 2 distinct escape strings
     * (presuming that both have been escaped by this method).
     * @param rawHtmlId never null
     * @return never null
     */
    public static String escapeHtmlId(String rawHtmlId) {
        return rawHtmlId
                .replaceAll("-", "--") // make '-' the escape character
                .replaceAll("\\.", "-d")
                .replaceAll(":", "-c")
                .replaceAll(";", "-s")
                .replaceAll("\\$", "-m");
    }

}

package org.optaplanner.benchmark.impl.report;

public class ReportHelper {

    /**
     * Escape illegal HTML element id characters, such as a dot.
     * <p/>
     * This escape function guarantees that 2 distinct strings will result into 2 distinct escape strings
     * (presuming that both have been escaped by this method).
     * @param rawHtmlId never null
     * @return never null
     */
    public static String escapeHtmlId(String rawHtmlId) {
        // Uses unicode numbers to escape, see http://unicode-table.com
        // Uses '-' as the escape character
        return rawHtmlId
                .replaceAll(" ", "-0020")
                .replaceAll("!", "-0021")
                .replaceAll("#", "-0023")
                .replaceAll("\\$", "-0024")
                .replaceAll(",", "-002C")
                .replaceAll("-", "-002D")
                .replaceAll("\\.", "-002E")
                .replaceAll("\\(", "-0028")
                .replaceAll("\\)", "-0029")
                .replaceAll(":", "-003A")
                .replaceAll(";", "-003B")
                .replaceAll("\\?", "-003F");
    }

}

Improve escapeHtmlId with unicode escape numbers and space and ()


package com.edulify.modules.geolocation;

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

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

import static org.mockito.Mockito.*;

/**
 * @deprecated Deprecated as of 2.2.0. Source should be removed.
 */
@Deprecated
public class GeolocationServiceTest {

  @Test
  public void shouldGetAGeolocationForAGivenIp() throws Exception {

    final GeolocationProvider provider = mock(GeolocationProvider.class);

    String ipAddress = "192.30.252.129";
    String countryCode = "BR";
    final Geolocation geolocation = new Geolocation(ipAddress, countryCode);
    when(provider.get(ipAddress)).thenReturn(CompletableFuture.completedFuture(geolocation));
    final GeolocationCache cache = mock(GeolocationCache.class);

    GeolocationService service = new GeolocationService(provider, cache);
    Geolocation target = service.getGeolocation(ipAddress).toCompletableFuture().get(1, TimeUnit.SECONDS);

    verify(cache).set(geolocation);

    Assert.assertSame(target, geolocation);
  }
}

package com.edulify.modules.geolocation;

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

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

import static org.mockito.Mockito.*;

/**
 * @deprecated Deprecated as of 2.2.0. Source should be removed.
 */
@Deprecated
public class GeolocationServiceTest {

  @Test
  public void shouldGetAGeolocationForAGivenIp() throws Exception {

    final GeolocationProvider provider = mock(GeolocationProvider.class);

    String ipAddress = "192.30.252.129";
    String countryCode = "BR";
    final Geolocation geolocation = new Geolocation(ipAddress, countryCode);
    when(provider.get(ipAddress)).thenReturn(CompletableFuture.completedFuture(geolocation));
    final GeolocationCache cache = mock(GeolocationCache.class);

    GeolocationService service = new GeolocationService(provider, cache);
    Geolocation target = service.getGeolocation(ipAddress).toCompletableFuture().get(1, TimeUnit.SECONDS);

    verify(cache, timeout(100).times(1)).set(geolocation);

    Assert.assertSame(target, geolocation);
  }
}

Adjust test for concurrent environment

Adjust test for concurrent environment


package org.springframework.data.cloudant.core;

import com.google.gson.*;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;

import java.lang.reflect.Type;

/**
 * Created by kevin on 7/14/15.
 */
public class DateTimeDataAdapter implements JsonSerializer<DateTime>, JsonDeserializer<DateTime> {
    private final DateTimeFormatter fmt = ISODateTimeFormat.dateTime().withZoneUTC();

    @Override
    public JsonElement serialize(DateTime src, Type srcType, JsonSerializationContext context) {
        return new JsonPrimitive(fmt.print(src));
    }

    @Override
    public DateTime deserialize(JsonElement json, Type type, JsonDeserializationContext context)
            throws JsonParseException {
        return fmt.parseDateTime(json.getAsString());
    }
}

package org.springframework.data.cloudant.core;

import com.google.gson.*;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;

import java.lang.reflect.Type;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Locale;

/**
 * Created by kevin on 7/14/15.
 */
public class DateTimeDataAdapter implements JsonSerializer<DateTime>, JsonDeserializer<DateTime> {
    private final DateTimeFormatter fmt = ISODateTimeFormat.dateTime().withZoneUTC();
    private static final String[] DATE_FORMATS = new String[] {
            "yyyy-MM-dd'T'HH:mm:ssZ",
            "yyyy-MM-dd HH:mm:ss Z",
            "yyyy-MM-dd HH:mm:ss z"
    };

    @Override
    public JsonElement serialize(DateTime src, Type srcType, JsonSerializationContext context) {
        return new JsonPrimitive(fmt.print(src));
    }

    @Override
    public DateTime deserialize(JsonElement json, Type type, JsonDeserializationContext context)
            throws JsonParseException {
        for (String format : DATE_FORMATS) {
            try {
                return DateTime.parse(json.getAsString(), DateTimeFormat.forPattern(format));
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
        }
        throw new JsonParseException("Unparseable date: \"" + json.getAsString()
                + "\". Supported formats: " + Arrays.toString(DATE_FORMATS));

    }
}

Enable deserializer to support multi date formats


/**
 *
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for license information.
 *
 */

package com.microsoft.azure.credentials;

public class UserTokenCredentialsTests {

}

/**
 *
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for license information.
 *
 */

package com.microsoft.azure.credentials;

import com.microsoft.aad.adal4j.AuthenticationResult;

import org.junit.Assert;

import org.junit.Test;

import java.io.IOException;
import java.util.Date;

public class UserTokenCredentialsTests {
    MockUserTokenCredentials credentials = new MockUserTokenCredentials(
            "clientId",
            "domain",
            "username",
            "password",
            "redirect",
            AzureEnvironment.AZURE
    );

    @Test
    public void testAcquireToken() throws Exception {
        credentials.refreshToken();
        Assert.assertEquals("token1", credentials.getToken());
        Thread.sleep(1000);
        Assert.assertEquals("token2", credentials.getToken());
    }

    public class MockUserTokenCredentials extends UserTokenCredentials {
        private AuthenticationResult authenticationResult;

        public MockUserTokenCredentials(String clientId, String domain, String username, String password, String clientRedirectUri, AzureEnvironment environment) {
            super(clientId, domain, username, password, clientRedirectUri, environment);
        }

        @Override
        public String getToken() throws IOException {
            if (authenticationResult != null &&
                    authenticationResult.getExpiresOnDate().before(new Date())) {
                acquireAccessTokenFromRefreshToken();
            } else {
                acquireAccessToken();
            }
            return authenticationResult.getAccessToken();
        }

        @Override
        public void refreshToken() throws IOException {
            acquireAccessToken();
        }

        private void acquireAccessToken() throws IOException {
            this.authenticationResult = new AuthenticationResult(
                    null,
                    "token1",
                    "refresh",
                    0,
                    null,
                    null,
                    false);
        }

        private void acquireAccessTokenFromRefreshToken() throws IOException {
            this.authenticationResult = new AuthenticationResult(
                    null,
                    "token2",
                    "refresh",
                    0,
                    null,
                    null,
                    false);
        }
    }
}

Add a test for user credentials

Add a test for user credentials


package cgeo.geocaching.utils;

import cgeo.geocaching.BuildConfig;

public class BranchDetectionHelper {

    // should contain the version name of the last feature release
    public static final String FEATURE_VERSION_NAME = "2022.08.06-RC";

    // should contain version names of active bugfix releases since last feature release, oldest first
    // empty the part within curly brackets when creating a new release branch from master
    public static final String[] BUGFIX_VERSION_NAME = new String[]{ "" };

    private BranchDetectionHelper() {
        // utility class
    }

    /**
     * @return true, if BUILD_TYPE is not a nightly or debug build (e. g.: release, rc, legacy)
     */
    // BUILD_TYPE is detected as constant but can change depending on the build configuration
    @SuppressWarnings("ConstantConditions")
    public static boolean isProductionBuild() {
        return !(BuildConfig.BUILD_TYPE.equals("debug") || BuildConfig.BUILD_TYPE.equals("nightly"));
    }

    /**
     * @return true, if BUILD_TYPE is a debug build. Nightly builds are **not** considered as developer build!
     */
    // BUILD_TYPE is detected as constant but can change depending on the build configuration
    @SuppressWarnings("ConstantConditions")
    public static boolean isDeveloperBuild() {
        return BuildConfig.BUILD_TYPE.equals("debug");
    }

}

package cgeo.geocaching.utils;

import cgeo.geocaching.BuildConfig;

public class BranchDetectionHelper {

    // should contain the version name of the last feature release
    public static final String FEATURE_VERSION_NAME = "2022.08.08-RC";

    // should contain version names of active bugfix releases since last feature release, oldest first
    // empty the part within curly brackets when creating a new release branch from master
    public static final String[] BUGFIX_VERSION_NAME = new String[]{ "" };

    private BranchDetectionHelper() {
        // utility class
    }

    /**
     * @return true, if BUILD_TYPE is not a nightly or debug build (e. g.: release, rc, legacy)
     */
    // BUILD_TYPE is detected as constant but can change depending on the build configuration
    @SuppressWarnings("ConstantConditions")
    public static boolean isProductionBuild() {
        return !(BuildConfig.BUILD_TYPE.equals("debug") || BuildConfig.BUILD_TYPE.equals("nightly"));
    }

    /**
     * @return true, if BUILD_TYPE is a debug build. Nightly builds are **not** considered as developer build!
     */
    // BUILD_TYPE is detected as constant but can change depending on the build configuration
    @SuppressWarnings("ConstantConditions")
    public static boolean isDeveloperBuild() {
        return BuildConfig.BUILD_TYPE.equals("debug");
    }

}

Prepare version number for next beta

Prepare version number for next beta


package org.rabix.executor.pathmapper.local;

import java.io.File;
import java.io.IOException;
import java.util.Map;

import org.rabix.bindings.mapper.FileMappingException;
import org.rabix.bindings.mapper.FilePathMapper;
import org.rabix.executor.config.StorageConfiguration;

import com.google.inject.Inject;

public class LocalPathMapper implements FilePathMapper {

  private final StorageConfiguration storageConfig;

  @Inject
  public LocalPathMapper(final StorageConfiguration storageConfig) {
    this.storageConfig = storageConfig;
  }

  @Override
  public String map(String path, Map<String, Object> config) throws FileMappingException {
    if (!path.startsWith(File.separator)) {
      try {
        return new File(storageConfig.getPhysicalExecutionBaseDir(), path).getCanonicalPath();
      } catch (IOException e) {
        throw new FileMappingException(e);
      }
    }
    return path;
  }

}

package org.rabix.executor.pathmapper.local;

import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Map;

import org.rabix.bindings.mapper.FileMappingException;
import org.rabix.bindings.mapper.FilePathMapper;
import org.rabix.executor.config.StorageConfiguration;

import com.google.inject.Inject;

public class LocalPathMapper implements FilePathMapper {

  private final StorageConfiguration storageConfig;

  @Inject
  public LocalPathMapper(final StorageConfiguration storageConfig) {
    this.storageConfig = storageConfig;
  }

  @Override
  public String map(String path, Map<String, Object> config) throws FileMappingException {
    if (!Paths.get(path).isAbsolute()) {
      try {
        return new File(storageConfig.getPhysicalExecutionBaseDir(), path).getCanonicalPath();
      } catch (IOException e) {
        throw new FileMappingException(e);
      }
    }
    return path;
  }

}

Fix issue with Windows paths

Fix issue with Windows paths


package de.schunterkino.kinoapi.websocket.messages.christie;

import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

import de.schunterkino.kinoapi.websocket.messages.BaseMessage;

public class LampOffMessage extends BaseMessage {
	public String timestamp;

	public LampOffMessage(Instant lampOffTime) {
		super("playback", "lamp_off");

		DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME.withZone(ZoneId.systemDefault());
		this.timestamp = formatter.format(lampOffTime);
	}
}

package de.schunterkino.kinoapi.websocket.messages.christie;

import java.time.Instant;

import de.schunterkino.kinoapi.websocket.messages.BaseMessage;

public class LampOffMessage extends BaseMessage {
	public String timestamp;

	public LampOffMessage(Instant lampOffTime) {
		super("playback", "lamp_off");

		this.timestamp = lampOffTime.toString();
	}
}

Fix timestamp format in lamp_off message


package dynamo.backlog.tasks.files;

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

import dynamo.manager.DownloadableManager;

public class MoveFileTaskExecutor extends FileOperationTaskExecutor<MoveFileTask> {

	private Path source;
	private Path destination;

	public MoveFileTaskExecutor(MoveFileTask item) {
		super(item);
		this.source = item.getSource();
		this.destination = item.getDestination();
	}

	@Override
	public void execute() throws IOException {

		if (!Files.exists(source)) {
			throw new IOException( String.format("Source file %s does not exist", source.toAbsolutePath().toString() ));
		}

		if (Files.isWritable(source.getParent()) && !source.toAbsolutePath().equals( destination.toAbsolutePath() )) {
			Files.createDirectories( destination.getParent() );
			Files.move( source, destination, StandardCopyOption.REPLACE_EXISTING);
			DownloadableManager.getInstance().addFile( task.getDownloadable(), destination );
		}
		boolean parentFolderEmpty = FileUtils.isDirEmpty( source.getParent() );
		if (parentFolderEmpty) {
			Files.delete( source.getParent() );
		}

	}

	@Override
	public boolean isFinished() {
		if (!Files.exists( source )) {
			return true;
		}
		return Files.exists( destination );
	}

}

package dynamo.backlog.tasks.files;

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

import dynamo.manager.DownloadableManager;

public class MoveFileTaskExecutor extends FileOperationTaskExecutor<MoveFileTask> {

	private Path source;
	private Path destination;

	public MoveFileTaskExecutor(MoveFileTask item) {
		super(item);
		this.source = item.getSource();
		this.destination = item.getDestination();
	}

	@Override
	public void execute() throws IOException {

		if (!Files.exists(source)) {
			throw new IOException( String.format("Source file %s does not exist", source.toAbsolutePath().toString() ));
		}

		if (Files.isWritable(source.getParent()) && !source.toAbsolutePath().equals( destination.toAbsolutePath() )) {
			Files.createDirectories( destination.getParent() );
			Files.copy( source, destination, StandardCopyOption.REPLACE_EXISTING);
			Files.delete( source );
			DownloadableManager.getInstance().addFile( task.getDownloadable(), destination );
		}
		boolean parentFolderEmpty = FileUtils.isDirEmpty( source.getParent() );
		if (parentFolderEmpty) {
			Files.delete( source.getParent() );
		}

	}

	@Override
	public boolean isFinished() {
		if (!Files.exists( source )) {
			return true;
		}
		return Files.exists( destination );
	}

}

Replace move by copy then delete

Replace move by copy then delete


/**
 * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.web.server.push.analytics.formatting;

import com.opengamma.engine.value.ValueSpecification;

/**
 * Formats null values for display in the client.
 */
/* package */ class NullFormatter extends AbstractFormatter<Object> {

  /* package */ NullFormatter() {
    super(Object.class);
    addFormatter(new Formatter<Object>(Format.HISTORY) {
      @Override
      Object format(Object value, ValueSpecification valueSpec) {
        return null;
      }
    });
    addFormatter(new Formatter<Object>(Format.EXPANDED) {
      @Override
      Object format(Object value, ValueSpecification valueSpec) {
        return null;
      }
    });
  }

  @Override
  public Object formatCell(Object value, ValueSpecification valueSpec) {
    return "";
  }

  @Override
  public DataType getDataType() {
    return DataType.PRIMITIVE;
  }
}

/**
 * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.web.server.push.analytics.formatting;

import com.opengamma.engine.value.ValueSpecification;

/**
 * Formats null values for display in the client.
 */
/* package */ class NullFormatter extends AbstractFormatter<Object> {

  /* package */ NullFormatter() {
    super(Object.class);
    addFormatter(new Formatter<Object>(Format.HISTORY) {
      @Override
      Object format(Object value, ValueSpecification valueSpec) {
        return null;
      }
    });
    addFormatter(new Formatter<Object>(Format.EXPANDED) {
      @Override
      Object format(Object value, ValueSpecification valueSpec) {
        return "";
      }
    });
  }

  @Override
  public Object formatCell(Object value, ValueSpecification valueSpec) {
    return "";
  }

  @Override
  public DataType getDataType() {
    return DataType.PRIMITIVE;
  }
}

Format expanded null as empty string

[PLAT-2785] Format expanded null as empty string


package org.apache.wicket.bean.validation;

import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.model.IPropertyReflectionAwareModel;

/**
 * Resolves the property to be validated for the given form component. Implementations, incuding the
 * default one, usually check the form component's model for some subclass that can provide the
 * necessary meta information to resolve the property.
 *
 * @see DefaultPropertyResolver
 * @see IPropertyReflectionAwareModel
 *
 * @author igor
 *
 */
@FunctionalInterface
public interface IPropertyResolver
{
	Property resolveProperty(FormComponent<?> component);
}

package org.apache.wicket.bean.validation;

import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.model.IPropertyReflectionAwareModel;

/**
 * Resolves the property to be validated for the given form component. Implementations, including the
 * default one, usually check the form component's model for some subclass that can provide the
 * necessary meta information to resolve the property.
 *
 * @see DefaultPropertyResolver
 * @see IPropertyReflectionAwareModel
 *
 * @author igor
 *
 */
@FunctionalInterface
public interface IPropertyResolver
{
	Property resolveProperty(FormComponent<?> component);
}

Fix a typo in javadoc

Fix a typo in javadoc


/*
 * Copyright 2022 the original author or authors.
 *
 * 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.
 */

/**
 * Classes related to JVM dependencies and components
 */
@NonNullApi
package org.gradle.api.plugins.jvm;

import org.gradle.api.NonNullApi;

Add missing newline from EOF

Add missing newline from EOF


package org.usfirst.frc.team3335.robot.subsystems;

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import org.usfirst.frc.team3335.robot.RobotMap;

import com.ctre.CANTalon;

import edu.wpi.first.wpilibj.CANSpeedController;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
import edu.wpi.first.wpilibj.command.Subsystem;

public class Intake extends Subsystem implements LoggableSubsystem {

	private CANTalon motor;

	private double motorValue = 0.5;

	public Intake() {
		motor = new CANTalon(RobotMap.INTAKE_MOTOR);
		motor.set(0);
		//motor.setControlMode();
	}
	public void turnOn(){
		set(motorValue);
	}

	public void turnOff(){
		set(0);
	}

	public void set(double value) {
		motor.set(value);
	}

	@Override
	protected void initDefaultCommand() {
		// TODO Auto-generated method stub

	}

	@Override
	public void log() {
		SmartDashboard.putNumber("Intake Value",motor.get());
	}
}

package org.usfirst.frc.team3335.robot.subsystems;

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import org.usfirst.frc.team3335.robot.RobotMap;

import com.ctre.CANTalon;

import edu.wpi.first.wpilibj.CANSpeedController;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
import edu.wpi.first.wpilibj.command.Subsystem;

public class Intake extends Subsystem implements LoggableSubsystem {

	private CANTalon motor;

	private double motorValue = 1.0; //0.5;

	public Intake() {
		motor = new CANTalon(RobotMap.INTAKE_MOTOR);
		motor.set(0);
		//motor.setControlMode();
	}
	public void turnOn(){
		set(motorValue);
	}

	public void turnOff(){
		set(0);
	}

	public void set(double value) {
		motor.set(value);
	}

	@Override
	protected void initDefaultCommand() {
		// TODO Auto-generated method stub

	}

	@Override
	public void log() {
		SmartDashboard.putNumber("Intake Value",motor.get());
	}
}

Increase intake motor value to 1.0.

Increase intake motor value to 1.0.


/*
 * Copyright 2012 the original author or authors.
 *
 * 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.nokia.dempsy.messagetransport.blockingqueue;

import java.util.concurrent.BlockingQueue;

import com.nokia.dempsy.messagetransport.Destination;

public class BlockingQueueDestination implements Destination
{
   protected BlockingQueue<byte[]> queue = null;

   public BlockingQueueDestination(BlockingQueue<byte[]> queue) { this.queue = queue; }

   @Override
   public int hashCode() { return queue.hashCode(); }

   @Override
   public boolean equals(Object other) { return queue.equals(((BlockingQueueDestination) other).queue); }
}

/*
 * Copyright 2012 the original author or authors.
 *
 * 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.nokia.dempsy.messagetransport.blockingqueue;

import java.util.concurrent.BlockingQueue;

import com.nokia.dempsy.messagetransport.Destination;

public class BlockingQueueDestination implements Destination
{
   protected BlockingQueue<byte[]> queue = null;

   public BlockingQueueDestination(BlockingQueue<byte[]> queue) { this.queue = queue; }

   @Override
   public int hashCode() { return queue.hashCode(); }

   @Override
   public boolean equals(Object other) { return other == null ? false : queue.equals(((BlockingQueueDestination) other).queue); }
}

Fix a NPE plaguing tests that use the BlockingQueue transport.


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 me.konsolas.conditionalcommands.placeholders;

import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

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

public abstract class AbstractParameteredPlaceholder implements Placeholder {
    private final Pattern pattern;

    AbstractParameteredPlaceholder(String base) {
        this.pattern = Pattern.compile("-" + base + ":([A-Za-z0-9%.]*)-");
    }

    @Override
    public boolean shouldApply(String test) {
        return pattern.matcher(test).find();
    }

    protected abstract String getSub(Player player, String param);

    @Override
    public String doSubstitution(String input, Player player) {
        Matcher matcher = pattern.matcher(input);

        while (matcher.find()) {
            input = input.replaceAll(Pattern.quote(matcher.group()), getSub(player, matcher.group(1)));
        }

        return input;
    }

    @Override
    public void init(Plugin plugin) {
    }
}

package me.konsolas.conditionalcommands.placeholders;

import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

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

public abstract class AbstractParameteredPlaceholder implements Placeholder {
    private final Pattern pattern;

    AbstractParameteredPlaceholder(String base) {
        this.pattern = Pattern.compile("-" + base + ":([A-Za-z0-9%._]*)-");
    }

    @Override
    public boolean shouldApply(String test) {
        return pattern.matcher(test).find();
    }

    protected abstract String getSub(Player player, String param);

    @Override
    public String doSubstitution(String input, Player player) {
        Matcher matcher = pattern.matcher(input);

        while (matcher.find()) {
            input = input.replaceAll(Pattern.quote(matcher.group()), getSub(player, matcher.group(1)));
        }

        return input;
    }

    @Override
    public void init(Plugin plugin) {
    }
}

Add _ as valid parameter symbol

Add _ as valid parameter symbol


package org.ovirt.engine.core.bll;

import java.util.List;

import org.ovirt.engine.core.common.businessentities.storage.RepoImage;
import org.ovirt.engine.core.common.queries.GetImagesListParametersBase;
import org.ovirt.engine.core.compat.Guid;

public abstract class GetImagesListQueryBase<P extends GetImagesListParametersBase> extends QueriesCommandBase<P> {

    public GetImagesListQueryBase(P parameters) {
        super(parameters);
    }

    @Override
    protected void executeQueryCommand() {
        // Fetch all the Iso files of a given type for storage pool with active storage domain of this domain Id.
        getQueryReturnValue().setReturnValue(getUserRequestForStorageDomainRepoFileList());
    }

    /**
     * @return The storage domain to get the images from
     */
    protected abstract Guid getStorageDomainIdForQuery();

    protected List<RepoImage> getUserRequestForStorageDomainRepoFileList() {
        return IsoDomainListSyncronizer.getInstance().getUserRequestForStorageDomainRepoFileList
                (getStorageDomainIdForQuery(), getParameters().getImageType(), getParameters().getForceRefresh());
    }
}

package org.ovirt.engine.core.bll;

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

import org.ovirt.engine.core.common.businessentities.storage.RepoImage;
import org.ovirt.engine.core.common.queries.GetImagesListParametersBase;
import org.ovirt.engine.core.compat.Guid;

public abstract class GetImagesListQueryBase<P extends GetImagesListParametersBase> extends QueriesCommandBase<P> {

    public GetImagesListQueryBase(P parameters) {
        super(parameters);
    }

    @Override
    protected void executeQueryCommand() {
        // Fetch all the Iso files of a given type for storage pool with active storage domain of this domain Id.
        getQueryReturnValue().setReturnValue(getUserRequestForStorageDomainRepoFileList());
    }

    /**
     * @return The storage domain to get the images from
     */
    protected abstract Guid getStorageDomainIdForQuery();

    protected List<RepoImage> getUserRequestForStorageDomainRepoFileList() {
        Guid storageDomainId = getStorageDomainIdForQuery();
        if (Guid.Empty.equals(storageDomainId)) {
            return new ArrayList<>();
        }

        return IsoDomainListSyncronizer.getInstance().getUserRequestForStorageDomainRepoFileList
                (storageDomainId, getParameters().getImageType(), getParameters().getForceRefresh());
    }
}

Fix ISO Domain List refresh NPE

core: Fix ISO Domain List refresh NPE

Fix ISO DomainList refresh NPE when no ISO domain
is configured.

Change-Id: Ied2b1490d8f66bb40f6f456d2d39bb05120e97d3
Bug-Url: https://bugzilla.redhat.com/1291202
Signed-off-by: Marek Libra <e8e92ef0eef30bdb5bafbacaf4ac8261fffd12ff@redhat.com>


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

import org.vaadin.addonhelpers.TServer;

import com.vaadin.annotations.Widgetset;

@Widgetset("org.vergien.vaadinator.webdriver.touchkit.MobileWidgetset")
public class Demo extends TServer {

	public Demo(String string) {
		super(string);
	}

	public static void main(String[] args) throws Exception {
		Demo demo = new Demo("target/WebDriverExampleTouchkit-0.20-SNAPSHOT");
		demo.startServer();
	}
}

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

import org.vaadin.addonhelpers.TServer;

import com.vaadin.annotations.Widgetset;

@Widgetset("org.vergien.vaadinator.webdriver.touchkit.MobileWidgetset")
public class Demo extends TServer {

	public Demo(String string) {
		super(string);
	}

	public static void main(String[] args) throws Exception {
		Demo demo = new Demo("target/WebDriverExampleTouchkit-0.20-SNAPSHOTstage");
		demo.startServer();
	}
}

Adjust path to new stage profile

Adjust path to new stage profile


package org.metaborg.spoofax.core.messages;

public interface ISourceRegion {
    public int startOffset();

    public int startRow();

    public int startColumn();

    public int endOffset();

    public int endRow();

    public int endColumn();
}

package org.metaborg.spoofax.core.messages;

/**
 * Interface for representing a finite region in source code text. A region has:
 *

 *
Offset - number of characters from the beginning of the source text, with interval [0,#chars).

 *
Row - row or line in the source text, with interval [0,#rows).

 *
Column - column in the source text, with interval [0,#columns@row).

 *

 * Both the starting and ending locations for these numbers are available.
 */
public interface ISourceRegion {
    public int startOffset();

    public int startRow();

    public int startColumn();

    public int endOffset();

    public int endRow();

    public int endColumn();
}

Clarify intervals of source region.

Clarify intervals of source region.


package com.kevinsimard.lambda.function;

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;

@SuppressWarnings("unused")
public class Example implements RequestHandler<Example.Request, Example.Response> {

    public Response handleRequest(Request request, Context context) {
        return new Response(request.message);
    }

    protected static class Request {

        private String message;

        private Request() {}

        public void setMessage(String message) {
            this.message = message;
        }
    }

    protected static class Response {

        private String message;

        private Response(String message) {
            this.message = message;
        }

        public String getMessage() {
            return this.message;
        }
    }
}

package com.kevinsimard.lambda.function;

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;

@SuppressWarnings("unused")
public class Example implements RequestHandler<Example.Request, Example.Response> {

    public Response handleRequest(Request request, Context context) {
        return new Response(request.message);
    }

    static class Request {
        public String message;
    }

    static class Response {
        public String message;

        Response(String message) {
            this.message = message;
        }
    }
}

Update Request & Response classes

Update Request & Response classes


package com.bitmovin.bitcodin.api.test;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.bitmovin.bitcodin.api.output.FTPOutputConfig;
import com.bitmovin.bitcodin.api.output.S3OutputConfig;
import com.google.gson.Gson;
import com.google.gson.annotations.Expose;

public class Settings {

    @Expose
    public String apikey;
    @Expose
    public S3OutputConfig s3OutputEUWest;
    @Expose
    public FTPOutputConfig ftpOutput;

    static private Settings settings = null;
    static private String settingsfile  = "settings.json";

    static public Settings getInstance() throws FileNotFoundException
    {
        if (settings == null)
        {
            InputStream inputStream = Settings.class.getClassLoader().getResourceAsStream(Settings.settingsfile);

            if (inputStream == null)
                throw new FileNotFoundException("Cloud not find config file: " + Settings.settingsfile);

            BufferedReader  reader = new BufferedReader(new InputStreamReader(inputStream));
            Gson            gson   = new Gson();

            settings = gson.fromJson(reader, Settings.class);
        }

        return settings;
    }
}

package com.bitmovin.bitcodin.api.test;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.bitmovin.bitcodin.api.output.FTPOutputConfig;
import com.bitmovin.bitcodin.api.output.S3OutputConfig;
import com.google.gson.Gson;
import com.google.gson.annotations.Expose;

public class Settings {
    @Expose
    public String apikey;
    @Expose
    public S3OutputConfig s3OutputEUWest;
    @Expose
    public FTPOutputConfig ftpOutput;

    static private Settings settings = null;
    static private String settingsfile  = "settings.json";
    static private String localSettingsfile = "local_settings.json";

    static public Settings getInstance() throws FileNotFoundException
    {
        if (settings == null)
        {
            InputStream inputStream = Settings.class.getClassLoader().getResourceAsStream(Settings.settingsfile);

            if (inputStream == null)
            {
                inputStream = Settings.class.getClassLoader().getResourceAsStream(Settings.localSettingsfile);

                if (inputStream == null)
                  throw new FileNotFoundException("Cloud not find any config file: " + Settings.settingsfile);
            }

            BufferedReader  reader = new BufferedReader(new InputStreamReader(inputStream));
            Gson            gson   = new Gson();

            settings = gson.fromJson(reader, Settings.class);
        }

        return settings;
    }
}

Use local_settings.json when ci settings are not available


package com.miguelgaeta.bootstrap.mg_preference;

import android.content.Context;

import java.lang.reflect.Type;

import lombok.NonNull;

/**
 * Created by Miguel Gaeta on 9/25/15.
 */
public class MGPrefStoreTypeByeStream implements MGPrefStoreInterface {

    @Override
    public void init(@NonNull Context context) {

    }

    @Override
    public Object get(@NonNull String key, Type typeOfObject, boolean versioned) {
        return null;
    }

    @Override
    public void set(@NonNull String key, Object value, Type typeOfObject, boolean versioned) {

    }

    @Override
    public void clear() {

    }
}

package com.miguelgaeta.bootstrap.mg_preference;

import android.content.Context;

import com.esotericsoftware.kryo.Kryo;

import java.lang.reflect.Type;

import lombok.Getter;
import lombok.NonNull;

/**
 * Created by Miguel Gaeta on 9/25/15.
 */
public class MGPrefStoreTypeByeStream implements MGPrefStoreInterface {

    @Getter(lazy = true)
    private final ThreadLocal<Kryo> kryos = new ThreadLocal<Kryo>() {

        protected Kryo initialValue() {

            return new Kryo();
        }
    };

    @Override
    public void init(@NonNull Context context) {

    }

    @Override
    public Object get(@NonNull String key, Type typeOfObject, boolean versioned) {

        return null;
    }

    @Override
    public void set(@NonNull String key, Object value, Type typeOfObject, boolean versioned) {

    }

    @Override
    public void clear() {

    }
}

Add kryo thread pool instance.

Add kryo thread pool instance.


package org.cryptonit;

import javacard.framework.JCSystem;

public class IOBuffer {
    private FileIndex index = null;
    private byte [] buffer = null;

    public IOBuffer(FileIndex index) {
        this.index = index;
        this.buffer = JCSystem.makeTransientByteArray((short)256, JCSystem.CLEAR_ON_DESELECT);
    }
}

package org.cryptonit;

import javacard.framework.JCSystem;

public class IOBuffer {
    private FileIndex index = null;
    private byte [] buffer = null;

    private boolean [] bools = null;
    public IOBuffer(FileIndex index) {
        this.index = index;
        this.bools = JCSystem.makeTransientBooleanArray((short) 2, JCSystem.CLEAR_ON_DESELECT);
        this.buffer = JCSystem.makeTransientByteArray((short)256, JCSystem.CLEAR_ON_DESELECT);
    }
}

Add array of booleans to maintain state

Add array of booleans to maintain state


package devopsdistilled.operp.server.data.repo.items;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import devopsdistilled.operp.server.data.entity.items.Product;
import devopsdistilled.operp.server.data.repo.items.custom.ProductRepositoryCustom;

@Repository
public interface ProductRepository extends JpaRepository<Product, Long>,
		ProductRepositoryCustom {

	public List<Product> findByProductName(String productName);

}

package devopsdistilled.operp.server.data.repo.items;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import devopsdistilled.operp.server.data.entity.items.Product;
import devopsdistilled.operp.server.data.repo.items.custom.ProductRepositoryCustom;

@Repository
public interface ProductRepository extends JpaRepository<Product, Long>,
		ProductRepositoryCustom {

	public Product findByProductName(String productName);

}

Change return type to Product for findByProductName()

ProductName is unique by constraint

OPEN - task 51: Create CRUD packages for Product entity
http://github.com/DevOpsDistilled/OpERP/issues/issue/51