package devopsdistilled.operp.client.business.sales.panes.controllers.impl;

import javax.inject.Inject;

import devopsdistilled.operp.client.abstracts.EntityOperation;
import devopsdistilled.operp.client.business.sales.panes.SaleDescPane;
import devopsdistilled.operp.client.business.sales.panes.controllers.SaleDescPaneController;
import devopsdistilled.operp.client.business.sales.panes.models.SaleDescPaneModel;
import devopsdistilled.operp.client.exceptions.EntityValidationException;
import devopsdistilled.operp.server.data.entity.business.SaleDesc;

public class SaleDescPaneControllerImpl implements SaleDescPaneController {

	@Inject
	private SaleDescPane view;

	@Inject
	private SaleDescPaneModel model;

	@Override
	public void validate() throws EntityValidationException {
		// TODO Auto-generated method stub

	}

	@Override
	public SaleDesc save() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public SaleDescPaneModel getModel() {
		return model;
	}

	@Override
	public SaleDescPane getView() {
		return view;
	}

	@Override
	public void init(SaleDesc entity, EntityOperation entityOperation) {
		// TODO Auto-generated method stub
		model.registerObserver(view);
	}

}

package devopsdistilled.operp.client.business.sales.panes.controllers.impl;

import javax.inject.Inject;

import devopsdistilled.operp.client.abstracts.EntityOperation;
import devopsdistilled.operp.client.business.sales.panes.SaleDescPane;
import devopsdistilled.operp.client.business.sales.panes.controllers.SaleDescPaneController;
import devopsdistilled.operp.client.business.sales.panes.models.SaleDescPaneModel;
import devopsdistilled.operp.client.exceptions.EntityValidationException;
import devopsdistilled.operp.server.data.entity.business.SaleDesc;

public class SaleDescPaneControllerImpl implements SaleDescPaneController {

	@Inject
	private SaleDescPane view;

	@Inject
	private SaleDescPaneModel model;

	@Override
	public void validate() throws EntityValidationException {
		// TODO Auto-generated method stub

	}

	@Override
	public SaleDesc save() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public SaleDescPaneModel getModel() {
		return model;
	}

	@Override
	public SaleDescPane getView() {
		return view;
	}

	@Override
	public void init(SaleDesc saleDesc, EntityOperation entityOperation) {
		// TODO Auto-generated method stub

		view.setController(this);
		view.resetComponents();

		model.registerObserver(view);
		model.setEntityAndEntityOperation(saleDesc, entityOperation);
	}

}

Set and Register view & model

Set and Register view & model

OPEN - task 86: Create Business(Sales-Purchases) Module
http://github.com/DevOpsDistilled/OpERP/issues/issue/86


package grails.plugin.mongogee;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Class containing particular changesets (@{@link ChangeSet})
 *
 * @author lstolowski
 * @see ChangeSet
 * @since 27/07/2014
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface ChangeLog {
    /**
     * Sequence that provide an order for changelog classes.
     * If not set, then canonical name of the class is taken and sorted alphabetically, ascending.
     *
     * @return order
     */
    String order() default "";

    //todo: add dependOn field
}

package grails.plugin.mongogee;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Class containing particular changesets (@{@link ChangeSet})
 *
 * @author lstolowski
 * @see ChangeSet
 * @since 27/07/2014
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface ChangeLog {
    /**
     * Sequence that provide an order for changelog classes.
     * If not set, then canonical name of the class is taken and sorted alphabetically, ascending.
     *
     * @return order
     */
    String order() default "";
    String release() default "";

    //todo: add dependOn field
}

Add release attribute to change log

Add release attribute to change log


package com.gmail.alexellingsen.g2skintweaks;

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

public class UpdateLedPaths extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        SettingsHelper settings = new SettingsHelper(context);

        boolean shouldCache = !settings.getBoolean(Prefs.TURN_ON_SCREEN_NEW_SMS, true) &&
                settings.getBoolean(Prefs.ENABLE_POWER_LED, true);

        if (shouldCache) {
            // Cache the path to backlights so it wont have to search for it.
            final Context finalContext = context;

            new Thread(new Runnable() {
                @Override
                public void run() {
                    RootFunctions.updatePowerLedPaths(finalContext);
                }
            }).start();
        }
    }

}

package com.gmail.alexellingsen.g2skintweaks;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import de.robv.android.xposed.XposedBridge;

public class UpdateLedPaths extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        final SettingsHelper settings = new SettingsHelper(context);

        boolean shouldCache = !settings.getBoolean(Prefs.TURN_ON_SCREEN_NEW_SMS, true) &&
                settings.getBoolean(Prefs.ENABLE_POWER_LED, true);

        if (shouldCache) {
            // Cache the path to backlights so it wont have to search for it.
            final Context finalContext = context;

            new Thread(new Runnable() {
                @Override
                public void run() {
                    RootFunctions.updatePowerLedPaths(finalContext);

                    if (settings.getBoolean(Prefs.ENABLE_DEBUGGING, false)) {
                        XposedBridge.log("Updated LED paths.");
                    }
                }
            }).start();
        }
    }

}

Add debugging to update LED paths

Add debugging to update LED paths


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

package com.google.gson;

import java.net.InetAddress;

import junit.framework.TestCase;

/**
 * Unit tests for the default serializer/deserializer for the {@code InetAddress} type.
 *
 * @author Joel Leitch
 */
public class DefaultInetAddressTypeAdapterTest extends TestCase {
  private Gson gson;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    gson = new Gson();
  }

  public void testInetAddressSerializationAndDeserialization() throws Exception {
    InetAddress localhost = InetAddress.getLocalHost();
    String localInetAddress = gson.toJson(localhost);
    assertEquals("\"" + localhost.getHostAddress() + "\"", localInetAddress);

    InetAddress value = gson.fromJson(localInetAddress, InetAddress.class);
    assertEquals(localhost, value);
  }
}

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

package com.google.gson;

import java.net.InetAddress;

import junit.framework.TestCase;

/**
 * Unit tests for the default serializer/deserializer for the {@code InetAddress} type.
 *
 * @author Joel Leitch
 */
public class DefaultInetAddressTypeAdapterTest extends TestCase {
  private Gson gson;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    gson = new Gson();
  }

  public void testInetAddressSerializationAndDeserialization() throws Exception {
    InetAddress address = InetAddress.getByName("8.8.8.8");
    String jsonAddress = gson.toJson(address);
    assertEquals("\"8.8.8.8\"", jsonAddress);

    InetAddress value = gson.fromJson(jsonAddress, InetAddress.class);
    assertEquals(value, address);
  }
}

Replace localhost lookup with static IP to fix test.

Calling InetAddress.getLocalHost() will cause a lookup to occur that may
fail with a java.net.UnknownHostException if the system the test is
running on is not configured correctly.

This is often fixed by echoing "127.0.0.1 $HOSTNAME" to /etc/hosts, but
in this case it seems easier to pick a static IP string to avoid the
lookup entirely and prevent false negatives in the test.


/**
 * 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.component.zookeeper.ha;

import org.apache.camel.ha.CamelClusterService;
import org.apache.camel.impl.ha.ClusteredRoutePolicyFactory;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringZooKeeperClusteredRouteConfigurationTest extends CamelSpringTestSupport {

    @Test
    public void test() {
        assertNotNull(context.hasService(CamelClusterService.class));
        assertTrue(context.getRoutePolicyFactories().stream().anyMatch(ClusteredRoutePolicyFactory.class::isInstance));
    }

    // ***********************
    // Routes
    // ***********************

    @Override
    protected AbstractApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("org/apache/camel/component/zookeeper/ha/SpringZooKeeperClusteredRouteConfigurationTest.xml");
    }
}

Fix Checkstyle issues / add missing license header


package hello;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

@RestController
public class ArchivedCardController {

    @RequestMapping("/archivedCards")
    public List<ArchivedCard> archivedCard() {
        List<ArchivedCard> archivedCardList = new ArrayList<ArchivedCard>();
        ArchivedCard card1 = new ArchivedCard();
        card1.setText("Take Claritin");
        card1.setDate("05/31/2105");
        archivedCardList.add(card1);

        ArchivedCard card2 = new ArchivedCard();
        card2.setText("Save the whales");
        card2.setDate("05/31/2105");
        archivedCardList.add(card2);

        return archivedCardList;
    }

}

package hello;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

@RestController
public class ArchivedCardController {

    @RequestMapping("/archivedCards")
    public List<ArchivedCard> archivedCard() {
        List<ArchivedCard> archivedCardList = new ArrayList<ArchivedCard>();
        ArchivedCard card1 = new ArchivedCard();
        card1.setText("Take Claritin");
        card1.setDate("5/31/2105");
        archivedCardList.add(card1);

        ArchivedCard card2 = new ArchivedCard();
        card2.setText("Save the whales");
        card2.setDate("5/31/2105");
        archivedCardList.add(card2);

        return archivedCardList;
    }

}

Tweak to hard code values to make test pass


/**
 * Deprecated as of Spring Framework 5.2 in favor of complete
 * solutions from third parties such as
 * Simple-JNDI.
 *
 *
The simplest implementation of the JNDI SPI that could possibly work.
 *
 *
Useful for setting up a simple JNDI environment for test suites
 * or stand-alone applications. If, for example, JDBC DataSources get bound to the
 * same JNDI names as within a Java EE container, both application code and
 * configuration can be reused without changes.
 */
@Deprecated
@NonNullApi
@NonNullFields
package org.springframework.mock.jndi;

import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;

/**
 * Deprecated as of Spring Framework 5.2 in favor of complete
 * solutions from third parties such as
 * Simple-JNDI.
 *
 *
The simplest implementation of the JNDI SPI that could possibly work.
 *
 *
Useful for setting up a simple JNDI environment for test suites
 * or stand-alone applications. If, for example, JDBC DataSources get bound to the
 * same JNDI names as within a Java EE container, both application code and
 * configuration can be reused without changes.
 */
@NonNullApi
@NonNullFields
package org.springframework.mock.jndi;

import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;

Remove @Deprecated from org.springframework.mock.jndi package

This commit removes the @Deprecated declaration on the
org.springframework.mock.jndi package, since such usage results in a
compiler warning on JDK 9+ which breaks Spring's JDK 9 and JDK 11 CI
builds.

https://bugs.openjdk.java.net/browse/JDK-6481080

See gh-22779


//
// $Id: BrowsePanel.java,v 1.2 2002/02/22 07:06:33 mdb Exp $

package robodj.chooser;

import javax.swing.*;

import robodj.repository.*;

public class BrowsePanel extends JTabbedPane
{
    public BrowsePanel ()
    {
        EntryList elist;
        Category[] cats = Chooser.model.getCategories();

        // create a tab for each category
        for (int i = 0; i < cats.length; i++) {
            elist = new CategoryEntryList(cats[i].categoryid);
            String tip = "Browse entries in '" + cats[i].name + "' category.";
            addTab(cats[i].name, null, elist, tip);
        }

        // and add one for uncategorized entries
        elist = new CategoryEntryList(-1);
        addTab("Uncategorized", null, elist,
               "Browse uncategorized entries.");

        setSelectedIndex(0);
    }
}

//
// $Id: BrowsePanel.java,v 1.3 2002/11/11 17:04:12 mdb Exp $

package robodj.chooser;

import javax.swing.*;

import robodj.repository.*;

public class BrowsePanel extends JTabbedPane
{
    public BrowsePanel ()
    {
        EntryList elist;
        Category[] cats = Chooser.model.getCategories();

        // stick our tabs along the side and scroll if they don't fit
        setTabPlacement(LEFT);
        setTabLayoutPolicy(SCROLL_TAB_LAYOUT);

        // create a tab for each category
        for (int i = 0; i < cats.length; i++) {
            elist = new CategoryEntryList(cats[i].categoryid);
            String tip = "Browse entries in '" + cats[i].name + "' category.";
            addTab(cats[i].name, null, elist, tip);
        }

        // and add one for uncategorized entries
        elist = new CategoryEntryList(-1);
        addTab("Uncategorized", null, elist,
               "Browse uncategorized entries.");

        setSelectedIndex(0);
    }
}

Put the category tabs on the left and scroll them if they are too many.

git-svn-id: 64ebf368729f38804935acb7146e017e0f909c6b@907 6335cc39-0255-0410-8fd6-9bcaacd3b74c


package com.getbeamapp.transit;

public abstract class AbstractTransitContext extends TransitProxy {

    public AbstractTransitContext() {
        super(null);
        this.rootContext = this;
    }

    @Override
    public abstract TransitProxy eval(String stringToEvaluate, TransitProxy context, Object... arguments);

    private int _nextNativeId = 0;

    public String nextNativeId() {
        return String.valueOf(_nextNativeId++);
    }

}

package com.getbeamapp.transit;

public abstract class AbstractTransitContext extends TransitProxy {

    public AbstractTransitContext() {
        super(null);
        this.rootContext = this;
    }

    @Override
    public abstract TransitProxy eval(String stringToEvaluate, TransitProxy context, Object... arguments);

    private long _nextNativeId = 0;

    public String nextNativeId() {
        return String.valueOf(_nextNativeId++);
    }

}

Use `long` for NativeID incrementer

Use `long` for NativeID incrementer


package com.grayben.riskExtractor.htmlScorer.partScorers;

/**
 * Element scorer interface. Provide an implementing class to
 * {@link com.grayben.riskExtractor.htmlScorer.ScoringAndFlatteningNodeVisitor}.
 * <p/>
 * This interface contains a single method that takes an {@link org.jsoup.nodes.Element} and returns a score.
 * @author beng
 *
 */
public abstract class Scorer<T> {

    private String scoreLabel;

    public final static int DEFAULT_SCORE = 0;

    protected Scorer(String scoreLabel){
        this.scoreLabel = scoreLabel;
    }

	/**
	 *
	 * @param input the Element to score
	 * @return the score of element
	 */
	public abstract int score(T input);

    public String getScoreLabel(){
        return this.scoreLabel;
    }
}

package com.grayben.riskExtractor.htmlScorer.partScorers;

/**
 * Element scorer interface. Provide an implementing class to
 * {@link com.grayben.riskExtractor.htmlScorer.ScoringAndFlatteningNodeVisitor}.
 * <p>
 * This interface contains a single method that takes an {@link org.jsoup.nodes.Element} and returns a score.
 * @author beng
 *
 */
public abstract class Scorer<T> {

    private String scoreLabel;

    public final static int DEFAULT_SCORE = 0;

    protected Scorer(String scoreLabel){
        this.scoreLabel = scoreLabel;
    }

	/**
	 *
	 * @param input the Element to score
	 * @return the score of element
	 */
	public abstract int score(T input);

    public String getScoreLabel(){
        return this.scoreLabel;
    }
}

Remove self-closure of <p/> tag in Javadoc comment


package cc.hughes.droidchatty;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
import android.view.KeyEvent;

public class SingleThreadView extends FragmentActivity
{
    public static final String THREAD_ID = "threadId";

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

        if (savedInstanceState == null)
        {
        	//create the fragment, and show it!
        	ThreadViewFragment frag = new ThreadViewFragment();
        	frag.setArguments(getIntent().getExtras());
        	getSupportFragmentManager().beginTransaction().replace(android.R.id.content, frag).commit();
        }
    }

    @Override
    public boolean dispatchKeyEvent(KeyEvent event)
    {
        ThreadViewFragment fragment = (ThreadViewFragment)getSupportFragmentManager().findFragmentById(R.id.singleThread);
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        Boolean handleVolume = prefs.getBoolean("useVolumeButtons", false);
        if (fragment != null && handleVolume)
        {
            if (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP)
            {
                if (event.getAction() == KeyEvent.ACTION_DOWN)
                    fragment.adjustSelected(-1);
                return true;
            }
            else if (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_DOWN)
            {
                if (event.getAction() == KeyEvent.ACTION_DOWN)
                    fragment.adjustSelected(1);
                return true;
            }
        }
        return super.dispatchKeyEvent(event);
    }
}

package cc.hughes.droidchatty;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
import android.view.KeyEvent;

public class SingleThreadView extends FragmentActivity
{
    public static final String THREAD_ID = "threadId";

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

        if (savedInstanceState == null)
        {
        	//create the fragment, and show it!
        	ThreadViewFragment frag = new ThreadViewFragment();
        	frag.setArguments(getIntent().getExtras());
        	getSupportFragmentManager().beginTransaction().replace(android.R.id.content, frag).commit();
        }
    }

    @Override
    public boolean dispatchKeyEvent(KeyEvent event)
    {
        ThreadViewFragment fragment = (ThreadViewFragment)getSupportFragmentManager().findFragmentById(android.R.id.content);
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        Boolean handleVolume = prefs.getBoolean("useVolumeButtons", false);
        if (fragment != null && handleVolume)
        {
            if (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP)
            {
                if (event.getAction() == KeyEvent.ACTION_DOWN)
                    fragment.adjustSelected(-1);
                return true;
            }
            else if (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_DOWN)
            {
                if (event.getAction() == KeyEvent.ACTION_DOWN)
                    fragment.adjustSelected(1);
                return true;
            }
        }
        return super.dispatchKeyEvent(event);
    }
}

Fix volume button scrolling on phones.

Fix volume button scrolling on phones.


package fr.insee.rmes.api.utils;

import javax.ws.rs.core.MediaType;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;

public class ResponseUtils {

	private static Logger logger = LogManager.getLogger(ResponseUtils.class);

	public static String produceResponse(Object obj, String header) {
		ObjectMapper mapper = new ObjectMapper();
		String response = "";
		if (header != null && header.equals(MediaType.APPLICATION_XML)) {
			mapper = new XmlMapper();
		}
		else {
			mapper = new ObjectMapper();
		}
		try {
			response = mapper.writeValueAsString(obj);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return response;
	}

}

package fr.insee.rmes.api.utils;

import javax.ws.rs.core.MediaType;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;

public class ResponseUtils {

	private static Logger logger = LogManager.getLogger(ResponseUtils.class);

	public static String produceResponse(Object obj, String header) {
		ObjectMapper mapper = new ObjectMapper();
		String response = "";
		if (header != null && header.equals(MediaType.APPLICATION_XML)) {
			mapper = new XmlMapper();
		}
		else {
			mapper = new ObjectMapper();
		}
		try {
			response = mapper.writeValueAsString(obj);
			response = response.replaceAll("<", "<");
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return response;
	}

}

Fix minor issue (jackson security)

Fix minor issue (jackson security)


import java.util.Random;

public class Program {
    public static void main(String[] args) {
    }

    public static int random5() {
        return new Random().nextInt(5) + 1;
    }

    public static int random7() {
        int val = random5() * 5 + random5();
        return val > 21 ? random7() : val % 7 + 1;
    }
}

import java.util.Random;

public class Program {
    public static void main(String[] args) {
    }

    public static int random5() {
        return new Random().nextInt(5) + 1;
    }

    public static int random7() {
        int val = (random5() - 1) * 5 + random5();
        return val > 21 ? random7() : val % 7 + 1;
    }
}

Fix random7 implementation to generate values 1-25 instead of 6-30


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

import io.hops.exception.StorageInitializtionException;
import io.hops.metadata.common.EntityDataAccess;

import java.util.Properties;

public interface DalStorageFactory {

  public void setConfiguration(Properties conf)
      throws StorageInitializtionException;

  public StorageConnector getConnector();

  public EntityDataAccess getDataAccess(Class type);
}

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

import io.hops.exception.StorageException;
import io.hops.exception.StorageInitializtionException;
import io.hops.metadata.common.EntityDataAccess;

import java.util.Properties;

public interface DalStorageFactory {

  public void setConfiguration(Properties conf)
      throws StorageInitializtionException;

  public StorageConnector getConnector();

  public EntityDataAccess getDataAccess(Class type);

  public boolean hasResources(double threshold) throws StorageException;

}

[HOPS-808] Fix performance degradation due to safemode and enable namenode resource monitoring


package org.realityforge.arez.extras.spy;

import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.realityforge.arez.ComputedValue;
import org.realityforge.arez.Observable;
import org.realityforge.arez.spy.ComponentInfo;
import org.realityforge.arez.spy.ObserverInfo;
import org.realityforge.guiceyloops.shared.ValueUtil;

final class NullObserverInfo
  implements ObserverInfo
{
  @Override
  public boolean isRunning()
  {
    return false;
  }

  @Override
  public boolean isScheduled()
  {
    return false;
  }

  @Override
  public boolean isComputedValue()
  {
    return false;
  }

  @Override
  public boolean isReadOnly()
  {
    return false;
  }

  @Override
  public ComputedValue<?> asComputedValue()
  {
    return null;
  }

  @Nonnull
  @Override
  public List<Observable<?>> getDependencies()
  {
    return Collections.emptyList();
  }

  @Nullable
  @Override
  public ComponentInfo getComponent()
  {
    return null;
  }

  @Nonnull
  @Override
  public String getName()
  {
    return ValueUtil.randomString();
  }

  @Override
  public boolean isDisposed()
  {
    return false;
  }
}

package org.realityforge.arez.extras.spy;

import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.realityforge.arez.spy.ComponentInfo;
import org.realityforge.arez.spy.ComputedValueInfo;
import org.realityforge.arez.spy.ObservableInfo;
import org.realityforge.arez.spy.ObserverInfo;
import org.realityforge.guiceyloops.shared.ValueUtil;

final class NullObserverInfo
  implements ObserverInfo
{
  @Override
  public boolean isRunning()
  {
    return false;
  }

  @Override
  public boolean isScheduled()
  {
    return false;
  }

  @Override
  public boolean isComputedValue()
  {
    return false;
  }

  @Override
  public boolean isReadOnly()
  {
    return false;
  }

  @Override
  public ComputedValueInfo asComputedValue()
  {
    return null;
  }

  @Nonnull
  @Override
  public List<ObservableInfo> getDependencies()
  {
    return Collections.emptyList();
  }

  @Nullable
  @Override
  public ComponentInfo getComponent()
  {
    return null;
  }

  @Nonnull
  @Override
  public String getName()
  {
    return ValueUtil.randomString();
  }

  @Override
  public boolean isDisposed()
  {
    return false;
  }
}

Update to the latest spy API

Update to the latest spy API


package com.skraylabs.poker.model;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

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

public class InvalidCardFormatExceptionTest {

  @Before
  public void setUp() throws Exception {}

  @After
  public void tearDown() throws Exception {}

  @Test
  public void testDefaultConstructor() {
    // Exercise
    InvalidCardFormatException exception = new InvalidCardFormatException();
    // Verify
    String message = exception.getMessage();
    String invalidString = exception.getInvalidString();
    assertThat(message, equalTo(InvalidCardFormatException.MSG_DEFAULT));
    assertThat(invalidString, is(nullValue()));
  }

  @Test
  public void testInitializingConstructor() {
    // Exercise
    InvalidCardFormatException exception = new InvalidCardFormatException("5x");
    // Verify
    String message = exception.getMessage();
    String invalidString = exception.getInvalidString();
    String expectedMessage =
        String.format(InvalidCardFormatException.MSG_WITH_INVALID_STRING, "5x");
    assertThat(message, equalTo(expectedMessage));
    assertThat(invalidString, equalTo("5x"));
  }
}

package com.skraylabs.poker.model;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

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

public class InvalidCardFormatExceptionTest {

  @Before
  public void setUp() throws Exception {}

  @After
  public void tearDown() throws Exception {}

  @Test
  public void testDefaultConstructor() {
    // Exercise
    InvalidCardFormatException exception = new InvalidCardFormatException();
    // Verify
    String message = exception.getMessage();
    String invalidString = exception.getInvalidString();
    assertThat(message, equalTo(InvalidCardFormatException.MSG_DEFAULT));
    assertThat(invalidString, is(nullValue()));
  }

  @Test
  public void testInitializingConstructor() {
    // Exercise
    InvalidCardFormatException exception = new InvalidCardFormatException("5x");
    // Verify
    String message = exception.getMessage();
    String invalidString = exception.getInvalidString();
    String expectedMessage =
        String.format(InvalidCardFormatException.MSG_WITH_INVALID_STRING, "5x");
    assertThat(message, equalTo(expectedMessage));
    assertThat(invalidString, equalTo("5x"));
  }

  @Test
  public void testInitializingConstructor_emptyInvalidString() {
    // Exercise
    InvalidCardFormatException exception = new InvalidCardFormatException("");
    // Verify
    String message = exception.getMessage();
    String invalidString = exception.getInvalidString();
    assertThat(message, equalTo(InvalidCardFormatException.MSG_DEFAULT));
    assertThat(invalidString, is(nullValue()));
  }
}

Add test for initializing ctor with empty String.

Should treat this like the default constructor
* invalidString is null
* message is the default


/*
 * Copyright (C) 2019 The Dagger 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 dagger.hilt.internal;

import static java.lang.annotation.RetentionPolicy.CLASS;

import dagger.hilt.GeneratesRootInput;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
 * Annotation marking generated interfaces for entry points for which there is also a corresponding
 * generated Component. Component entry points differ from normal entry points in that they may be
 * filtered out in tests.
 */
@Target(ElementType.TYPE)
@Retention(CLASS)
@GeneratesRootInput
// TODO(user): Rename and MOE strip these references out of hilt.
public @interface ComponentEntryPoint {}

/*
 * Copyright (C) 2019 The Dagger 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 dagger.hilt.internal;

import static java.lang.annotation.RetentionPolicy.CLASS;

import dagger.hilt.GeneratesRootInput;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
 * Annotation marking generated interfaces for entry points for which there is also a corresponding
 * generated Component. Component entry points differ from normal entry points in that they may be
 * filtered out in tests.
 */
@Target(ElementType.TYPE)
@Retention(CLASS)
@GeneratesRootInput
// TODO(user): Rename and publicly strip these references out of hilt.
public @interface ComponentEntryPoint {}

Remove reference that our forthcoming Copybara config doesn't like.

RELNOTES=n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=315774875


/*
   Copyright 2016 Nationale-Nederlanden

   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 nl.nn.adapterframework.configuration;

import java.util.Properties;

import nl.nn.adapterframework.util.AppConstants;
import nl.nn.adapterframework.util.Misc;

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

 /**
 * Make the hostname property available to the Ibis configuration and the Spring
 * configuration.
 *
 * @author Jaco de Groot
 */
public class HostnamePropertyPlaceholderConfigurer
		extends PropertyPlaceholderConfigurer {

	public HostnamePropertyPlaceholderConfigurer() {
		setIgnoreUnresolvablePlaceholders(true);
	}

	@Override
	protected void convertProperties(Properties props) {
		AppConstants appConstants = AppConstants.getInstance();
		String hostname = Misc.getHostname();
		appConstants.setPropertyPlaceholderConfigurerProperty("hostname", hostname);
		props.put("hostname", hostname);
	}

}

/*
   Copyright 2016 Nationale-Nederlanden

   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 nl.nn.adapterframework.configuration;

import java.util.Properties;

import nl.nn.adapterframework.util.AppConstants;
import nl.nn.adapterframework.util.Misc;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

 /**
 * Make the hostname property available to the Ibis configuration and the Spring
 * configuration.
 *
 * @author Jaco de Groot
 */
public class HostnamePropertyPlaceholderConfigurer
		extends PropertyPlaceholderConfigurer {
	private static String HOSTNAME_PROPERTY = "hostname";

	public HostnamePropertyPlaceholderConfigurer() {
		setIgnoreUnresolvablePlaceholders(true);
	}

	@Override
	protected void convertProperties(Properties props) {
		AppConstants appConstants = AppConstants.getInstance();
		String hostname = appConstants.getResolvedProperty(HOSTNAME_PROPERTY);
		if (StringUtils.isEmpty(hostname)) {
			hostname = Misc.getHostname();
			appConstants.setPropertyPlaceholderConfigurerProperty(HOSTNAME_PROPERTY, hostname);
			props.put(HOSTNAME_PROPERTY, hostname);
		}
	}

}

Set hostname only when not already present


package org.openmhealth.shim.common;

import org.openmhealth.schema.domain.omh.DataPoint;

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

/**
 * A mapper that takes a generic input and creates data points.
 *
 * @param <DP> the body type of the data points to create
 * @param <I> the input type
 * @author Emerson Farrugia
 */
public interface DataPointMapper<DP extends DataPoint, I> {

    List<DP> asDataPoints(I input);

    /**
     * By default, handle each input individually.
     */
    default List<DP> asDataPoints(List<I> input) {
        List<DP> dataPoints = new ArrayList<>();

        for (I i : input) {
            dataPoints.addAll(asDataPoints(i));
        }

        return dataPoints;
    }
}

package org.openmhealth.shim.common;

import org.openmhealth.schema.domain.omh.DataPoint;

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

/**
 * A mapper that takes one or more inputs and creates data points.
 *
 * @param <DP> the body type of the data points to create
 * @param <I> the input type
 * @author Emerson Farrugia
 */
public interface DataPointMapper<DP extends DataPoint, I> {

    List<DP> asDataPoints(I input);

    /**
     * By default, handle each input individually.
     */
    default List<DP> asDataPoints(List<I> input) {
        List<DP> dataPoints = new ArrayList<>();

        for (I i : input) {
            dataPoints.addAll(asDataPoints(i));
        }

        return dataPoints;
    }
}

Fix the data point mapper Javadoc

Fix the data point mapper Javadoc


package persistence;

import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class NotFullValidator implements ConstraintValidator<NotFull, Department> {

	@Inject private EntityManager em; //we will not use it, but if we neeed it for a very complex validation, this would be a good approach

	public void initialize(NotFull constraintAnnotation) {
    }

    public boolean isValid(Department department, ConstraintValidatorContext constraintContext) {
    	System.err.println("============= EM AT VALIDATOR: "+em);
    	if (department == null) return true;
        return department.getEmployees().size() <= department.getSize();

    }

}

package persistence;

import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class NotFullValidator
						implements ConstraintValidator<NotFull, Department> {

	// If we need to access the database for validating an object?
	// Solution: Use java CDI and request an EntityManager to be injected.
	// We will not use it in this validator,
	// but if we need it for a very complex validation,
	// this would be a good approach
	@Inject private EntityManager em;

	public void initialize(NotFull constraintAnnotation) {
    }

    public boolean isValid(
    		Department department,
    		ConstraintValidatorContext constraintContext) {

    	System.err.println("============= EM AT VALIDATOR: "+em);
    	if (department == null) return true;
        return department.getEmployees().size() <= department.getSize();

    }

}

Add some comments and code format

Add some comments and code format


package tehnut.lib.util;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import tehnut.lib.LendingLibrary;

import java.lang.reflect.Field;

@SideOnly(Side.CLIENT)
public class RenderHelper {

    public static boolean addPlayerLayerRenderer(Class<? extends LayerRenderer<?>> layerRendererClass) {
        RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
        try {
            Field renderPlayerField = RenderManager.class.getDeclaredField("playerRenderer");
            renderPlayerField.setAccessible(true);
            Object renderPlayerObj = renderPlayerField.get(renderManager);
            if (renderPlayerObj instanceof RenderPlayer) {
                RenderPlayer renderPlayer = (RenderPlayer) renderPlayerObj;
                LayerRenderer<?> layerRenderer = layerRendererClass.getConstructor(RenderPlayer.class).newInstance(renderPlayer);
                renderPlayer.addLayer(layerRenderer);
                return true;
            }
        } catch (Exception e) {
            LendingLibrary.getLogger().error(e.getLocalizedMessage());
        }

        return false;
    }
}

package tehnut.lib.util;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import tehnut.lib.LendingLibrary;

@SideOnly(Side.CLIENT)
public class RenderHelper {

    public static boolean addPlayerLayerRenderer(Class<? extends LayerRenderer<?>> layerRendererClass) {
        RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
        try {
            RenderPlayer renderPlayer = ObfuscationReflectionHelper.getPrivateValue(RenderManager.class, renderManager, "playerRenderer", "field_178637_m");
            LayerRenderer<?> layerRenderer = layerRendererClass.getConstructor(RenderPlayer.class).newInstance(renderPlayer);
            renderPlayer.addLayer(layerRenderer);
            return true;
        } catch (Exception e) {
            LendingLibrary.getLogger().error(e.getLocalizedMessage());
        }

        return false;
    }
}

Fix render layer adder in obf environments


package radlab.rain.util;

import java.io.ObjectOutputStream;
import java.net.Socket;

import org.json.JSONObject;

import radlab.rain.ResponseTimeStat;

public class SocketMetricObjectWriter extends SocketMetricWriter
{
	private ObjectOutputStream _out = null;

	public SocketMetricObjectWriter( JSONObject config ) throws Exception
	{
		super( config );
	}

	@Override
	public boolean write( ResponseTimeStat stat ) throws Exception
	{
		if( this._out == null )
		{
			this._out = new ObjectOutputStream( new Socket( this._ipAddress, this._port ).getOutputStream() );
		}

		this._out.writeObject( stat );

		return true;
	}

	@Override
	public void close() throws Exception
	{
		if( this._out != null )
		{
			this._out.flush();
			this._out.close();
		}
	}

	@Override
	public String getDetails()
	{
		StringBuffer buf = new StringBuffer();
		buf.append( "SOCKET [object writer]" ).append( this._ipAddress ).append( ":" ).append( this._port );
		return buf.toString();
	}
}

package radlab.rain.util;

import java.io.ObjectOutputStream;
import java.net.Socket;

import org.json.JSONObject;

import radlab.rain.ResponseTimeStat;

public class SocketMetricObjectWriter extends SocketMetricWriter
{
	private ObjectOutputStream _out = null;

	public SocketMetricObjectWriter( JSONObject config ) throws Exception
	{
		super( config );
	}

	@Override
	public boolean write( ResponseTimeStat stat ) throws Exception
	{
		if( this._out == null )
		{
			this._out = new ObjectOutputStream( new Socket( this._ipAddress, this._port ).getOutputStream() );
		}

		this._out.writeObject( stat );
		this._out.reset();

		return true;
	}

	@Override
	public void close() throws Exception
	{
		if( this._out != null )
		{
			this._out.flush();
			this._out.close();
		}
	}

	@Override
	public String getDetails()
	{
		StringBuffer buf = new StringBuffer();
		buf.append( "SOCKET [object writer]" ).append( this._ipAddress ).append( ":" ).append( this._port );
		return buf.toString();
	}
}

Reset object output stream so there are no duplicate messages when we writeObject.


package com.github.aureliano.edocs.common.config;

public class FileRepositoryConfiguration {

	private String rootPath;

	public FileRepositoryConfiguration() {}

	public String getRootPath() {
		return rootPath;
	}

	public FileRepositoryConfiguration withRootPath(String rootPath) {
		this.rootPath = rootPath;
		return this;
	}
}

package com.github.aureliano.edocs.common.config;

public class FileRepositoryConfiguration {

	private String rootPath;
	private String limboPath;

	public FileRepositoryConfiguration() {}

	public String getRootPath() {
		return rootPath;
	}

	public FileRepositoryConfiguration withRootPath(String rootPath) {
		this.rootPath = rootPath;
		return this;
	}

	public String getLimboPath() {
		return limboPath;
	}

	public FileRepositoryConfiguration withLimboPath(String limboPath) {
		this.limboPath = limboPath;
		return this;
	}
}

Add property limboPath to repository configuration.


package ch.johannes;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class FileUtil {

    public static String readFileInPackage(Object instanceOfPackage, String filename) {
        try {
            Package aPackage = instanceOfPackage.getClass().getPackage();
            String packageName = aPackage.getName();
            String resourceName = "/".concat(packageName.replace('.', '/')).concat("/").concat(filename);
            InputStream resourceAsStream = instanceOfPackage.getClass().getResourceAsStream(resourceName);
            if (resourceAsStream == null) {
                throw new IllegalArgumentException(String.format("Couldn't find resource '%s' in package '%s' (%s).", filename, packageName, resourceName));
            }

            return readInputStream(resourceAsStream);
        } catch (IOException e) {
            throw new IllegalArgumentException("Couldn't find or read resource " + filename, e);
        }
    }

    private static String readInputStream(InputStream inputStream) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(inputStream);
        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        try {
            int result = bis.read();
            while (result != -1) {
                buf.write((byte) result);
                result = bis.read();
            }
            return buf.toString();
        } finally {
            bis.close();
            buf.close();
        }
    }

}

package ch.johannes;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class FileUtil {

    public static String readFileInPackage(Object instanceOfPackage, String filename) {
        Package aPackage = instanceOfPackage.getClass().getPackage();
        String packageName = aPackage.getName();
        String resourceName = "/".concat(packageName.replace('.', '/')).concat("/").concat(filename);

        try(InputStream resourceAsStream = instanceOfPackage.getClass().getResourceAsStream(resourceName)) {
            if (resourceAsStream == null) {
                throw new IllegalArgumentException(String.format("Couldn't find resource '%s' in package '%s' (%s).", filename, packageName, resourceName));
            }

            return readInputStream(resourceAsStream);
        } catch (IOException e) {
            throw new IllegalArgumentException("Couldn't find or read resource " + filename, e);
        }
    }

    private static String readInputStream(InputStream inputStream) throws IOException {
        try (BufferedInputStream bis = new BufferedInputStream(inputStream); ByteArrayOutputStream buf = new ByteArrayOutputStream()) {
            int result = bis.read();
            while (result != -1) {
                buf.write((byte) result);
                result = bis.read();
            }
            return buf.toString();
        }
    }

}

Use new style try finally to close resources


/*******************************************************************************
 * Copyright (c) 2004, 2006 Subclipse project and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Subclipse project committers - initial API and implementation
 ******************************************************************************/
package org.tigris.subversion.subclipse.core;

/**
 * @author Brock Janiczak
 */
public interface ISVNCoreConstants {

    String PREF_RECURSIVE_STATUS_UPDATE = "resursive_status_update";
    String PREF_SHOW_OUT_OF_DATE_FOLDERS = "show_out_of_date_folders";
    String PREF_SHARE_NESTED_PROJECTS = "share_nested_projects";

    public final int DEPTH_EMPTY = 0;
    public final int DEPTH_FILES = 1;
    public final int DEPTH_IMMEDIATES = 2;
    public final int DEPTH_INFINITY = 3;
    public final int DEPTH_UNKNOWN = -2;
    public final int DEPTH_EXCLUDE = -1;

}

/*******************************************************************************
 * Copyright (c) 2004, 2006 Subclipse project and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Subclipse project committers - initial API and implementation
 ******************************************************************************/
package org.tigris.subversion.subclipse.core;

/**
 * @author Brock Janiczak
 */
public interface ISVNCoreConstants {

    String PREF_RECURSIVE_STATUS_UPDATE = "resursive_status_update";
    String PREF_SHOW_OUT_OF_DATE_FOLDERS = "show_out_of_date_folders";
    String PREF_SHARE_NESTED_PROJECTS = "share_nested_projects";

    public final int DEPTH_UNKNOWN = 0;
    public final int DEPTH_EXCLUDE = 1;
    public final int DEPTH_EMPTY = 2;
    public final int DEPTH_FILES = 3;
    public final int DEPTH_IMMEDIATES = 4;
    public final int DEPTH_INFINITY = 5;

}

Update the Depth constants to match the changes in client adapter and JavaHL


/*
 * Copyright 2015-2016 EuregJUG.
 *
 * 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 eu.euregjug.site;

import java.util.concurrent.Executor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * @author Michael J. Simons, 2015-12-26
 */
@SpringBootApplication
@EnableCaching
@EnableAsync
@PropertySource("classpath:build.properties")
public class Application {

    @Bean
    public Executor threadPoolTaskExecutor() {
        return new ThreadPoolTaskExecutor();
    }

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

/*
 * Copyright 2015-2016 EuregJUG.
 *
 * 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 eu.euregjug.site;

import java.util.concurrent.Executor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * @author Michael J. Simons, 2015-12-26
 */
@SpringBootApplication
@EnableCaching
@EnableAsync
@PropertySource("classpath:build.properties")
public class Application {

    @Bean
    public Executor taskExecutor() {
        return new ThreadPoolTaskExecutor();
    }

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

Set name of executor to 'taskExecutor' (@EnableAsync default)


package sfBugs;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import edu.umd.cs.findbugs.annotations.DesireWarning;

public class Bug3506138 {

    public static Connection getConnection() {
        throw new UnsupportedOperationException();
    }

    @DesireWarning("ODR_OPEN_DATABASE_RESOURCE")
    public static void main(String[] args) throws Exception {
        Connection conn;
        PreparedStatement pstm = null;
        try {
            conn = getConnection();
            pstm = conn.prepareStatement("123");
            pstm.executeUpdate();
        } finally {
            if (pstm != null)
                pstm.close();
        }
    }
}

package sfBugs;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

import edu.umd.cs.findbugs.annotations.DesireWarning;
import edu.umd.cs.findbugs.annotations.ExpectWarning;

public class Bug3506138 {

    public static Connection getConnection() {
        throw new UnsupportedOperationException();
    }

    @ExpectWarning("ODR_OPEN_DATABASE_RESOURCE")
    public static void test0(String url) throws Exception {
        Connection conn;
        PreparedStatement pstm = null;
        try {
            conn = DriverManager.getConnection(url);
            pstm = conn.prepareStatement("123");
            pstm.executeUpdate();
        } finally {
            if (pstm != null)
                pstm.close();
        }
    }

    @DesireWarning("ODR_OPEN_DATABASE_RESOURCE")
    public static void test1() throws Exception {
        Connection conn;
        PreparedStatement pstm = null;
        try {
            conn = getConnection();
            pstm = conn.prepareStatement("123");
            pstm.executeUpdate();
        } finally {
            if (pstm != null)
                pstm.close();
        }
    }

}

Update test case to show the problem is that we don't track the return value of unknown methods that happen to return a Connection

git-svn-id: e7d6bde23f017c9ff4efd468d79d66def666766b@14309 eae3c2d3-9b19-0410-a86e-396b6ccb6ab3


package devopsdistilled.operp.server.data.service.account.impl;

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

import devopsdistilled.operp.server.data.entity.account.Transaction;
import devopsdistilled.operp.server.data.service.impl.AbstractEntityService;

public abstract class TransactionServiceImpl<T extends Transaction<?>, TR extends JpaRepository<T, Long>>
		extends AbstractEntityService<T, Long, TR> {

	private static final long serialVersionUID = -4898201898165854461L;

	@Override
	protected T findByEntityName(String entityName) {
		return null;
	}

}

package devopsdistilled.operp.server.data.service.account.impl;

import java.util.Date;

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

import devopsdistilled.operp.server.data.entity.account.Transaction;
import devopsdistilled.operp.server.data.service.impl.AbstractEntityService;

public abstract class TransactionServiceImpl<T extends Transaction<?>, TR extends JpaRepository<T, Long>>
		extends AbstractEntityService<T, Long, TR> {

	private static final long serialVersionUID = -4898201898165854461L;

	@Override
	protected T findByEntityName(String entityName) {
		return null;
	}

	@Override
	public <S extends T> S save(S transaction) {
		transaction.setTransactionDate(new Date());
		return super.save(transaction);
	}
}

Set Date when persisting Transaction

Set Date when persisting Transaction


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

package com.appdirect.sdk.appmarket.events;

/**
 * Standard error codes that are sent to the AppMarket
 */
public enum ErrorCode {
	USER_ALREADY_EXISTS,
	USER_NOT_FOUND,
	ACCOUNT_NOT_FOUND,
	MAX_USERS_REACHED,
	UNAUTHORIZED,
	INVALID_OPERATION,
	OPERATION_CANCELLED,
	CONFIGURATION_ERROR,
	INVALID_RESPONSE,
	TRANSPORT_ERROR,
	UNKNOWN_ERROR,
	NOT_FOUND
}

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

package com.appdirect.sdk.appmarket.events;

/**
 * Standard error codes that are sent to the AppMarket
 */
public enum ErrorCode {
	USER_ALREADY_EXISTS,
	USER_NOT_FOUND,
	ACCOUNT_NOT_FOUND,
	MAX_USERS_REACHED,
	UNAUTHORIZED,
	INVALID_OPERATION,
	OPERATION_CANCELLED,
	CONFIGURATION_ERROR,
	PENDING,
	INVALID_RESPONSE,
	TRANSPORT_ERROR,
	UNKNOWN_ERROR,
	NOT_FOUND
}

Add pending error code to service-integration-sdk


package collabode;

/**
 * Debugging support.
 */
public class Debug {

    /**
     * Announce the current method on {@link System#out}.
     */
    public static void here(Object... args) {
        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
        System.out.println(clean(stack[2]) + (stack.length > 3 ? " <-- " + clean(stack[3]): ""));
        if (args.length == 0) return;
        System.out.print("    " + args[0]);
        for (int ii = 1; ii < args.length; ii++) {
            System.out.print(", " + args[ii]);
        }
        System.out.println();
    }

    private static String clean(StackTraceElement point) {
        return point.toString().replace(Debug.class.getPackage().getName() + ".", "");
    }
}

package collabode;

/**
 * Debugging support.
 */
public class Debug {

    /**
     * Announce the current method on {@link System#out}.
     */
    public static void here(Object... args) {
        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
        System.out.println(clean(stack[2]) + (stack.length > 3 ? " <-- " + clean(stack[3]): ""));
        if (args.length == 0) return;
        System.out.print("    " + args[0]);
        for (int ii = 1; ii < args.length; ii++) {
            System.out.print(", " + args[ii]);
        }
        System.out.println();
    }

    private static String clean(StackTraceElement point) {
        return point.toString().replaceAll(Debug.class.getPackage().getName() + "(\\.[a-z]+)*\\.", "");
    }
}

Remove entire package name, otherwise Eclipse cannot link console output to source


package com.pm.server.player;

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

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

@Component
public abstract class PlayerImpl implements Player {

	private Integer id = 0;
	private Coordinate location;

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

	public void setId(Integer id) {

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

		this.id = id;
	}

	public int getId() {
		return id;
	}

	public void setLocation(Coordinate location) {

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

		this.location = location;
	}

	public Coordinate getLocation() {
		return location;
	}

}

package com.pm.server.player;

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

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

@Component
public abstract class PlayerImpl implements Player {

	protected Integer id = 0;
	protected Coordinate location;

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

	public void setId(Integer id) {

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

		this.id = id;
	}

	public int getId() {
		return id;
	}

	public void setLocation(Coordinate location) {

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

		this.location = location;
	}

	public Coordinate getLocation() {
		return location;
	}

}

Change Player data members to protected

Change Player data members to protected


package fr.minepod.launcher;

import java.awt.HeadlessException;
import java.io.IOException;

public class CrashReport {
	public static String DebugFilePath = Config.DebugFilePath;

	public static void SendReport(String exception, String when) {
		try {
			if(Config.Logger != null)
				Config.Logger.severe(exception);
			javax.swing.JOptionPane.showMessageDialog(null, exception + "\n" +  Langage.WHEN.toString() + when + "\n\n\n" + Langage.DEBUGINFORMATIONS.toString() + ":\n\n" + fr.minepod.Utils.Files.ReadFile(DebugFilePath), Langage.ERROR.toString(), javax.swing.JOptionPane.ERROR_MESSAGE);
		} catch (HeadlessException e) {
			if(Config.Logger != null)
				Config.Logger.severe(e.toString());
			javax.swing.JOptionPane.showMessageDialog(null, e.toString(),  Langage.ERROR.toString(), javax.swing.JOptionPane.ERROR_MESSAGE);
		} catch (IOException e) {
			if(Config.Logger != null)
				Config.Logger.severe(e.toString());
			javax.swing.JOptionPane.showMessageDialog(null, e.toString(),  Langage.ERROR.toString(), javax.swing.JOptionPane.ERROR_MESSAGE);
		}
        System.exit(0);
	}
}

package fr.minepod.launcher;

import java.awt.HeadlessException;
import java.io.File;
import java.io.IOException;

import fr.minepod.launcher.Config;
import fr.minepod.launcher.Langage;

public class CrashReport {
	public static void SendReport(String exception, String when) {
		try {
			if(Config.Logger != null)
				Config.Logger.severe(exception);

			String debugMsg = "";

			if(new File(Config.DebugFilePath).exists())
				debugMsg = fr.minepod.Utils.Files.ReadFile(Config.DebugFilePath);

			javax.swing.JOptionPane.showMessageDialog(null, exception + "\n" +  Langage.WHEN.toString() + when + "\n\n\n" + Langage.DEBUGINFORMATIONS.toString() + ":\n\n" + debugMsg, Langage.ERROR.toString(), javax.swing.JOptionPane.ERROR_MESSAGE);
		} catch (HeadlessException e) {
			if(Config.Logger != null)
				Config.Logger.severe(e.toString());
			javax.swing.JOptionPane.showMessageDialog(null, e.toString(),  Langage.ERROR.toString(), javax.swing.JOptionPane.ERROR_MESSAGE);
		} catch (IOException e) {
			if(Config.Logger != null)
				Config.Logger.severe(e.toString());
			javax.swing.JOptionPane.showMessageDialog(null, e.toString(),  Langage.ERROR.toString(), javax.swing.JOptionPane.ERROR_MESSAGE);
		}
        System.exit(0);
	}
}

Check if debug file exists

Check if debug file exists


package de.dhbw.wi13c.jguicreator.data.util;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JPanel;

public abstract class GUIKomponente extends JPanel
{
	GUIKomponente()
	{
		setPreferredSize(new Dimension(200, 200));
		setOpaque(true);
		setBackground(Color.RED);
		setVisible(true);
	}
}

package de.dhbw.wi13c.jguicreator.data.util;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JPanel;

public abstract class GUIKomponente extends JPanel
{
	protected GUIKomponente()
	{
		this(350, 40);
	}

	protected GUIKomponente(int pWidth, int pHeigth)
	{
		this.setPreferredSize(new Dimension(pWidth, pHeigth));
		this.setBackground(Color.WHITE);
		this.setOpaque(true);
		this.setVisible(true);
	}
}

Change New Constructor for GuiKomponente


package ceylon.language;

/**
 * Class to facilitate method calls using named arguments. This will be
 * removed/replace after M1.
 *
 * @param <R> The type of result
 * @param <X> The type of the thing being called
 */
public abstract class NamedArgumentCall<R,X> {
    protected final X instance;
    protected final java.lang.Object[] args;
    public NamedArgumentCall(final X instance, java.lang.Object... args) {
        this.instance = instance;
        this.args = args;
    }
    public abstract R call();
}

package ceylon.language;

/**
 * Class to facilitate method calls using named arguments. This will be
 * removed/replace after M1.
 *
 * @param <R> The type of result
 * @param <X> The type of the thing being called
 */
public abstract class NamedArgumentCall<R,X> {
    protected final X instance;
    protected final java.lang.Object[] args;
    public NamedArgumentCall(final X instance, java.lang.Object... args) {
        this.instance = instance;
        this.args = args;
    }
}

Fix named arg calls, adding support for qualified/base type expressions


package com.haxademic.core.draw.color;

import processing.core.PApplet;

import com.haxademic.core.app.P;

public class ColorUtil {

	public static int colorWithIntAndAlpha( PApplet p, int color, int alpha ) {
		// from: http://processing.org/discourse/beta/num_1261125421.html
		return (color & 0xffffff) | (alpha << 24);
	}

	public static int colorFromHex( String hex ) {
		return P.unhex("FF"+hex.substring(1));
	}

	public final static int alphaFromColorInt( int c ) { return (c >> 24) & 0xFF; }
	public final static int redFromColorInt( int c ) { return (c >> 16) & 0xFF;	}
	public final static int greenFromColorInt( int c ) { return (c >> 8)  & 0xFF; }
	public final static int blueFromColorInt( int c ) { return c & 0xFF; }

}

package com.haxademic.core.draw.color;

import processing.core.PApplet;

import com.haxademic.core.app.P;

public class ColorUtil {

	public static int colorWithIntAndAlpha( PApplet p, int color, int alpha ) {
		// from: http://processing.org/discourse/beta/num_1261125421.html
		return (color & 0xffffff) | (alpha << 24);
	}

	public static int colorFromHex( String hex ) {
		return P.unhex("FF"+hex.substring(1));
	}

	public static float componentByPercent( float percent ) {
		return percent * 255f;
	}

	public final static int alphaFromColorInt( int c ) { return (c >> 24) & 0xFF; }
	public final static int redFromColorInt( int c ) { return (c >> 16) & 0xFF;	}
	public final static int greenFromColorInt( int c ) { return (c >> 8)  & 0xFF; }
	public final static int blueFromColorInt( int c ) { return c & 0xFF; }

}

Add 255 color value mapper helper

Add 255 color value mapper helper


package hello;

import lombok.Data;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.UnknownHostException;

import static java.net.InetAddress.getLocalHost;
import static java.time.OffsetDateTime.now;
import static org.springframework.web.bind.annotation.RequestMethod.GET;

/**
 * {@code Heartbeat} needs documentation.
 *
 * @author Brian Oxley
 * @todo Needs documentation
 */
@RestController
public class HeartbeatController {
    @RequestMapping(value = "/heartbeat", method = GET)
    public Heartbeat beat()
            throws UnknownHostException {
        return new Heartbeat();
    }

    @Data
    public static class Heartbeat {
        private final String hostname;
        private final String timestamp = now().toString();

        public Heartbeat()
                throws UnknownHostException {
            hostname = getLocalHost().getCanonicalHostName();
        }
    }
}

package hello;

import lombok.Data;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.UnknownHostException;

import static java.lang.management.ManagementFactory.getRuntimeMXBean;
import static java.net.InetAddress.getLocalHost;
import static java.time.Instant.ofEpochMilli;
import static java.time.OffsetDateTime.now;
import static java.time.OffsetDateTime.ofInstant;
import static java.time.ZoneId.systemDefault;
import static org.springframework.web.bind.annotation.RequestMethod.GET;

/**
 * {@code Heartbeat} needs documentation.
 *
 * @author Brian Oxley
 * @todo Needs documentation
 */
@RestController
public class HeartbeatController {
    @RequestMapping(value = "/heartbeat", method = GET)
    public Heartbeat beat()
            throws UnknownHostException {
        return new Heartbeat();
    }

    @Data
    public static class Heartbeat {
        private final String hostname;
        private final String timestamp = now().toString();
        private final String startTime = ofInstant(
                ofEpochMilli(getRuntimeMXBean().getStartTime()),
                systemDefault()).toString();

        public Heartbeat()
                throws UnknownHostException {
            hostname = getLocalHost().getHostName();
        }
    }
}

Add start time to heartbeat.

Add start time to heartbeat.


package com.querins.StockMarket.services;

import com.querins.StockMarket.model.Quote;
import com.querins.StockMarket.model.Stock;
import com.querins.StockMarket.repositories.StockRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessageSendingOperations;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Random;

/**
 * Created by roman on 26.08.17.
 */
@Service
public class StockService {

    private SimpMessageSendingOperations template;
    private StockRepository repository;
    private static final Random r = new Random();

    @Autowired
    public StockService(StockRepository repository, SimpMessageSendingOperations template) {

        this.repository = repository;
        this.template = template;

    }

    @Scheduled(fixedDelay = 1000)
    public void generateQuote() {

        for( Stock stock: repository.findAll() ) {

            BigDecimal price = new BigDecimal(r.nextDouble() * 100).setScale(2, RoundingMode.FLOOR);
            Quote quote = new Quote(stock, price );
            template.convertAndSend("/topic.quotes", quote);

        }

    }

}

package com.querins.StockMarket.services;

import com.querins.StockMarket.model.Quote;
import com.querins.StockMarket.model.Stock;
import com.querins.StockMarket.repositories.StockRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessageSendingOperations;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Random;

/**
 * Created by roman on 26.08.17.
 */
@Service
public class StockService {

    private SimpMessageSendingOperations template;
    private StockRepository repository;
    private static final Random r = new Random();

    @Autowired
    public StockService(StockRepository repository, SimpMessageSendingOperations template) {

        this.repository = repository;
        this.template = template;

        if( this.repository.count() == 0 ) {

            this.repository.save(new Stock("Google", 2));

        }

    }

    @Scheduled(fixedDelay = 1000)
    public void generateQuote() {

        for( Stock stock: repository.findAll() ) {

            BigDecimal price = new BigDecimal(r.nextDouble() * 100).setScale(2, RoundingMode.FLOOR);
            Quote quote = new Quote(stock, price );
            template.convertAndSend("/topic.quotes", quote);

        }

    }

}

Add some stock to repository if it's empty


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

import io.airlift.configuration.Config;
import io.airlift.units.DataSize;

import javax.validation.constraints.NotNull;

public class MemoryConfig
{
    private int splitsPerNode = Runtime.getRuntime().availableProcessors();
    private DataSize maxDataPerNode = new DataSize(128, DataSize.Unit.MEGABYTE);

    @NotNull
    public int getSplitsPerNode()
    {
        return splitsPerNode;
    }

    @Config("splits-per-node")
    public MemoryConfig setSplitsPerNode(int splitsPerNode)
    {
        this.splitsPerNode = splitsPerNode;
        return this;
    }

    @NotNull
    public DataSize getMaxDataPerNode()
    {
        return maxDataPerNode;
    }

    @Config("max-data-per-node")
    public MemoryConfig setMaxDataPerNode(DataSize maxDataPerNode)
    {
        this.maxDataPerNode = maxDataPerNode;
        return this;
    }
}

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

import io.airlift.configuration.Config;
import io.airlift.units.DataSize;

import javax.validation.constraints.NotNull;

public class MemoryConfig
{
    private int splitsPerNode = Runtime.getRuntime().availableProcessors();
    private DataSize maxDataPerNode = new DataSize(128, DataSize.Unit.MEGABYTE);

    @NotNull
    public int getSplitsPerNode()
    {
        return splitsPerNode;
    }

    @Config("memory.splits-per-node")
    public MemoryConfig setSplitsPerNode(int splitsPerNode)
    {
        this.splitsPerNode = splitsPerNode;
        return this;
    }

    @NotNull
    public DataSize getMaxDataPerNode()
    {
        return maxDataPerNode;
    }

    @Config("memory.max-data-per-node")
    public MemoryConfig setMaxDataPerNode(DataSize maxDataPerNode)
    {
        this.maxDataPerNode = maxDataPerNode;
        return this;
    }
}

Fix read max-data-per-node correctly in memory connector config


package org.ops4j.pax.web.service.internal.model;

import javax.servlet.Filter;

public class FilterModel extends BasicModel
{

    private final Filter m_filter;
    private final String[] m_urlPatterns;
    private final String[] m_servletNames;

    public FilterModel( final Filter filter,
                               final String[] urlPatterns,
                               final String[] servletNames,
                               final ContextModel contextModel )
    {
        super( contextModel );

        if( urlPatterns == null && servletNames == null )
        {
            throw new IllegalArgumentException(
                "Registered filter must have at least one url pattern or servlet mapping"
            );
        }

        m_filter = filter;
        m_urlPatterns = urlPatterns;
        m_servletNames = servletNames;
    }

    public Filter getFilter()
    {
        return m_filter;
    }

    public String[] getUrlPatterns()
    {
        return m_urlPatterns;
    }

    public String[] getServletNames()
    {
        return m_servletNames;
    }

}

Reformat code and optimize imports.

Reformat code and optimize imports.


package org.araymond.joal.web.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;

/**
 * Created by raymo on 25/07/2017.
 */
@Configuration
public class EndpointObfuscatorConfiguration {

    private final String pathPrefix;

    public EndpointObfuscatorConfiguration(@Value("${joal.ui.path.prefix}")final String pathPrefix) {
        this.pathPrefix = pathPrefix;
    }

    @Bean
    public DispatcherServlet dispatcherServlet() {
        return new DispatcherServlet();
    }

    @Bean
    public ServletRegistrationBean dispatcherServletRegistration() {
        final ServletRegistrationBean registration = new ServletRegistrationBean(
                dispatcherServlet(),
                "/" + this.pathPrefix + "/*"
        );
        registration.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
        return registration;
    }
}

package org.araymond.joal.web.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;

/**
 * Created by raymo on 25/07/2017.
 */
@ConditionalOnProperty(name = "spring.main.web-environment", havingValue = "true")
@Configuration
public class EndpointObfuscatorConfiguration {

    private final String pathPrefix;

    public EndpointObfuscatorConfiguration(@Value("${joal.ui.path.prefix}")final String pathPrefix) {
        this.pathPrefix = pathPrefix;
    }

    @Bean
    public DispatcherServlet dispatcherServlet() {
        return new DispatcherServlet();
    }

    @Bean
    public ServletRegistrationBean dispatcherServletRegistration() {
        final ServletRegistrationBean registration = new ServletRegistrationBean(
                dispatcherServlet(),
                "/" + this.pathPrefix + "/*"
        );
        registration.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
        return registration;
    }
}

Add conditionnalOn to EndpointObfuscator ensure it won't be avaiable in non-web context


/*
 *  Copyright 2002-2019 Barcelona Supercomputing Center (www.bsc.es)
 *
 *  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 es.bsc.compss.types.execution;

import java.util.List;

public interface InvocationParamCollection<T extends InvocationParam> extends InvocationParam {

    public List<T> getCollectionParameters();

    public void addParameter(T param);

    public int getSize();

}

Add headers and format code

Add headers and format code


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

package io.requery.sql;

import io.requery.PersistenceException;

/**
 * Exception thrown when the affected row count of a executed statement doesn't match the value
 * expected.
 */
public class RowCountException extends PersistenceException {

    private final long expected;
    private final long actual;

    RowCountException(long expected, long actual) {
        super("Expected " + expected + " row affected actual " + actual);
        this.expected = expected;
        this.actual = expected;
    }

    /**
     * @return the expected affected value count
     */
    public long getExpected() {
        return expected;
    }

    /**
     * @return the actual affected value count
     */
    public long getActual() {
        return actual;
    }
}

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

package io.requery.sql;

import io.requery.PersistenceException;

/**
 * Exception thrown when the affected row count of a executed statement doesn't match the value
 * expected.
 */
public class RowCountException extends PersistenceException {

    private final long expected;
    private final long actual;

    RowCountException(long expected, long actual) {
        super("Expected " + expected + " row affected actual " + actual);
        this.expected = expected;
        this.actual = actual;
    }

    /**
     * @return the expected affected value count
     */
    public long getExpected() {
        return expected;
    }

    /**
     * @return the actual affected value count
     */
    public long getActual() {
        return actual;
    }
}

Fix incorrect expected value assigned

Fix incorrect expected value assigned


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

package co.phoenixlab.discord.api.request;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class LogoutRequest {

    private String token;

}

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

package co.phoenixlab.discord.api.request;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.NotEmpty;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class LogoutRequest {

    @NotEmpty
    private String token;

}

Add validation to logout request

Add validation to logout request


/**
 * Copyright (c) 2010-2015, openHAB.org and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.openhab.core.types;

/**
 * There are situations when item states do not have any defined value.
 * This might be because they have not been initialized yet (never
 * received an state update so far) or because their state is ambiguous
 * (e.g. a dimmed light that is treated as a switch (ON/OFF) will have
 * an undefined state if it is dimmed to 50%).
 *
 * @author Kai Kreuzer
 * @since 0.1.0
 *
 */
public enum UnDefType implements PrimitiveType, State {
	UNDEF, NULL;

	public String format(String pattern) {
		return String.format(pattern, this.toString());
	}

}

/**
 * Copyright (c) 2010-2015, openHAB.org and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.openhab.core.types;

/**
 * There are situations when item states do not have any defined value.
 * This might be because they have not been initialized yet (never
 * received an state update so far) or because their state is ambiguous
 * (e.g. a dimmed light that is treated as a switch (ON/OFF) will have
 * an undefined state if it is dimmed to 50%).
 *
 * @author Kai Kreuzer
 * @since 0.1.0
 *
 */
public enum UnDefType implements PrimitiveType, State {
	UNDEF, NULL;

	public String toString() {
		switch(this) {
			case UNDEF: return "Undefined";
			case NULL:  return "Uninitialized";
		}
		return "";
	}

	public String format(String pattern) {
		return String.format(pattern, this.toString());
	}

}

Revert "remove the special toString() in order to sync with ESH"


package com.facetedworlds.honeydolist.collaboration;

import android.app.Activity;

import com.facetedworlds.honeydolist.ActivityTaskDispatcher;
import com.updatecontrols.correspondence.Community;
import com.updatecontrols.correspondence.CorrespondenceException;
import com.updatecontrols.correspondence.binary.BinaryHTTPAsynchronousCommunicationStrategy;
import com.updatecontrols.correspondence.memory.MemoryStorageStrategy;

import facetedworlds.honeydo.model.CorrespondenceModel;
import facetedworlds.honeydo.model.Identity;

public class SynchronizationService {

	private static SynchronizationService synchronizationService = new SynchronizationService();

	public static SynchronizationService getInstance() {
		return synchronizationService;
	}

    private Identity identity;

	public void start(Activity context) throws CorrespondenceException {
		Community community = new Community(new MemoryStorageStrategy(), new ActivityTaskDispatcher(context))
			.addAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(
				new HoneyDoHTTPConfigurationProvider()
			))
			.addModule(new CorrespondenceModel());

		identity = community.addFact(new Identity("c48b1883978543b5baa0eb89cb2516f9"));
		community.subscribe(new HoneyDoSubscriptionStrategy(identity));

		community.beginReceiving();
	}

	public Identity getIdentity() {
		return identity;
	}
}

package com.facetedworlds.honeydolist.collaboration;

import android.app.Activity;

import com.facetedworlds.honeydolist.ActivityTaskDispatcher;
import com.updatecontrols.correspondence.Community;
import com.updatecontrols.correspondence.CorrespondenceException;
import com.updatecontrols.correspondence.binary.BinaryHTTPAsynchronousCommunicationStrategy;
import com.updatecontrols.correspondence.memory.MemoryStorageStrategy;

import facetedworlds.honeydo.model.CorrespondenceModel;
import facetedworlds.honeydo.model.Identity;

public class SynchronizationService {

	private static SynchronizationService synchronizationService = new SynchronizationService();

	public static SynchronizationService getInstance() {
		return synchronizationService;
	}

    private Identity identity;

	public void start(Activity context) throws CorrespondenceException {
		Community community = new Community(new MemoryStorageStrategy(), new ActivityTaskDispatcher(context))
			.addAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(
				new HoneyDoHTTPConfigurationProvider()
			))
			.addModule(new CorrespondenceModel());

		identity = community.addFact(new Identity("547260202db74f018050e01a6e384112"));
		community.subscribe(new HoneyDoSubscriptionStrategy(identity));

		community.beginReceiving();
	}

	public Identity getIdentity() {
		return identity;
	}
}

Use an identity with test data.

Use an identity with test data.


package org.objectweb.proactive.ic2d;

import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.IWorkbenchConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchAdvisor;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {

	public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
		return new ApplicationWorkbenchWindowAdvisor(configurer);
	}

	public void initialize(IWorkbenchConfigurer configurer) {
		/*// To restore window preferences
		super.initialize(configurer);
        configurer.setSaveAndRestore(true);
        */
		// Sets the look of the tabs like Eclipse 3.x
		PlatformUI.getPreferenceStore().setValue(
				IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,
				false);
	}

	public String getInitialWindowPerspectiveId() {
		return "org.objectweb.proactive.ic2d.monitoring.perspectives.MonitoringPerspective";//MonitoringPerspective.ID /*DefaultPerspective.ID*/;
	}
}

package org.objectweb.proactive.ic2d;

import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.IWorkbenchConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchAdvisor;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {

	public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
		return new ApplicationWorkbenchWindowAdvisor(configurer);
	}

	public void initialize(IWorkbenchConfigurer configurer) {
		// To restore window preferences
		//super.initialize(configurer);
        configurer.setSaveAndRestore(true);

		// Sets the look of the tabs like Eclipse 3.x
		PlatformUI.getPreferenceStore().setValue(
				IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,
				false);
	}

	public String getInitialWindowPerspectiveId() {
		return "org.objectweb.proactive.ic2d.monitoring.perspectives.MonitoringPerspective";//MonitoringPerspective.ID /*DefaultPerspective.ID*/;
	}
}

Save and restore workbench state.

Save and restore workbench state.

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