package com.lukekorth.httpebble.receivers;

import static com.getpebble.android.kit.Constants.APP_UUID;
import static com.getpebble.android.kit.Constants.MSG_DATA;
import static com.getpebble.android.kit.Constants.TRANSACTION_ID;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.getpebble.android.kit.PebbleKit;
import com.lukekorth.httpebble.Constants;

public class PebbleDataReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		if (((String) intent.getSerializableExtra(APP_UUID)).startsWith(Constants.HTTPEBBLE_UUID_PREFIX)) {
			PebbleKit.sendAckToPebble(context, intent.getIntExtra(TRANSACTION_ID, -1));

			String data = intent.getStringExtra(MSG_DATA);
			if (data != null && data.length() != 0) {
				Intent serviceIntent = new Intent(context, PebbleProxyIntentService.class);
				serviceIntent.putExtras(intent.getExtras());

				context.startService(serviceIntent);
			}
		}
	}

}

package com.lukekorth.httpebble.receivers;

import static com.getpebble.android.kit.Constants.APP_UUID;
import static com.getpebble.android.kit.Constants.MSG_DATA;
import static com.getpebble.android.kit.Constants.TRANSACTION_ID;

import java.util.UUID;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.getpebble.android.kit.PebbleKit;
import com.lukekorth.httpebble.Constants;

public class PebbleDataReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		String uuid = ((UUID) intent.getSerializableExtra(APP_UUID)).toString().toUpperCase();

		Log.d(Constants.HTTPEBBLE, "Pebble Request UUID: " + uuid);

		if (uuid.startsWith(Constants.HTTPEBBLE_UUID_PREFIX)) {
			PebbleKit.sendAckToPebble(context, intent.getIntExtra(TRANSACTION_ID, -1));

			String data = intent.getStringExtra(MSG_DATA);
			if (data != null && data.length() != 0) {
				Intent serviceIntent = new Intent(context, PebbleProxyIntentService.class);
				serviceIntent.putExtras(intent.getExtras());

				context.startService(serviceIntent);
			}
		}
	}

}

Fix case sensitivity of UUID check

Fix case sensitivity of UUID check


/*
 * Copyright 2008 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 org.gradle.api;

import javax.annotation.Nullable;

/**
 *
A {@code Transformer} transforms objects of type.

 *
 *
Implementations are free to return new objects or mutate the incoming value.

 *
 * @param <OUT> The type the value is transformed to.
 * @param <IN> The type of the value to be transformed.
 */
public interface Transformer<OUT, IN> {
    /**
     * Transforms the given object, and returns the transformed value.
     *
     * @param in The object to transform.
     * @return The transformed object.
     */
    OUT transform(@Nullable IN in);
}

/*
 * Copyright 2008 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 org.gradle.api;

/**
 *
A {@code Transformer} transforms objects of type.

 *
 *
Implementations are free to return new objects or mutate the incoming value.

 *
 * @param <OUT> The type the value is transformed to.
 * @param <IN> The type of the value to be transformed.
 */
public interface Transformer<OUT, IN> {
    /**
     * Transforms the given object, and returns the transformed value.
     *
     * @param in The object to transform.
     * @return The transformed object.
     */
    OUT transform(IN in);
}

Remove `@Nullable` for backwards compatibility with Kotlin API


/**
 * @file JSONEncodeDemo.java
 * @author Valery Samovich
 * @version 1.0.0
 * @date 11/19/2014
 *
 * Following example to encode JSON Object using Java JSONObject with is
 * subclass of java.util.HashMap.
 */

package com.valerysamovich.java.advanced.json;

import org.json.simple.JSONObject;

public class JSONEncodeDemo {

    public static void main(String[] args) {

        JSONObject obj = new JSONObject();

        obj.put("name", "foo");
        obj.put("num", new Integer(100));
        obj.put("balance", new Double(1000.21));
        obj.put("is_vip", new Boolean(true));

        System.out.print(obj);
    }
}

Add Encoding JSON in Java Example

Add Encoding JSON in Java Example


package com.ft.membership.crypto.signature;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class Encoder {

    private static final Base64.Encoder BASE_64_ENCODER = Base64.getUrlEncoder().withoutPadding();
    private static final Base64.Decoder BASE_64_DECODER = Base64.getUrlDecoder();

    public static String getBase64EncodedString(final byte[] bytes) {

        return new String(BASE_64_ENCODER.encode(bytes), StandardCharsets.UTF_8);
    }

    public static byte[] getBase64DecodedBytes(final String encodedString) {

        return BASE_64_DECODER.decode(encodedString.getBytes(StandardCharsets.UTF_8));
    }
}

package com.ft.membership.crypto.signature;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class Encoder {

    private static final Base64.Encoder BASE_64_ENCODER = Base64.getUrlEncoder().withoutPadding();
    private static final Base64.Decoder BASE_64_DECODER = Base64.getUrlDecoder();

    public static String getBase64EncodedString(final byte[] bytes) {

        return new String(BASE_64_ENCODER.encode(bytes), StandardCharsets.UTF_8);
    }

    public static byte[] getBase64DecodedBytes(final String encodedString) {

        try {
            return BASE_64_DECODER.decode(encodedString.getBytes(StandardCharsets.UTF_8));
        } catch(IllegalArgumentException e) {
            // We do not want a RuntimeException to be thrown when the string passed is not in valid Base64 scheme
            // as bad input is possible to the lib methods.
            return null;
        }
    }
}

Handle IllegalArgumentException due to bad input


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

/**
 * To perform optional initialization on an element after its properties has been configured.
 */
public interface AfterPropertiesConfigured {

    /**
     * Callback invoked after the element have configured its properties.
     * <p/>
     * This allows to perform any post init work.
     *
     * @param camelContext  the Camel Context
     */
    void afterPropertiesConfigured(CamelContext camelContext);
}

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

/**
 * To perform optional initialization on an element after its properties has been configured.
 *

 * Currently only languages is supported using this callback.
 */
public interface AfterPropertiesConfigured {

    /**
     * Callback invoked after the element have configured its properties.
     *

     * This allows to perform any post init work.
     *
     * @param camelContext  the Camel Context
     */
    void afterPropertiesConfigured(CamelContext camelContext);
}

CAMEL-8820: Add note its currently only for languages


/*
 * Copyright 2018 New Vector Ltd
 *
 * 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.matrix.androidsdk;

class TestConstants {
    // Time out to use when waiting for server response
    public static final int AWAIT_TIME_OUT_MILLIS = 10000;
}

/*
 * Copyright 2018 New Vector Ltd
 *
 * 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.matrix.androidsdk;

class TestConstants {
    // Time out to use when waiting for server response
    public static final int AWAIT_TIME_OUT_MILLIS = 30000;
}

Increase timeout again to be sure all the tests are successful


/*
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
 */

package __ID__;

import android.os.Bundle;
import org.apache.cordova.*;

public class __ACTIVITY__ extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        // Set by <content src="index.html" /> in config.xml
        loadUrl(launchUrl);
    }
}

/*
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
 */

package __ID__;

import android.os.Bundle;
import org.apache.cordova.*;

public class __ACTIVITY__ extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        // enable Cordova apps to be started in the background
        Bundle extras = getIntent().getExtras();
        if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
        		moveTaskToBack(true);
        }

        // Set by <content src="index.html" /> in config.xml
        loadUrl(launchUrl);
    }
}

Enable background start of Cordova Android apps

This closes #322


package org.cru.godtools.properties;

import javax.enterprise.inject.Produces;

/**
 * Created by ryancarlson on 3/26/14.
 */
public class GodToolsPropertiesFactory
{
    private static final String propertiesFile = "/apps/apps-config/godtools-api-properties.xml";
    private static final String propertiesFile2 = "/default-properties.xml";

    @Produces
    public GodToolsProperties get()
    {
        return new GodToolsProperties(null, false, propertiesFile, propertiesFile2);
    }

}

package org.cru.godtools.properties;

import javax.enterprise.inject.Produces;

/**
 * Created by ryancarlson on 3/26/14.
 */
public class GodToolsPropertiesFactory
{
    private final String propertiesFile = "/apps/apps-config/godtools-api-properties.xml";
    private final String propertiesFile2 = "/default-properties.xml";

    @Produces
    public GodToolsProperties get()
    {
        return new GodToolsProperties(null, false, propertiesFile, propertiesFile2);
    }

}

Use filesystem properties to configure database connection instead of hard coded


/*
* ################################################################
*
* ProActive: The Java(TM) library for Parallel, Distributed,
*            Concurrent computing with Security and Mobility
*
* Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
* Contact: proactive-support@inria.fr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
* USA
*
*  Initial developer(s):               The ProActive Team
*                        http://www.inria.fr/oasis/ProActive/contacts.html
*  Contributor(s):
*
* ################################################################
*/
package org.objectweb.proactive.examples.penguin;

public interface PenguinMessageReceiver {
  public void receiveMessage(String s);
}

/*
* ################################################################
*
* ProActive: The Java(TM) library for Parallel, Distributed,
*            Concurrent computing with Security and Mobility
*
* Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
* Contact: proactive-support@inria.fr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
* USA
*
*  Initial developer(s):               The ProActive Team
*                        http://www.inria.fr/oasis/ProActive/contacts.html
*  Contributor(s):
*
* ################################################################
*/
package org.objectweb.proactive.examples.penguin;

public interface PenguinMessageReceiver {
  public void receiveMessage(String s);

  public void receiveMessage(String s, java.awt.Color c);
}

Correct bugs and improve feature and GUI

git-svn-id: 9146c88ff6d39b48099bf954d15d68f687b3fa69@91 28e8926c-6b08-0410-baaa-805c5e19b8d6


package com.englishnary.eridev.android.englishnary;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;

public class DevTest extends ActionBarActivity {
    //Declaro los controles a utilizar
    Button btn_empezar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dev_test);
        //Obtengo los controles
        btn_empezar = (Button)findViewById(R.id.btn_empezar);
        btn_empezar.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intentEmpezar = new Intent(DevTest.this,splash_screen.class);
                startActivity(intentEmpezar);
            }
        });

        //Creo una instancia de DPreguntas y le paso la instancia de la clase this
        DPreguntas dPregHelper = new DPreguntas(this);
    }

    }

Add TrivialNary and create SQLIte DB

Add TrivialNary and create SQLIte DB


package org.skyve.impl.metadata.repository;

import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;

import javax.xml.bind.annotation.adapters.XmlAdapter;

/**
 * JAXB Adapter for Map<String, String> to/from PropertyMapType.
 */
public class PropertyMapAdapter extends XmlAdapter<PropertyMapType, Map<String, String>> {
	@Override
	public Map<String, String> unmarshal(PropertyMapType v) throws Exception {
		Map<String, String> result = new TreeMap<>();
		for (PropertyMapEntryType property : v.properties) {
			result.put(property.key, property.value);
		}
		return result;
	}

	@Override
	public PropertyMapType marshal(Map<String, String> v) throws Exception {
		PropertyMapType result = new PropertyMapType();

		List<PropertyMapEntryType> properties = result.properties;
		for (Entry<String, String> entry : v.entrySet()) {
			PropertyMapEntryType property = new PropertyMapEntryType();
			property.key = entry.getKey();
			property.value = entry.getValue();
			properties.add(property);
		}

		return result;
	}
}

package org.skyve.impl.metadata.repository;

import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;

import javax.xml.bind.annotation.adapters.XmlAdapter;

/**
 * JAXB Adapter for Map<String, String> to/from PropertyMapType.
 */
public class PropertyMapAdapter extends XmlAdapter<PropertyMapType, Map<String, String>> {
	@Override
	public Map<String, String> unmarshal(PropertyMapType v) throws Exception {
		Map<String, String> result = new TreeMap<>();
		for (PropertyMapEntryType property : v.properties) {
			result.put(property.key, property.value);
		}
		return result;
	}

	@Override
	public PropertyMapType marshal(Map<String, String> v) throws Exception {
		PropertyMapType result = null;
		if (! v.isEmpty()) {
			result = new PropertyMapType();
			List<PropertyMapEntryType> properties = result.properties;
			for (Entry<String, String> entry : v.entrySet()) {
				PropertyMapEntryType property = new PropertyMapEntryType();
				property.key = entry.getKey();
				property.value = entry.getValue();
				properties.add(property);
			}
		}

		return result;
	}
}

Stop property elements being generated on DecoratedMetaData classes when generating edit views.


package com.voodoodyne.gstrap.rest;

import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.voodoodyne.gstrap.lang.Types;
import lombok.RequiredArgsConstructor;

import java.util.List;

/**
 * JSON structure of an error body from the ThrowableMapper
 */
@RequiredArgsConstructor
public class ErrorBody {
	private final Throwable t;

	public String getMessage() {
		return t.getMessage();
	}

	public String getType() {
		return t.getClass().getSimpleName();
	}

	public List<String> getTypes() {
		return Types.getTypes(t, ClientException.class, RuntimeException.class, Exception.class, Throwable.class);
	}

	public ErrorBody getCause() {
		return t.getCause() == null ? null : new ErrorBody(t.getCause());
	}

	@JsonUnwrapped
	public Object getAdditionalProperties() {
		if (t instanceof AdditionalProperties) {
			return ((AdditionalProperties)t).getAdditionalProperties();
		} else {
			return null;
		}
	}
}

package com.voodoodyne.gstrap.rest;

import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.voodoodyne.gstrap.lang.Types;
import lombok.RequiredArgsConstructor;

import java.util.List;
import java.util.stream.Collectors;

/**
 * JSON structure of an error body from the ThrowableMapper
 */
@RequiredArgsConstructor
public class ErrorBody {
	private static final String stripExceptionSuffix(final String className) {
		if (className.endsWith("Exception")) {
			return className.substring(0, className.length() - "Exception".length());
		} else {
			return className;
		}
	}

	private final Throwable t;

	public String getMessage() {
		return t.getMessage();
	}

	public String getType() {
		return stripExceptionSuffix(t.getClass().getSimpleName());
	}

	public List<String> getTypes() {
		return Types.getTypes(t, ClientException.class, RuntimeException.class, Exception.class, Throwable.class)
				.stream()
				.map(ErrorBody::stripExceptionSuffix).collect(Collectors.toList());
	}

	public ErrorBody getCause() {
		return t.getCause() == null ? null : new ErrorBody(t.getCause());
	}

	@JsonUnwrapped
	public Object getAdditionalProperties() {
		if (t instanceof AdditionalProperties) {
			return ((AdditionalProperties)t).getAdditionalProperties();
		} else {
			return null;
		}
	}
}

Remove "Exception" from the error text

Remove "Exception" from the error text


package org.robockets.stronghold.robot.commands;

import org.robockets.stronghold.robot.Robot;

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

/**
 *
 */
public class Kill extends Command {

    public Kill() {
        requires(Robot.driveTrain);
        requires(Robot.intakeFront);
        requires(Robot.intakeBack);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
    	Robot.driveTrain.stop();
    	Robot.intakeFront.stopIntake();
    	Robot.intakeFront.stopVertical();
    	Robot.intakeBack.stopIntake();
    	Robot.intakeBack.stopVertical();
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return true;
    }

    // Called once after isFinished returns true
    protected void end() {
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
        end();
    }
}

package org.robockets.stronghold.robot.commands;

import org.robockets.stronghold.robot.Robot;

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

/**
 *
 */
public class Kill extends Command {

    public Kill() {
        requires(Robot.driveTrain);
        requires(Robot.intakeFront);
        requires(Robot.intakeBack);
        requires(Robot.shooter);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
    	Robot.driveTrain.stop();

    	Robot.intakeFront.stopIntake();
    	Robot.intakeFront.stopVertical();
    	Robot.intakeBack.stopIntake();
    	Robot.intakeBack.stopVertical();
    	Robot.intakeBack.setIntakeAngle(Robot.intakeBack.getIntakeAngle());
    	Robot.intakeFront.setIntakeAngle(Robot.intakeFront.getIntakeAngle());

    	Robot.shooter.setHoodAngle(Robot.shooter.getHoodAngle());
    	Robot.shooter.setShootingWheelSpeed(Robot.shooter.getShootingWheelSpeed());
    	Robot.shooter.setTurnTableAngle(Robot.shooter.getTurnTableAngle());
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return true;
    }

    // Called once after isFinished returns true
    protected void end() {
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
        end();
    }
}

Update the setpoints after killing each subsystem


/*                                                                      *\
**                    SICU Stress Measurement System                    **
**                      Project P04  |  C380 Team A                     **
**          EBME 380: Biomedical Engineering Design Experience          **
**                    Case Western Reserve University                   **
**                          2016 Fall Semester                          **
\*                                                                      */

package edu.cwru.sicu_sms.util;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

/**
 * Test class for {@link PropertyOperator}.
 *
 * @since December 14, 2016
 * @author Ted Frohlich <ttf10@case.edu>
 * @author Abby Walker <amw138@case.edu>
 */
class PropertyOperatorTest {

    @BeforeEach
    void setUp() {

    }

    @AfterEach
    void tearDown() {

    }

    @Test
    void loadProperties() {

    }

    @Test
    void saveProperties() {

    }

}

/*                                                                      *\
**                    SICU Stress Measurement System                    **
**                      Project P04  |  C380 Team A                     **
**          EBME 380: Biomedical Engineering Design Experience          **
**                    Case Western Reserve University                   **
**                          2016 Fall Semester                          **
\*                                                                      */

package edu.cwru.sicu_sms.util;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.Properties;

import static org.junit.jupiter.api.Assertions.*;

/**
 * Test class for {@link PropertyOperator}.
 *
 * @since December 14, 2016
 * @author Ted Frohlich <ttf10@case.edu>
 * @author Abby Walker <amw138@case.edu>
 */
class PropertyOperatorTest {

    private static final String LOAD_FILE = "util/TestProperties.properties";
    private static final String SAVE_FILE = "util/TestProperties.properties";

    private Properties propertiesToTest;

    @BeforeEach
    void setUp() {
        propertiesToTest = new Properties();
        propertiesToTest.setProperty("key_string", "value_string");
        propertiesToTest.setProperty("key_int",    "380");
        propertiesToTest.setProperty("key_float",  "216.368");
    }

    @AfterEach
    void tearDown() {
        propertiesToTest.clear();
        propertiesToTest = null;
    }

    @Test
    void loadProperties() {
        Properties propertiesToLoad = PropertyOperator.loadProperties(LOAD_FILE);

        // TODO: needs to be implemented

        assert false;
    }

    @Test
    void saveProperties() {
        Properties propertiesToSave = propertiesToTest;
        propertiesToSave.setProperty("new_key", "new_value");

        boolean success = PropertyOperator.saveProperties(
                propertiesToSave, SAVE_FILE, "New Description!");

        assert success;
    }

}

Implement most of test class

Implement most of test class


package is.ru.sparkit;

import spark.*;
import static spark.Spark.*;
import spark.servlet.SparkApplication;

public class ChuckWeb implements SparkApplication {
    public static void main(String[] args){
        SparkApplication chuckweb = new ChuckWeb();
        chuckweb.init();
    }

    public void init(){
        final ChuckJoke chuckjoke = new ChuckJoke();

        get(new Route("/"){
            @Override
            public Object handle(Request request, Response response){
                return chuckjoke.getRandom();
            }
        });
    }
}

package is.ru.sparkit;

import spark.*;
import static spark.Spark.*;
import spark.servlet.SparkApplication;

public class ChuckWeb implements SparkApplication {
    public static void main(String[] args){
        SparkApplication chuckweb = new ChuckWeb();
        chuckweb.init();
    }

    public void init(){
        final ChuckJoke chuckjoke = new ChuckJoke();

        get(new Route("/"){
            @Override
            public Object handle(Request request, Response response){
                return chuckjoke.getRandom();
            }
        });

        get(new Route("/id/:param"){
            @Override
            public Object handle(Request request, Response response){
                return chuckjoke.getSpecific(Integer.parseInt(request.params(":param")));
            }
        });
    }
}

Allow fetching jokes by id in Web

Allow fetching jokes by id in Web


package kfs.kfsDbi;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author pavedrim
 */
public class kfsPassword extends kfsString {

    public kfsPassword(String name, String label, int pos) {
        super(name, label, 50, pos, defaultCharSet);
    }

    public void encode(String input, kfsRowData rd) {
        setString(encode0(input), rd);
    }

    public boolean equalsPass(String input, kfsRowData rd) {
        return getString(rd).equals(encode0(input));
    }
    private static MessageDigest md = null;

    public static String encode0(String input) {
        if (input == null) {
            return "";
        }
        if (md == null) {
            try {
                md = MessageDigest.getInstance("MD5");
            } catch (NoSuchAlgorithmException ex) {
                Logger.getLogger(kfsPassword.class.getName()).log(Level.SEVERE, "Canot find MD5", ex);
            }
        }
        md.update(input.getBytes());
        byte[] digest = md.digest();
        StringBuilder sb = new StringBuilder();
        for (byte b : digest) {
            sb.append(String.format("%02x", (int) (b & 0xff)));
        }
        return sb.toString();
    }
}

package kfs.kfsDbi;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author pavedrim
 */
public class kfsPassword extends kfsString {

    private final String prefix;

    public kfsPassword(String name, int pos) {
        this(name, pos, "MD5:");
    }

    @Deprecated
    public kfsPassword(String name, String label, int pos) {
        this(name, pos, "");
    }

    public kfsPassword(String name, int pos, String prefix) {
        super(name, name, 50, pos, defaultCharSet);
        this.prefix = prefix;
    }

    public void encode(String input, kfsRowData rd) {
        setString(prefix+encode0(input), rd);
    }

    public boolean equalsPass(String input, kfsRowData rd) {
        return getString(rd).equals(prefix+encode0(input));
    }

    private static MessageDigest md = null;

    public static String encode0(String input) {
        if (input == null) {
            return "";
        }
        if (md == null) {
            try {
                md = MessageDigest.getInstance("MD5");
            } catch (NoSuchAlgorithmException ex) {
                Logger.getLogger(kfsPassword.class.getName()).log(Level.SEVERE, "Canot find MD5", ex);
            }
        }
        md.update(input.getBytes());
        byte[] digest = md.digest();
        StringBuilder sb = new StringBuilder();
        for (byte b : digest) {
            sb.append(String.format("%02x", (int) (b & 0xff)));
        }
        return sb.toString();
    }
}

Add prefix to the password

Add prefix to the password


package com.drivemode.spotify.rest;

import com.squareup.okhttp.OkHttpClient;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.client.OkClient;

/**
 * @author KeishinYokomaku
 */
public class RestAdapterFactory {
    public static final String TAG = RestAdapterFactory.class.getSimpleName();
    public static final String SPOTIFY_WEB_API_ENDPOINT = "https://api.spotify.com/v1";
    public static final String SPOTIFY_AUTHENTICATE_ENDPOINT = "https://accounts.spotify.com/";
    private final OkClient mOkClient;
    private final Executor mExecutor;

    public RestAdapterFactory() {
        mOkClient = new OkClient(new OkHttpClient());
        mExecutor = Executors.newSingleThreadExecutor();
    }

    public RestAdapter provideWebApiAdapter(RequestInterceptor interceptor) {
        return new RestAdapter.Builder()
                .setLogLevel(RestAdapter.LogLevel.FULL)
                .setClient(mOkClient)
                .setExecutors(mExecutor, mExecutor)
                .setEndpoint(SPOTIFY_WEB_API_ENDPOINT)
                .setRequestInterceptor(interceptor)
                .build();
    }

    public RestAdapter provideAuthenticateApiAdapter() {
        return new RestAdapter.Builder()
                .setLogLevel(RestAdapter.LogLevel.FULL)
                .setClient(mOkClient)
                .setExecutors(mExecutor, mExecutor)
                .setEndpoint(SPOTIFY_AUTHENTICATE_ENDPOINT)
                .build();
    }
}

package com.drivemode.spotify.rest;

import com.squareup.okhttp.OkHttpClient;

import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.client.OkClient;

/**
 * @author KeishinYokomaku
 */
public class RestAdapterFactory {
    public static final String TAG = RestAdapterFactory.class.getSimpleName();
    public static final String SPOTIFY_WEB_API_ENDPOINT = "https://api.spotify.com/v1";
    public static final String SPOTIFY_AUTHENTICATE_ENDPOINT = "https://accounts.spotify.com/";
    private final OkClient mOkClient;

    public RestAdapterFactory() {
        mOkClient = new OkClient(new OkHttpClient());
    }

    public RestAdapter provideWebApiAdapter(RequestInterceptor interceptor) {
        return new RestAdapter.Builder()
                .setLogLevel(RestAdapter.LogLevel.FULL)
                .setClient(mOkClient)
                .setEndpoint(SPOTIFY_WEB_API_ENDPOINT)
                .setRequestInterceptor(interceptor)
                .build();
    }

    public RestAdapter provideAuthenticateApiAdapter() {
        return new RestAdapter.Builder()
                .setLogLevel(RestAdapter.LogLevel.FULL)
                .setClient(mOkClient)
                .setEndpoint(SPOTIFY_AUTHENTICATE_ENDPOINT)
                .build();
    }
}

Fix executors for retrofit request and callback


package com.cgi.eoss.ftep.clouds.service;

import net.schmizz.sshj.SSHClient;
import net.schmizz.sshj.connection.channel.direct.Session;
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;

import java.io.Closeable;
import java.io.IOException;

/**
 */
public class SSHSession implements Closeable {

    private final SSHClient sshClient;

    public SSHSession(String host, String username, String privateKey, String publicKey) throws IOException {
        sshClient = new SSHClient();
        sshClient.addHostKeyVerifier(new PromiscuousVerifier());
        sshClient.connect(host);
        sshClient.authPublickey(username, sshClient.loadKeys(privateKey, publicKey, null));
    }

    public CommandResponse exec(String cmd) throws IOException {
        try (Session session = sshClient.startSession()) {
            return new CommandResponse(session.exec(cmd));
        }
    }

    @Override
    public void close() throws IOException {
        this.sshClient.disconnect();
    }

}

package com.cgi.eoss.ftep.clouds.service;

import lombok.extern.log4j.Log4j2;
import net.schmizz.sshj.SSHClient;
import net.schmizz.sshj.connection.channel.direct.Session;
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;

import java.io.Closeable;
import java.io.IOException;

/**
 */
@Log4j2
public class SSHSession implements Closeable {

    private final SSHClient sshClient;

    public SSHSession(String host, String username, String privateKey, String publicKey) throws IOException {
        sshClient = new SSHClient();
        sshClient.addHostKeyVerifier(new PromiscuousVerifier());
        sshClient.connect(host);
        sshClient.authPublickey(username, sshClient.loadKeys(privateKey, publicKey, null));
    }

    public CommandResponse exec(String cmd) throws IOException {
        try (Session session = sshClient.startSession()) {
            CommandResponse commandResponse = new CommandResponse(session.exec(cmd));
            LOG.debug("Exit status: {}, output: {} for command {}", commandResponse.getExitStatus(), commandResponse.getOutput(), cmd);
            return commandResponse;
        }
    }

    @Override
    public void close() throws IOException {
        this.sshClient.disconnect();
    }

}

Add logging for SSH commands

Add logging for SSH commands

Change-Id: I620bfe5b796e82ae408477752d1547bd8d39a644


package com.github.k0kubun.github_ranking;

import com.github.k0kubun.github_ranking.config.Config;
import com.github.k0kubun.github_ranking.worker.UpdateUserWorker;
import com.github.k0kubun.github_ranking.worker.WorkerManager;
import javax.sql.DataSource;

public class Main
{
    public static void main(String[] args)
    {
        Config config = new Config(System.getenv());
        WorkerManager workers = buildWorkers(config);

        Runtime.getRuntime().addShutdownHook(new Thread(workers::stop));
        workers.start();
    }

    private static WorkerManager buildWorkers(Config config)
    {
        DataSource dataSource = config.getDatabaseConfig().getDataSource();

        WorkerManager workers = new WorkerManager();
        workers.add(new UpdateUserWorker(dataSource));
        return workers;
    }
}

package com.github.k0kubun.github_ranking;

import com.github.k0kubun.github_ranking.config.Config;
import com.github.k0kubun.github_ranking.worker.UpdateUserWorker;
import com.github.k0kubun.github_ranking.worker.WorkerManager;
import javax.sql.DataSource;

public class Main
{
    private static final int NUM_UPDATE_USER_WORKERS = 3;

    public static void main(String[] args)
    {
        Config config = new Config(System.getenv());
        WorkerManager workers = buildWorkers(config);

        Runtime.getRuntime().addShutdownHook(new Thread(workers::stop));
        workers.start();
    }

    private static WorkerManager buildWorkers(Config config)
    {
        DataSource dataSource = config.getDatabaseConfig().getDataSource();

        WorkerManager workers = new WorkerManager();
        for (int i = 0; i < NUM_UPDATE_USER_WORKERS; i++) {
            workers.add(new UpdateUserWorker(dataSource));
        }
        return workers;
    }
}

Increase UpdateUserWorker: 1 -> 3

Increase UpdateUserWorker: 1 -> 3


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

package org.elasticsearch.bootstrap;

/**
 * A wrapper around {@link Bootstrap} just so the process will look nicely on things like jps.
 */
public class Elasticsearch extends Bootstrap {

    public static void main(String[] args) throws Throwable {
        Bootstrap.main(args);
    }
}

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

package org.elasticsearch.bootstrap;

/**
 * A wrapper around {@link Bootstrap} just so the process will look nicely on things like jps.
 */
public class Elasticsearch extends Bootstrap {

    public static void main(String[] args) throws StartupError {
        Bootstrap.main(args);
    }
}

Fix compilation... forgot to 'mvn clean'


package com.grayben.riskExtractor.headingMarker;

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

/**
 * Created by beng on 1/12/2015.
 */
public class UnmodifiableText {

    private List<String> stringList;

    public UnmodifiableText(List<String> stringList){
        this.stringList = stringList;
    }

    public UnmodifiableText(UnmodifiableText unmodifiableText){
        this.stringList = unmodifiableText.getStringList();

    }

    public List<String> getStringList(){
        return Collections.unmodifiableList(this.stringList);
    }
}

package com.grayben.riskExtractor.headingMarker;

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

/**
 * Created by beng on 1/12/2015.
 */
public class UnmodifiableText {

    private List<String> stringList;

    public UnmodifiableText(List<String> stringList){
        if(stringList == null)
            throw new NullPointerException("Attempted " +
                    "to construct with null pointer");
        this.stringList = stringList;
    }

    public UnmodifiableText(UnmodifiableText unmodifiableText){
        this(unmodifiableText.getStringList());

    }

    public List<String> getStringList(){
        return Collections.unmodifiableList(this.stringList);
    }
}

Make constructor throw NullPointerException where appropriate


package org.springframework.indexer;

import org.jsoup.nodes.Document;
import org.springframework.search.SearchEntry;
import org.springframework.search.SearchEntryMapper;

import java.util.Date;

public class WebDocumentSearchEntryMapper implements SearchEntryMapper<WebDocument> {

	@Override
	public SearchEntry map(WebDocument document) {
		Document input = document.getDocument();
		SearchEntry entry = new SearchEntry();
		entry.setId(document.getPath());
		entry.setPublishAt(new Date(0L));
		String text = input.text();
		entry.setRawContent(text);
		entry.setSummary(text.substring(0, Math.min(500, text.length())));
		entry.setTitle(input.title());
		entry.setPath(document.getPath());
		return entry;
	}

}

package org.springframework.indexer;

import org.jsoup.nodes.Document;
import org.springframework.search.SearchEntry;
import org.springframework.search.SearchEntryMapper;

import java.util.Date;

public class WebDocumentSearchEntryMapper implements SearchEntryMapper<WebDocument> {

	@Override
	public SearchEntry map(WebDocument document) {
		Document input = document.getDocument();
		SearchEntry entry = new SearchEntry();
		entry.setId(document.getPath().replaceAll("/", "_"));
		entry.setPublishAt(new Date(0L));
		String text = input.text();
		entry.setRawContent(text);
		entry.setSummary(text.substring(0, Math.min(500, text.length())));
		entry.setTitle(input.title());
		entry.setPath(document.getPath());
		return entry;
	}

}

Fix broken api docs index

 Fix broken api docs index

 - api docs entries Id's were full url paths which broke elasticsearch indexing. Replaced '/' with _ in these ids


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

package net.openhft.chronicle.bytes.util;

import net.openhft.chronicle.bytes.Bytes;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/*
 * Created by Peter Lawrey on 17/09/15.
 */
public class StringInternerBytesTest {

    @Test
    public void testIntern() {
        @NotNull StringInternerBytes si = new StringInternerBytes(128);
        for (int i = 0; i < 100; i++) {
            Bytes b = Bytes.from("key" + i);
            si.intern(b, (int) b.readRemaining());
        }
        assertEquals(86, si.valueCount());
    }
}

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

package net.openhft.chronicle.bytes.util;

import net.openhft.chronicle.bytes.Bytes;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/*
 * Created by Peter Lawrey on 17/09/15.
 */
public class StringInternerBytesTest {

    @Test
    public void testIntern() {
        @NotNull StringInternerBytes si = new StringInternerBytes(128);
        for (int i = 0; i < 128; i++) {
            Bytes b = Bytes.from("key" + i);
            si.intern(b, (int) b.readRemaining());
        }
        assertEquals(97, si.valueCount());
    }
}

Improve test coverage and deprecate some methods.


package com.github.hypfvieh.util;

import java.io.File;

import org.junit.Test;

import com.github.hypfvieh.AbstractBaseUtilTest;

public class CompressionUtilTest extends AbstractBaseUtilTest {

    @Test
    public void testGzipCompressUncompress() {
        System.out.println("GzipCompressUncompress");
        File compressedGzip = CompressionUtil.compressFileGzip("src/test/resources/CompressionUtilTest/FileToCompress.txt", SystemUtil.concatFilePath(SystemUtil.getTempDir(), "SampleCompress.gz"));

        assertFileExists(compressedGzip);

        File extractedGzip = CompressionUtil.extractFileGzip(compressedGzip.getAbsolutePath(), SystemUtil.concatFilePath(SystemUtil.getTempDir(), "SampleUncompressCompress.txt"));
        assertFileExists(extractedGzip);

        String content = FileIoUtil.readFileToString(extractedGzip);

        assertContains(content, "compressed by a unit test");
    }

}

package com.github.hypfvieh.util;

import java.io.File;

import org.junit.Test;

import com.github.hypfvieh.AbstractBaseUtilTest;

public class CompressionUtilTest extends AbstractBaseUtilTest {

    @Test
    public void testGzipCompressUncompress() {
        System.out.println("GzipCompressUncompress");
        File compressedGzip = CompressionUtil.compressFileGzip("src/test/resources/CompressionUtilTest/FileToCompress.txt", SystemUtil.concatFilePath(SystemUtil.getTempDir(), "SampleCompress.gz"));

        assertFileExists(compressedGzip);

        File extractedGzip = CompressionUtil.extractFileGzip(compressedGzip.getAbsolutePath(), SystemUtil.concatFilePath(SystemUtil.getTempDir(), "SampleUncompressCompress.txt"));
        assertFileExists(extractedGzip);

        String content = FileIoUtil.readFileToString(extractedGzip);

        assertContains(content, "compressed by a unit test");

        extractedGzip.delete(); // remove no longer needed file
    }

}

Remove created file after unit test

Remove created file after unit test


package com.googlecode.pngtastic.core;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

/**
 * Usage:
 * <code>
 *     byte[] bytes = new PngChunkInserter().insert(image, PngChunkInserter.dpi300Chunk);
 *     final File exported = image.export(toDir + "/name.png", bytes);
 * </code>
 *
 * @author ray
 */
public class PngChunkInserter {

	private static final byte[] dpi300 = new byte[] { 0, 0, 46, 35, 0, 0, 46, 35, 1 };

	public static final PngChunk dpi300Chunk = new PngChunk(PngChunk.PHYSICAL_PIXEL_DIMENSIONS.getBytes(), dpi300);

	public byte[] insert(PngImage image, PngChunk chunk) throws IOException {
		// add it after the header chunk
		image.getChunks().add(1, chunk);

		final ByteArrayOutputStream outputBytes = new ByteArrayOutputStream();
		image.writeDataOutputStream(outputBytes);

		return outputBytes.toByteArray();
	}
}

package com.googlecode.pngtastic.core;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

/**
 * Usage:
 * <code>
 *     byte[] bytes = new PngChunkInserter().insert(image, PngChunkInserter.dpi300Chunk);
 *     final File exported = image.export(toDir + "/name.png", bytes);
 * </code>
 *
 * @author ray
 */
public class PngChunkInserter {

	/**
	 * Conversion note: one inch is equal to exactly 0.0254 meters.
	 * 300dpi = 300 / 0.0254 = 11,811.023622 = 11811 = 0x2E23 = new byte[] { 0, 0, 46, 35 }
	 * http://comments.gmane.org/gmane.comp.graphics.png.general/2425
	 */
	private static final byte[] dpi300 = new byte[] { 0, 0, 46, 35, 0, 0, 46, 35, 1 };

	public static final PngChunk dpi300Chunk = new PngChunk(PngChunk.PHYSICAL_PIXEL_DIMENSIONS.getBytes(), dpi300);

	public byte[] insert(PngImage image, PngChunk chunk) throws IOException {
		// add it after the header chunk
		image.getChunks().add(1, chunk);

		final ByteArrayOutputStream outputBytes = new ByteArrayOutputStream();
		image.writeDataOutputStream(outputBytes);

		return outputBytes.toByteArray();
	}
}

Add comment describing dpi conversion

Add comment describing dpi conversion


// SPDX-License-Identifier: BSD-2-Clause
package org.xbill.DNS.lookup;

/**
 * Thrown if the lookup results in too many CNAME and/or DNAME indirections. This would be the case
 * for example if two CNAME records point to each other.
 */
public class RedirectOverflowException extends LookupFailedException {
  /** @deprecated do not use, this class is meant for internal dnsjava usage only. */
  @Deprecated
  public RedirectOverflowException(String message) {
    super(message);
  }

  RedirectOverflowException(int maxRedirects) {
    super("Refusing to follow more than " + maxRedirects + " redirects");
  }
}

// SPDX-License-Identifier: BSD-2-Clause
package org.xbill.DNS.lookup;

import lombok.Getter;

/**
 * Thrown if the lookup results in too many CNAME and/or DNAME indirections. This would be the case
 * for example if two CNAME records point to each other.
 */
public class RedirectOverflowException extends LookupFailedException {
  @Getter private final int maxRedirects;

  /** @deprecated Use {@link RedirectOverflowException#RedirectOverflowException(int)}. */
  @Deprecated
  public RedirectOverflowException(String message) {
    super(message);
    maxRedirects = 0;
  }

  public RedirectOverflowException(int maxRedirects) {
    super("Refusing to follow more than " + maxRedirects + " redirects");
    this.maxRedirects = maxRedirects;
  }
}

Make constructor public for unit testing by library users


package test.com.maderilo.stringCalculator;
import static org.junit.Assert.assertEquals;

import org.junit.Test;

import com.maderilo.stringCalculator.StringCalculator;

public class StringCalculatorTest {

	@Test
	public void should_return_0_for_empty_string() throws Exception {
		String input = "";

		int result = StringCalculator.Add(input);

		assertEquals(0, result);
	}

	@Test
	public void should_return_number_for_1number_string() throws Exception {
		String input = "12";

		int result = StringCalculator.Add(input);

		assertEquals(12, result);
	}

	@Test
	public void should_return_sum_for_2number_comma_string() throws Exception {
		String input = "12,2";

		int result = StringCalculator.Add(input);

		assertEquals(14, result);
	}
}

package test.com.maderilo.stringCalculator;
import static org.junit.Assert.assertEquals;

import org.junit.Test;

import com.maderilo.stringCalculator.StringCalculator;

public class StringCalculatorTest {

	@Test
	public void should_return_0_for_empty_string() throws Exception {
		String input = "";

		int result = StringCalculator.Add(input);

		assertEquals(0, result);
	}

	@Test
	public void should_return_number_for_1number_string() throws Exception {
		String input = "12";

		int result = StringCalculator.Add(input);

		assertEquals(12, result);
	}

	@Test
	public void should_return_sum_for_more_than_1number_comma_string() throws Exception {
		String input = "12,2,3,5";

		int result = StringCalculator.Add(input);

		assertEquals(22, result);
	}
}

Add method allowed to handle an unknown amount of numbers


// ========================================================================
// Copyright 2010 NEXCOM Systems
// ------------------------------------------------------------------------
// 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.cipango.diameter.router;

import java.util.Hashtable;
import java.util.Map;

import org.cipango.diameter.node.DiameterRequest;
import org.cipango.diameter.node.Node;
import org.cipango.diameter.node.Peer;

public class DefaultRouter implements DiameterRouter
{

	private Map<String, Peer> _peers = new Hashtable<String, Peer>();

	public Peer getRoute(DiameterRequest request)
	{
		return _peers.get(request.getDestinationHost());
	}

	public void peerAdded(Peer peer)
	{
		_peers.put(peer.getHost(), peer);
	}

	public void peerRemoved(Peer peer)
	{
		_peers.remove(peer.getHost());
	}

}

// ========================================================================
// Copyright 2010 NEXCOM Systems
// ------------------------------------------------------------------------
// 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.cipango.diameter.router;

import java.util.Hashtable;
import java.util.Map;

import org.cipango.diameter.node.DiameterRequest;
import org.cipango.diameter.node.Peer;

public class DefaultRouter implements DiameterRouter
{

	private Map<String, Peer> _peers = new Hashtable<String, Peer>();

	public Peer getRoute(DiameterRequest request)
	{
		if (request.getDestinationHost() == null)
			return null;
		return _peers.get(request.getDestinationHost());
	}

	public void peerAdded(Peer peer)
	{
		_peers.put(peer.getHost(), peer);
	}

	public void peerRemoved(Peer peer)
	{
		_peers.remove(peer.getHost());
	}

}

Fix CIPANGO-99: Creating a DiameterServletRequest without specifying the destinationhost field leads to a null pointer exception when sending a the request

git-svn-id: cb8625e300c3faf843aa2977f1eda3273db846e7@506 657f710f-be33-0410-a596-71a6d81f68ef


package uk.ac.ox.oucs.vle;

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

import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

public class WebAppNotFoundException extends WebApplicationException {

	private static final Map<String, String> myMap = new HashMap<String, String>();
	static {
		myMap.put("status", "failed");
		myMap.put("message", "The requested resource was not found");
	}

	public WebAppNotFoundException() {
		super(Response
				.status(Response.Status.NOT_FOUND)
				.type(MediaType.APPLICATION_JSON)
				.entity(myMap)
				.build());
	}

}

package uk.ac.ox.oucs.vle;

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

import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

public class WebAppNotFoundException extends WebApplicationException {

	private static final Map<String, String> myMap = new HashMap<String, String>();
	static {
		myMap.put("status", "failed");
		myMap.put("message", "The requested resource was not found");
	}

	public WebAppNotFoundException() {
		super(Response
				.status(Response.Status.NOT_FOUND)
				// We set the type as when the request doesn't have an accept header
				// jersey will attempt to convert a Map to application/octet-stream
				// which will fail.
				.type(MediaType.APPLICATION_JSON)
				.entity(myMap)
				.build());
	}

}

Add note about why we force the media type.


package com.impossibl.stencil.api.impl;

import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.net.URI;

import com.google.common.hash.Hashing;
import com.impossibl.stencil.api.TemplateSource;

public class InlineTemplateSource implements TemplateSource {

	URI uri;
	String text;

	public InlineTemplateSource(String text) {
		this.text = text;
		this.uri = URI.create("file:" + hash(text));
	}

	String hash(String text) {
		return Hashing.md5().hashString(text).toString();
	}

	@Override
	public void close() throws IOException {
	}

	@Override
	public URI getURI() throws IOException {
		return uri;
	}

	@Override
	public Reader openReader() throws IOException {
		return new StringReader(text);
	}

	@Override
	public String getTag() throws IOException {
		return hash(text);
	}

  @Override
  public String toString() {
    return "InlineTemplateSource [" + uri + "]";
  }

}

package com.impossibl.stencil.api.impl;

import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.net.URI;

import com.google.common.hash.Hashing;
import com.impossibl.stencil.api.TemplateSource;

public class InlineTemplateSource implements TemplateSource {

	URI uri;
	String text;

	public InlineTemplateSource(String text) {
		this.text = text;
		this.uri = URI.create("file:" + hash(text));
	}

	static String hash(String text) {
		return Hashing.md5().hashString(text).toString();
	}

	@Override
	public void close() throws IOException {
	}

	@Override
	public URI getURI() throws IOException {
		return uri;
	}

	@Override
	public Reader openReader() throws IOException {
		return new StringReader(text);
	}

	@Override
	public String getTag() throws IOException {
		return hash(text);
	}

  @Override
  public String toString() {
    return "InlineTemplateSource [" + uri + "]";
  }

}

Make some util functions static

Make some util functions static


package acr.browser.lightning.async;

import android.support.annotation.NonNull;
import android.util.Log;

import java.util.ArrayDeque;
import java.util.Queue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;

/**
 * Created 9/27/2015 Anthony Restaino
 */
public class AsyncExecutor implements Executor {

    private static final String TAG = AsyncExecutor.class.getSimpleName();
    private static AsyncExecutor INSTANCE = new AsyncExecutor();
    private Queue<Runnable> mQueue = new ArrayDeque<>(1);
    private Executor mExecutor = Executors.newFixedThreadPool(4);

    private AsyncExecutor() {}

    public static AsyncExecutor getInstance() {
        return INSTANCE;
    }

    public synchronized void notifyThreadFinish() {
        if (mQueue.isEmpty()) {
            return;
        }
        Runnable runnable = mQueue.remove();
        execute(runnable);
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
    }

    @Override
    public void execute(@NonNull Runnable command) {
        try {
            mExecutor.execute(command);
        } catch (RejectedExecutionException ignored) {
            mQueue.add(command);
            Log.d(TAG, "Thread was enqueued");
        }
    }
}

package acr.browser.lightning.async;

import android.support.annotation.NonNull;
import android.util.Log;

import java.util.ArrayDeque;
import java.util.Queue;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;

/**
 * Created 9/27/2015 Anthony Restaino
 */
public class AsyncExecutor implements Executor {

    private static final String TAG = AsyncExecutor.class.getSimpleName();
    private static AsyncExecutor INSTANCE = new AsyncExecutor();
    private Queue<Runnable> mQueue = new ArrayDeque<>(1);
    private ExecutorService mExecutor = Executors.newFixedThreadPool(4);

    private AsyncExecutor() {}

    public static AsyncExecutor getInstance() {
        return INSTANCE;
    }

    public synchronized void notifyThreadFinish() {
        if (mQueue.isEmpty()) {
            return;
        }
        Runnable runnable = mQueue.remove();
        execute(runnable);
    }

    @Override
    protected void finalize() throws Throwable {
        mExecutor.shutdownNow();
        super.finalize();
    }

    @Override
    public void execute(@NonNull Runnable command) {
        try {
            mExecutor.execute(command);
        } catch (RejectedExecutionException ignored) {
            mQueue.add(command);
            Log.d(TAG, "Thread was enqueued");
        }
    }
}

Use executorservice instead of plain executor to facilitate shutdown


package net.ericschrag.ud_demo.data;

import net.ericschrag.ud_demo.data.model.GithubUser;

import java.util.List;

import retrofit.http.GET;

public interface GithubService {
    @GET("/users")
    public List<GithubUser> getUsers();
}

package net.ericschrag.ud_demo.data;

import net.ericschrag.ud_demo.data.model.GithubUser;

import java.util.List;

import retrofit.http.GET;
import retrofit.http.Headers;

public interface GithubService {
    @Headers("Accept: application/vnd.github.v3+json")
    @GET("/users")
    public List<GithubUser> getUsers();
}

Make sure to tell Github API what version we are expecting


package protocolsupport.zplatform.impl.spigot.block;

import net.minecraft.server.v1_14_R1.BlockWaterLily;
import net.minecraft.server.v1_14_R1.VoxelShapes;
import protocolsupport.utils.ReflectionUtils;

public class SpigotBlocksBoundsAdjust {

	public static void inject() throws IllegalAccessException {
		ReflectionUtils.cloneFields(VoxelShapes.create(0.0625, 0.0, 0.0625, 0.9375, 0.015625, 0.9375), ReflectionUtils.getField(BlockWaterLily.class, "a").get(null));
	}

}

package protocolsupport.zplatform.impl.spigot.block;

import net.minecraft.server.v1_14_R1.BlockLadder;
import net.minecraft.server.v1_14_R1.BlockWaterLily;
import net.minecraft.server.v1_14_R1.VoxelShapes;
import protocolsupport.utils.ReflectionUtils;

public class SpigotBlocksBoundsAdjust {

	public static void inject() throws IllegalAccessException {
		ReflectionUtils.cloneFields(VoxelShapes.create(0.0625D, 0.0, 0.0625D, 0.9375D, 0.015625D, 0.9375D), ReflectionUtils.getField(BlockWaterLily.class, "a").get(null));
		ReflectionUtils.cloneFields(VoxelShapes.create(0.0D, 0.0D, 0.0D, 0.124D, 1.0D, 1.0D), ReflectionUtils.getField(BlockLadder.class, "c").get(null));
		ReflectionUtils.cloneFields(VoxelShapes.create(0.876D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), ReflectionUtils.getField(BlockLadder.class, "d").get(null));
		ReflectionUtils.cloneFields(VoxelShapes.create(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.124D), ReflectionUtils.getField(BlockLadder.class, "e").get(null));
		ReflectionUtils.cloneFields(VoxelShapes.create(0.0D, 0.0D, 0.876D, 1.0D, 1.0D, 1.0D), ReflectionUtils.getField(BlockLadder.class, "f").get(null));
	}

}

Set ladder bounds to pre 1.9.

Set ladder bounds to pre 1.9.

A bit smaller actually, but it has to be done, so the VoxelShape type is
the same.


package uk.ac.ebi.quickgo.annotation;

import uk.ac.ebi.quickgo.annotation.service.search.SearchServiceConfig;
import uk.ac.ebi.quickgo.rest.controller.CORSFilter;
import uk.ac.ebi.quickgo.rest.controller.SwaggerConfig;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

/**
 *
 * The RESTful service configuration for Annotations
 *
 * @author Tony Wardell
 * Date: 26/04/2016
 * Time: 14:41
 * Created with IntelliJ IDEA.
 */
@SpringBootApplication(exclude = {SolrRepositoriesAutoConfiguration.class})
@ComponentScan({"uk.ac.ebi.quickgo.annotation.controller", "uk.ac.ebi.quickgo.rest"})
@Import({SearchServiceConfig.class, SwaggerConfig.class, CORSFilter.class})
public class AnnotationREST {

    /**
     * Ensures that placeholders are replaced with property values
     */
    @Bean
    static PropertySourcesPlaceholderConfigurer propertyPlaceHolderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }

    public static void main(String[] args) {
        SpringApplication.run(AnnotationREST.class, args);
    }
}

package uk.ac.ebi.quickgo.annotation;

import uk.ac.ebi.quickgo.annotation.service.search.SearchServiceConfig;
import uk.ac.ebi.quickgo.rest.controller.CORSFilter;
import uk.ac.ebi.quickgo.rest.controller.SwaggerConfig;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

/**
 *
 * The RESTful service configuration for Annotations
 *
 * @author Tony Wardell
 * Date: 26/04/2016
 * Time: 14:41
 * Created with IntelliJ IDEA.
 */
@SpringBootApplication(exclude = {SolrRepositoriesAutoConfiguration.class})
@ComponentScan({"uk.ac.ebi.quickgo.annotation.controller",
        "uk.ac.ebi.quickgo.rest",
        "uk.ac.ebi.quickgo.annotation.service.statistics"})
@Import({SearchServiceConfig.class, SwaggerConfig.class, CORSFilter.class})
public class AnnotationREST {

    /**
     * Ensures that placeholders are replaced with property values
     */
    @Bean
    static PropertySourcesPlaceholderConfigurer propertyPlaceHolderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }

    public static void main(String[] args) {
        SpringApplication.run(AnnotationREST.class, args);
    }
}

Add statistics package to component scan.


package de.philipphager.disclosure.feature.navigation;

import android.app.Activity;
import de.philipphager.disclosure.database.app.model.App;
import de.philipphager.disclosure.database.library.model.Library;
import de.philipphager.disclosure.feature.app.detail.DetailActivity;
import de.philipphager.disclosure.feature.home.HomeActivity;
import de.philipphager.disclosure.feature.library.detail.LibraryOverviewActivity;
import javax.inject.Inject;

public class Navigator {
  private Activity activity;

  @SuppressWarnings("PMD.UnnecessaryConstructor") @Inject public Navigator() {
    // Needed for dagger injection.
  }

  public void setActivity(Activity activity) {
    this.activity = activity;
  }

  public void toHome() {
    activity.startActivity(HomeActivity.launch(activity));
  }

  public void toAppDetail(App app) {
    activity.startActivity(DetailActivity.launch(activity, app));
  }

  public void toLibraryOverview(Library library) {
    activity.startActivity(LibraryOverviewActivity.launch(activity, library));
  }
}

package de.philipphager.disclosure.feature.navigation;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;
import de.philipphager.disclosure.database.app.model.App;
import de.philipphager.disclosure.database.library.model.Library;
import de.philipphager.disclosure.feature.app.detail.DetailActivity;
import de.philipphager.disclosure.feature.home.HomeActivity;
import de.philipphager.disclosure.feature.library.detail.LibraryOverviewActivity;
import javax.inject.Inject;

public class Navigator {
  private Activity activity;

  @SuppressWarnings("PMD.UnnecessaryConstructor") @Inject public Navigator() {
    // Needed for dagger injection.
  }

  public void setActivity(Activity activity) {
    this.activity = activity;
  }

  public void toHome() {
    activity.startActivity(HomeActivity.launch(activity));
  }

  public void toAppDetail(App app) {
    activity.startActivity(DetailActivity.launch(activity, app));
  }

  public void toLibraryOverview(Library library) {
    activity.startActivity(LibraryOverviewActivity.launch(activity, library));
  }

  public void toAppSystemSettings(String packageName) {
    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
        Uri.fromParts("package", packageName, null));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    activity.startActivity(intent);
  }

  public void toSystemUpdates() {
    Intent intent = new Intent("android.settings.SYSTEM_UPDATE_SETTINGS");
    activity.startActivity(intent);
  }
}

Add navigation to system settings and updates


package som.primitives;

import com.oracle.truffle.api.dsl.GenerateNodeFactory;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.source.SourceSection;

import som.interpreter.nodes.nary.UnaryExpressionNode;
import som.vmobjects.SAbstractObject;
import som.vmobjects.SSymbol;

@GenerateNodeFactory
@Primitive({"objHashcode:", "stringHashcode:"})
public abstract class HashPrim extends UnaryExpressionNode {
  public HashPrim(final SourceSection source) { super(false, source); }

  @Specialization
  public final long doString(final String receiver) {
    return receiver.hashCode();
  }

  @Specialization
  public final long doSSymbol(final SSymbol receiver) {
    return receiver.getString().hashCode();
  }

  @Specialization
  public final long doSAbstractObject(final SAbstractObject receiver) {
    return receiver.hashCode();
  }
}

package som.primitives;

import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.source.SourceSection;

import som.interpreter.nodes.nary.UnaryExpressionNode;
import som.vmobjects.SAbstractObject;
import som.vmobjects.SSymbol;

@GenerateNodeFactory
@Primitive({"objHashcode:", "stringHashcode:"})
public abstract class HashPrim extends UnaryExpressionNode {
  public HashPrim(final SourceSection source) { super(false, source); }

  @Specialization
  @TruffleBoundary
  public final long doString(final String receiver) {
    return receiver.hashCode();
  }

  @Specialization
  @TruffleBoundary
  public final long doSSymbol(final SSymbol receiver) {
    return receiver.getString().hashCode();
  }

  @Specialization
  public final long doSAbstractObject(final SAbstractObject receiver) {
    return receiver.hashCode();
  }
}

Mark String hash methods as boundary

Mark String hash methods as boundary

Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>


package com.jetbrains.python.console;

import com.jetbrains.python.console.pydev.PydevConsoleCommunication;
import org.apache.xmlrpc.WebServer;
import org.apache.xmlrpc.XmlRpcHandlerMapping;
import org.apache.xmlrpc.XmlRpcServer;

/**
 * Web server to handle all the input requests by PydevConsoleCommunication
 * @author oleg
 */
public class PydevWebServer extends WebServer {
  public PydevWebServer(int port, final PydevConsoleCommunication communication) {
    super(port, null, new XmlRpcServer(){
      final XmlRpcHandlerMapping xmlRpcHandlerMapping = new XmlRpcHandlerMapping() {
        public Object getHandler(String handlerName) throws Exception {
          return communication;
        }
      };
      @Override
      public XmlRpcHandlerMapping getHandlerMapping() {
        return xmlRpcHandlerMapping;
      }
    });
  }
}

package com.jetbrains.python.console;

import com.jetbrains.python.console.pydev.PydevConsoleCommunication;
import org.apache.xmlrpc.WebServer;
import org.apache.xmlrpc.XmlRpcServer;

/**
 * Web server to handle all the input requests by PydevConsoleCommunication
 * @author oleg
 */
public class PydevWebServer extends WebServer {
  public PydevWebServer(int port, final PydevConsoleCommunication communication) {
    super(port, null, createXmlRpcServer(communication));
  }

  private static XmlRpcServer createXmlRpcServer(final PydevConsoleCommunication communication) {
    final XmlRpcServer server = new XmlRpcServer();
    server.addHandler("$default", communication);
    return server;
  }
}

Correct way of registering XML RPC handler


package fgis.server.support.geojson;

import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.json.JsonValue;
import org.geolatte.geom.Envelope;
import org.geolatte.geom.Geometry;
import org.geolatte.geom.GeometryCollection;
import org.geolatte.geom.crs.CrsId;

public final class GjGeometry
  extends GjElement
{
  @Nonnull
  private final Geometry _geometry;

  @SuppressWarnings( "ConstantConditions" )
  public GjGeometry( @Nonnull final Geometry geometry,
                     @Nullable final CrsId crsId,
                     @Nullable final Envelope bbox,
                     @Nullable final Map<String, JsonValue> additionalProperties )
  {
    super( crsId, bbox, additionalProperties );
    if ( null == geometry )
    {
      throw new IllegalArgumentException( "geometry is null" );
    }
    if ( geometry instanceof GeometryCollection )
    {
      throw new IllegalStateException( "geometry is a GeometryCollection" );
    }
    _geometry = geometry;
  }

  @Nonnull
  public Geometry getGeometry()
  {
    return _geometry;
  }

  @Override
  protected boolean isPropertyAllowed( final String name )
  {
    return super.isPropertyAllowed( name ) && !( "coordinates".equals( name ) );
  }
}

package fgis.server.support.geojson;

import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.json.JsonValue;
import org.geolatte.geom.Envelope;
import org.geolatte.geom.Geometry;
import org.geolatte.geom.GeometryCollection;
import org.geolatte.geom.crs.CrsId;

public final class GjGeometry
  extends GjElement
{
  @Nonnull
  private final Geometry _geometry;

  @SuppressWarnings( "ConstantConditions" )
  public GjGeometry( @Nonnull final Geometry geometry,
                     @Nullable final CrsId crsId,
                     @Nullable final Envelope bbox,
                     @Nullable final Map<String, JsonValue> additionalProperties )
  {
    super( crsId, bbox, additionalProperties );
    if ( null == geometry )
    {
      throw new IllegalArgumentException( "geometry is null" );
    }
    if ( geometry instanceof GeometryCollection )
    {
      throw new IllegalArgumentException( "geometry is a GeometryCollection" );
    }
    _geometry = geometry;
  }

  @Nonnull
  public Geometry getGeometry()
  {
    return _geometry;
  }

  @Override
  protected boolean isPropertyAllowed( final String name )
  {
    return super.isPropertyAllowed( name ) && !( "coordinates".equals( name ) );
  }
}

Correct the type of exception thrown when bad geometry data passed to the constructor


/**
 * Représente un robot
 */
public class Robot {
	private String name;
	private Point2D pos;
	private int energy;
	private int health;

	/** Crée un robot */
	public Robot(String name) {
		this.name = name;
		this.pos = new Point2D(0,0);
		this.energy = 100;
		this.health = 100;
	}

	/** @param health new health value */
	public void setHealth(int health) {this.health = health;}

	/** @param energy new energy value */
	public void setEnergy(int energy) {this.energy = energy;}

	/** @param position new position*/
	public void setPosition(int position) {this.position = position;}

	/** @return The level of health of the robot*/
	public int getHealth() {return this.health;}

	/** @return the energy of the robot*/
	public int getHealth() {return this.health;}
}

/**
 * Représente un robot
 */
public class Robot {
	private String name;
	private Point2D position;
	private int energy;
	private int health;

	/** Crée un robot */
	public Robot(String name) {
		this.name = name;
		this.position = new Point2D(0,0);
		this.energy = 100;
		this.health = 100;
	}

	/** @param health new health value */
	public void setHealth(int health) {this.health = health;}

	/** @param energy new energy value */
	public void setEnergy(int energy) {this.energy = energy;}

	/** @param position new position*/
	public void setPosition(Point2D position) {this.position = position;}

	/** @return The level of health of the robot*/
	public int getHealth() {return this.health;}

	/** @return the energy of the robot*/
	public int getEnergy() {return this.energy;}

	/** @return the position of the robot*/
	public Point2D getPosition() {return this.position;}
}

Add getters, change variable names, fix error


package br.com.bloder.blorm;

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

public class MainActivity extends AppCompatActivity {

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

package br.com.bloder.blorm;

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

import br.com.bloder.blormlib.Blorm;
import br.com.bloder.blormlib.validation.Validations;

public class MainActivity extends AppCompatActivity {

  private EditText editTextFilled;
  private Button submit;

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

    editTextFilled = (EditText) findViewById(R.id.edit_text_filled);
    submit = (Button) findViewById(R.id.submit);

    new Blorm.Builder(this).field(editTextFilled).is(Validations.filled).onSubmit(submit);
  }
}

Add edit text and button example in main activity


package org.alien4cloud.tosca.utils;

import static alien4cloud.utils.AlienUtils.safe;

import java.util.Map;
import java.util.Optional;

import org.alien4cloud.tosca.model.definitions.ImplementationArtifact;
import org.alien4cloud.tosca.model.definitions.Interface;
import org.alien4cloud.tosca.model.definitions.Operation;

public final class InterfaceUtils {
    private InterfaceUtils() {
    }

    public static ImplementationArtifact getArtifact(Map<String, Interface> interfaceMap, String interfaceName, String operationName) {
        Optional.of(safe(interfaceMap).get(interfaceName)).map()
        Interface interfaz = safe(interfaceMap).get(interfaceName);
        if (interfaz == null) {
            return null;
        }
        Operation operation = safe(interfaz.getOperations()).get(operationName);
        if(operation == null) {
            return null;
        }
        return operation.getImplementationArtifact();
    }
}

package org.alien4cloud.tosca.utils;

import static alien4cloud.utils.AlienUtils.safe;

import java.util.Map;
import java.util.Optional;

import org.alien4cloud.tosca.model.definitions.ImplementationArtifact;
import org.alien4cloud.tosca.model.definitions.Interface;
import org.alien4cloud.tosca.model.definitions.Operation;

public final class InterfaceUtils {
    private InterfaceUtils() {
    }

    public static ImplementationArtifact getArtifact(Map<String, Interface> interfaceMap, String interfaceName, String operationName) {
        Interface interfaz = safe(interfaceMap).get(interfaceName);
        if (interfaz == null) {
            return null;
        }
        Operation operation = safe(interfaz.getOperations()).get(operationName);
        if(operation == null) {
            return null;
        }
        return operation.getImplementationArtifact();
    }
}

[ALIEN-2755] Allow specific handling of docker image artifact update in the editor, util fix.


package com.marakana.android.yamba;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;

public class BootReceiver extends BroadcastReceiver {
	private static final String TAG = BootReceiver.class.getSimpleName();
	private static final long DEFAULT_INTERVAL = AlarmManager.INTERVAL_FIFTEEN_MINUTES;

	@Override
	public void onReceive(Context context, Intent intent) {

		SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		long interval = Long.parseLong(prefs.getString("interval",
				Long.toString(DEFAULT_INTERVAL)));

		PendingIntent operation = PendingIntent.getService(context, -1,
				new Intent(context, RefreshService.class),
				PendingIntent.FLAG_UPDATE_CURRENT);

		AlarmManager alarmManager = (AlarmManager) context
				.getSystemService(Context.ALARM_SERVICE);

		if (interval == 0) {
			alarmManager.cancel(operation);
			Log.d(TAG, "cancelling repeat operation");
		} else {
			alarmManager.setInexactRepeating(AlarmManager.RTC,
					System.currentTimeMillis(), interval, operation);
			Log.d(TAG, "setting repeat operation for: " + interval);
		}
		Log.d(TAG, "onReceived");
	}
}

package com.marakana.android.yamba;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.util.Log;

public class BootReceiver extends BroadcastReceiver {
	private static final String TAG = BootReceiver.class.getSimpleName();
	private static final long DEFAULT_INTERVAL = AlarmManager.INTERVAL_FIFTEEN_MINUTES;

	@Override
	public void onReceive(Context context, Intent intent) {

		SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(context);
		long interval = Long.parseLong(prefs.getString("interval",
				Long.toString(DEFAULT_INTERVAL)));

		PendingIntent operation = PendingIntent.getService(context, -1,
				new Intent(context, RefreshService.class),
				PendingIntent.FLAG_UPDATE_CURRENT);

		AlarmManager alarmManager = (AlarmManager) context
				.getSystemService(Context.ALARM_SERVICE);

		if (interval == 0) {
			alarmManager.cancel(operation);
			Log.d(TAG, "cancelling repeat operation");
		} else {
			alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME,
					SystemClock.elapsedRealtime(), interval, operation);
			Log.d(TAG, "setting repeat operation for: " + interval);
		}
		Log.d(TAG, "onReceived");
	}
}

Change repeating alarm to be ELAPSED_REALTIME type

Change repeating alarms scheduled by AlarmManager in BootReceiver
to be AlarmManager.ELAPSED_REALTIME type instead of RTC type,
since we don't need alarms to be fired at particular time, only
at particular interval; following best practices here:
https://developer.android.com/training/scheduling/alarms.html


package com.adaptc.mws.plugins;

/**
 * This enum represents which suite or context Moab Web Services is running in -
 * HPC or Cloud.
 * @author bsaville
 */
public enum Suite {
	HPC("HPC"),
	CLOUD("Cloud");

	/**
	 * The default suite for MWS.  This is equivalent to {@link #CLOUD}.
	 */
	public static final Suite DEFAULT_SUITE = Suite.CLOUD;

	private String str;

	private Suite(String str) {
		this.str = str;
	}

	/**
	 * Returns the suite in a human-readable string, such as "Cloud" for {@link #CLOUD} and "HPC" for
	 * {@link #HPC}.
	 * @return A human-readable string
	 */
	public String toString() {
		return str;
	}

	/**
	 * Returns {@link #DEFAULT_SUITE} by default if none is found matching.  This is a
	 * case insensitive match.  Spaces and underscores are also equivalent for parsing.
	 * @param suite The suite as a string
	 * @return The corresponding suite value
	 */
	public static Suite parseString(String suite) {
		for(Suite val : values()) {
			if (val.toString().equalsIgnoreCase(suite) || val.name().equalsIgnoreCase(suite))
				return val;
		}
		return DEFAULT_SUITE;
	}

	/**
	 * A helper method to make sure that a true Suite reference may be used.
	 * @param suite An actual suite value
	 * @return The suite parameter
	 */
	public static Suite parseString(Suite suite) {
		return suite;
	}
}

package com.adaptc.mws.plugins;

/**
 * This enumeration represents which suite or context Moab Web Services is running in.
 * @author bsaville
 */
public enum Suite {
	HPC("HPC"),
	CLOUD("Cloud");

	/**
	 * The default suite for MWS.  This is equivalent to {@link #CLOUD}.
	 */
	public static final Suite DEFAULT_SUITE = Suite.CLOUD;

	private String str;

	private Suite(String str) {
		this.str = str;
	}

	/**
	 * Returns the suite in a human-readable string, such as "Cloud" for {@link #CLOUD} and "HPC" for
	 * {@link #HPC}.
	 * @return A human-readable string
	 */
	public String toString() {
		return str;
	}

	/**
	 * Returns {@link #DEFAULT_SUITE} by default if none is found matching.  This is a
	 * case insensitive match.  Spaces and underscores are also equivalent for parsing.
	 * @param suite The suite as a string
	 * @return The corresponding suite value
	 */
	public static Suite parseString(String suite) {
		for(Suite val : values()) {
			if (val.toString().equalsIgnoreCase(suite) || val.name().equalsIgnoreCase(suite))
				return val;
		}
		return DEFAULT_SUITE;
	}

	/**
	 * A helper method to make sure that a true Suite reference may be used.
	 * @param suite An actual suite value
	 * @return The suite parameter
	 */
	public static Suite parseString(Suite suite) {
		return suite;
	}
}

Change comment on suite a bit

Change comment on suite a bit


package net.techcable.jstruct;

/**
 * All classes annotated with this field will be <href a=https://wikipedia.org/wiki/PassByValue>pass by value</href>
 *

 * In order to preserve the contract of objects in the java language, JStructs can only have final fields.
 * Otherwise modifications to a JStruct would not be reflected in all objects.
 *

 * Certain operations can't be performed on a JStruct and will throw an {@link UnsupportedOperationException}:
 *

 *
Synchronization

 *
wait() and notify()

 *
Identity Comparison (o1 == o2)

 *

 *

 * The current implementation of JStruct makes everything pass by value, so the
 * If your JVM does not support escape analysis {@code JStruct} should not be used.
 * Otherwise memory usage will skyrocket, as every struct will be re-allocated on the heap for every method call.
 */
public @interface JStruct {}

package net.techcable.jstruct;

/**
 * All classes annotated with this field will be <href a=https://wikipedia.org/wiki/PassByValue>pass by value</href>
 *

 * In order to preserve the contract of objects in the java language, JStructs can only have final fields.
 * Otherwise modifications to a JStruct would not be reflected in all objects.
 *

 * Certain operations can't be performed on a JStruct and will throw an {@link UnsupportedOperationException}:
 *

 *
Synchronization

 *
wait() and notify()

 *
Identity Comparison (o1 == o2)

 *

 *

 * If your JVM does not support escape analysis {@code JStruct} should not be used.
 * Otherwise memory usage will skyrocket, as every struct will be re-allocated on the heap for every method call.
 */
public @interface JStruct {}

Remove some in completed documentation.

Remove some in completed documentation.

Fixes #1


/**
 *
 */
package org.opennms.dashboard.client;

import com.google.gwt.user.client.ui.FlexTable;

class NotificationView extends PageableTableView {

    private Notification[] m_notifications;

    NotificationView() {
        super(new String[] { "Node", "Service", "Sent Time", "Responder", "Response Time" });
    }

    public void setNotifications(Notification[] notifications) {
        m_notifications = notifications;
        refresh();

    }

	protected void setRow(FlexTable table, int row, int elementIndex) {
		Notification notif = m_notifications[elementIndex];
        table.setText(row, 0, notif.getNodeLabel());
        table.setText(row, 1, notif.getServiceName());
        table.setText(row, 2, ""+notif.getSentTime());
        table.setText(row, 3, notif.getResponder());
        table.setText(row, 4, ""+notif.getRespondTime());
        table.getRowFormatter().setStyleName(row, notif.getSeverity());
    }

    public int getElementCount() {
        return (m_notifications == null ? 0 : m_notifications.length);
    }

}

/**
 *
 */
package org.opennms.dashboard.client;

import com.google.gwt.user.client.ui.FlexTable;

class NotificationView extends PageableTableView {

    private Notification[] m_notifications;

    NotificationView() {
        super(new String[] { "Node", "Service", "Sent Time", "Responder", "Response Time" });
    }

    public void setNotifications(Notification[] notifications) {
        m_notifications = notifications;
        refresh();

    }

	protected void setRow(FlexTable table, int row, int elementIndex) {
		Notification notif = m_notifications[elementIndex];
        table.setText(row, 0, notif.getNodeLabel());
        table.setText(row, 1, notif.getServiceName());
        table.setText(row, 2, ""+notif.getSentTime());
        table.setText(row, 3, notif.getResponder());
        table.setText(row, 4, (notif.getRespondTime() != null) ? notif.getRespondTime().toString() : "");
        table.getRowFormatter().setStyleName(row, notif.getSeverity());
    }

    public int getElementCount() {
        return (m_notifications == null ? 0 : m_notifications.length);
    }

}

Fix the case where respond time is null

Fix the case where respond time is null


package org.synyx.urlaubsverwaltung.mail;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;

@Validated
@ConfigurationProperties(prefix = "uv.mail")
public class MailProperties {

    @Email
    @NotEmpty
    private String sender;

    @Email
    @NotEmpty
    private String administrator;

    @URL
    private String applicationUrl;

    public String getSender() {
        return sender;
    }

    public void setSender(String sender) {
        this.sender = sender;
    }

    public String getAdministrator() {
        return administrator;
    }

    public void setAdministrator(String administrator) {
        this.administrator = administrator;
    }

    public String getApplicationUrl() {
        return applicationUrl;
    }

    public void setApplicationUrl(String applicationUrl) {
        this.applicationUrl = applicationUrl;
    }
}

package org.synyx.urlaubsverwaltung.mail;

import org.hibernate.validator.constraints.URL;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;

@Validated
@ConfigurationProperties(prefix = "uv.mail")
public class MailProperties {

    @Email
    @NotEmpty
    private String sender;

    @Email
    @NotEmpty
    private String administrator;

    @URL
    private String applicationUrl;

    public String getSender() {
        return sender;
    }

    public void setSender(String sender) {
        this.sender = sender;
    }

    public String getAdministrator() {
        return administrator;
    }

    public void setAdministrator(String administrator) {
        this.administrator = administrator;
    }

    public String getApplicationUrl() {
        return applicationUrl;
    }

    public void setApplicationUrl(String applicationUrl) {
        this.applicationUrl = applicationUrl;
    }
}

Revert "Remove not used imports"

Revert "Remove not used imports"

This reverts commit 85706eb3faffe65b77432a46cde0ff9fe2a4312f.


package com.juotos.prr.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.juotos.prr.PRRGame;

public class DesktopLauncher {
	public static void main (String[] arg) {
		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
		new LwjglApplication(new PRRGame(), config);
	}
}

package com.juotos.prr.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.juotos.prr.PRRGame;

public class DesktopLauncher {
	public static void main (String[] arg) {
		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
		config.title = "portrait-runner-runner";
		config.width = 480;
		config.height = 800;

		new LwjglApplication(new PRRGame(), config);
	}
}

Add default window size + title to Desktop Launcher


import org.realityforge.arez.annotations.Action;
import org.realityforge.arez.annotations.Container;
import org.realityforge.arez.annotations.Observable;

@Container( name = "Time", singleton = true )
public class TimeModel
{
  private long _time;

  protected TimeModel( final long time )
  {
    _time = time;
  }

  @Observable
  public long getTime()
  {
    return _time;
  }

  public void setTime( final long time )
  {
    _time = time;
  }

  @Action
  public void updateTime()
  {
    setTime( System.currentTimeMillis() );
  }
}

import org.realityforge.arez.annotations.Action;
import org.realityforge.arez.annotations.Container;
import org.realityforge.arez.annotations.Observable;

@Container( name = "Time", singleton = true )
public class TimeModel
{
  private long _time;

  protected TimeModel( final long time )
  {
    _time = time;
  }

  @Observable
  public long getTime()
  {
    return _time;
  }

  @Observable
  public void setTime( final long time )
  {
    _time = time;
  }

  @Action
  public void updateTime()
  {
    setTime( System.currentTimeMillis() );
  }
}

Add @Observable annotation to make it easier to parse for the time being