package fr.epicanard.globalmarketchest.listeners;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerMoveEvent;

import fr.epicanard.globalmarketchest.GlobalMarketChest;
import fr.epicanard.globalmarketchest.gui.InventoryGUI;

public class ChatListener implements Listener {
  private Boolean isChatEditing(Player player) {
    if (player != null) {
      InventoryGUI inv = GlobalMarketChest.plugin.inventories.getInventory(player.getUniqueId());
      return (inv != null && inv.getChatEditing());
    }
    return false;
  }

  @EventHandler
  public void onPlayerMove(PlayerMoveEvent event) {
    if (this.isChatEditing(event.getPlayer())) {
      event.setCancelled(true);
    }
  }

  @EventHandler
  public void onPlayerBreakBlock(BlockBreakEvent  event) {
    if (this.isChatEditing(event.getPlayer())) {
      event.setCancelled(true);
    }
  }

  @EventHandler
  public void onChatEvent(AsyncPlayerChatEvent event) {
    InventoryGUI inv = GlobalMarketChest.plugin.inventories.getInventory(event.getPlayer().getUniqueId());
    if (inv != null && inv.getChatEditing()) {
      inv.setChatReturn(event.getMessage());
      event.setCancelled(true);
    }
  }

}

package fr.epicanard.globalmarketchest.listeners;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerMoveEvent;

import fr.epicanard.globalmarketchest.GlobalMarketChest;
import fr.epicanard.globalmarketchest.gui.InventoryGUI;

public class ChatListener implements Listener {
  private Boolean isChatEditing(Player player) {
    if (player != null) {
      InventoryGUI inv = GlobalMarketChest.plugin.inventories.getInventory(player.getUniqueId());
      return (inv != null && inv.getChatEditing());
    }
    return false;
  }

  @EventHandler
  public void onPlayerMove(PlayerMoveEvent event) {
    if (this.isChatEditing(event.getPlayer())) {
      event.setCancelled(true);
    }
  }

  @EventHandler
  public void onPlayerBreakBlock(BlockBreakEvent  event) {
    if (this.isChatEditing(event.getPlayer())) {
      event.setCancelled(true);
    }
  }

  @EventHandler
  public void onChatEvent(AsyncPlayerChatEvent event) {
    if (this.isChatEditing(event.getPlayer())) {
      InventoryGUI inv = GlobalMarketChest.plugin.inventories.getInventory(event.getPlayer().getUniqueId());
      inv.setChatReturn(event.getMessage());
      event.setCancelled(true);
    }
  }

}

Fix onChatEvent to handle player null


/*
 * This program is part of the OpenLMIS logistics management information system platform software.
 * Copyright © 2017 VillageReach
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details. You should have received a copy of
 * the GNU Affero General Public License along with this program. If not, see
 * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.
 */

package org.openlmis.stockmanagement.domain.reason;

import lombok.Getter;

public enum ReasonType {
  CREDIT(2),
  DEBIT(1),
  BALANCE_ADJUSTMENT(0);

  @Getter
  private int priority;

  ReasonType(int priority) {
    this.priority = priority;
  }
}

/*
 * This program is part of the OpenLMIS logistics management information system platform software.
 * Copyright © 2017 VillageReach
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details. You should have received a copy of
 * the GNU Affero General Public License along with this program. If not, see
 * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.
 */

package org.openlmis.stockmanagement.domain.reason;

import lombok.Getter;

public enum ReasonType {
  CREDIT(2),
  DEBIT(1),
  BALANCE_ADJUSTMENT(0);

  /**
   * Value of this field will be used to set correct order of stock card line items if both
   * occurred and processed dates have the same date for the following line items. It is
   * important that types that are used to increase (like {@link #CREDIT}) should have higher
   * priority than types that are used to decrease (like {@link #DEBIT}).
   */
  @Getter
  private int priority;

  ReasonType(int priority) {
    this.priority = priority;
  }
}

Revert "Revert "OLMIS-3533: Added javadoc for Reason type priority field""


package de.philipphager.disclosure.feature.sync.api.usecases;

import de.philipphager.disclosure.api.DisclosureApi;
import de.philipphager.disclosure.database.library.model.Library;
import de.philipphager.disclosure.service.LibraryService;
import java.util.List;
import javax.inject.Inject;
import rx.Observable;

public class SyncLibraries {
  private final DisclosureApi disclosureApi;
  private final LibraryService libraryService;

  @Inject public SyncLibraries(DisclosureApi disclosureApi,
      LibraryService libraryService) {
    this.disclosureApi = disclosureApi;
    this.libraryService = libraryService;
  }

  public Observable<List<Library>> run() {
    return libraryService.lastUpdated()
        .first()
        .flatMap(lastUpdated -> new Paginator<Library>() {
          @Override protected Observable<List<Library>> queryPage(int page, int limit) {
            return disclosureApi.allLibraries(lastUpdated, page, limit);
          }
        }.join())
        .doOnNext(libraryService::insertOrUpdate);
  }
}

package de.philipphager.disclosure.feature.sync.api.usecases;

import de.philipphager.disclosure.api.DisclosureApi;
import de.philipphager.disclosure.database.library.model.Library;
import de.philipphager.disclosure.service.LibraryService;
import java.util.List;
import javax.inject.Inject;
import rx.Observable;
import timber.log.Timber;

public class SyncLibraries {
  private final DisclosureApi disclosureApi;
  private final LibraryService libraryService;

  @Inject public SyncLibraries(DisclosureApi disclosureApi,
      LibraryService libraryService) {
    this.disclosureApi = disclosureApi;
    this.libraryService = libraryService;
  }

  public Observable<List<Library>> run() {
    return libraryService.lastUpdated()
        .first()
        .flatMap(lastUpdated -> new Paginator<Library>() {
          @Override protected Observable<List<Library>> queryPage(int page, int limit) {
            Timber.d("fetch libraries from api, page: %d, limit: %d", page, limit);
            return disclosureApi.allLibraries(lastUpdated, page, limit);
          }
        }.join())
        .doOnNext(libraryService::insertOrUpdate);
  }
}

Add log message to library syncer


/*
 *
 * Copyright (c) 2005, Karl Trygve Kalleberg <karltk@ii.uib.no>
 *
 * Licensed under the GNU General Public License, v2
 */
package org.spoofax.interpreter.library.ecj;

import org.spoofax.interpreter.library.AbstractStrategoOperatorRegistry;

public class ECJLibrary extends AbstractStrategoOperatorRegistry {

    public static final String REGISTRY_NAME = "ECJ";

    ECJLibrary() {
        init();
    }

    private void init() {
        add(new ECJ_parse_only());
        add(new ECJ_parse_and_resolve());
        add(new ECJ_open_project());
        add(new ECJ_create_project());
        add(new ECJ_add_source_folder());
        add(new ECJ_add_jar());
        add(new ECJ_binding_of_name());
        add(new ECJ_type_of_type());
        add(new ECJ_type_of_typedecl());
        add(new ECJ_type_of_typeparameter());
        add(new ECJ_method_of_methoddecl());
        add(new ECJ_method_of_methodinvoc());
        add(new ECJ_method_of_supermethodinvoc());
        add(new ECJ_method_of_superctorinvoc());
        add(new ECJ_type_of_expr());
        add(new ECJ_is_cast_compatible());
        add(new ECJ_is_subtype_compatible());
    }
}

/*
 *
 * Copyright (c) 2005, Karl Trygve Kalleberg <karltk@ii.uib.no>
 *
 * Licensed under the GNU General Public License, v2
 */
package org.spoofax.interpreter.library.ecj;

import org.spoofax.interpreter.library.AbstractStrategoOperatorRegistry;

public class ECJLibrary extends AbstractStrategoOperatorRegistry {

    public static final String REGISTRY_NAME = "ECJ";

    public ECJLibrary() {
        init();
    }

    private void init() {
        add(new ECJ_parse_only());
        add(new ECJ_parse_and_resolve());
        add(new ECJ_open_project());
        add(new ECJ_create_project());
        add(new ECJ_add_source_folder());
        add(new ECJ_add_jar());
        add(new ECJ_binding_of_name());
        add(new ECJ_type_of_type());
        add(new ECJ_type_of_typedecl());
        add(new ECJ_type_of_typeparameter());
        add(new ECJ_method_of_methoddecl());
        add(new ECJ_method_of_methodinvoc());
        add(new ECJ_method_of_supermethodinvoc());
        add(new ECJ_method_of_superctorinvoc());
        add(new ECJ_type_of_expr());
        add(new ECJ_is_cast_compatible());
        add(new ECJ_is_subtype_compatible());
    }
}

Make visible to interpreter "compositions" outside this package.


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

import java.io.IOException;

import com.orientechnologies.orient.core.serialization.OBinaryProtocol;

public class OStreamSerializerLong implements OStreamSerializer {
	public static final String								NAME			= "l";

	public static final OStreamSerializerLong	INSTANCE	= new OStreamSerializerLong();

	public String getName() {
		return NAME;
	}

	public Object fromStream(final byte[] iStream) throws IOException {
		return OBinaryProtocol.bytes2long(iStream);
	}

	public byte[] toStream(final Object iObject) throws IOException {
		return OBinaryProtocol.long2bytes((Long) iObject);
	}
}

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

import java.io.IOException;

import com.orientechnologies.orient.core.serialization.OBinaryProtocol;

public class OStreamSerializerLong implements OStreamSerializer {
	public static final String								NAME			= "lo";

	public static final OStreamSerializerLong	INSTANCE	= new OStreamSerializerLong();

	public String getName() {
		return NAME;
	}

	public Object fromStream(final byte[] iStream) throws IOException {
		return OBinaryProtocol.bytes2long(iStream);
	}

	public byte[] toStream(final Object iObject) throws IOException {
		return OBinaryProtocol.long2bytes((Long) iObject);
	}
}

Fix by Sylvain on duplicated name for serializers Record and Long


/*
 * 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.jackrabbit.oak.spi.security.authentication;

import java.io.IOException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;

/**
 * Created by angela on 28/02/17.
 */
class ThrowingCallbackHandler implements CallbackHandler {

    private boolean throwIOException;

    ThrowingCallbackHandler(boolean throwIOException) {
        this.throwIOException = throwIOException;
    }

    @Override
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        if (throwIOException) {
            throw new IOException();
        } else {
            throw new UnsupportedCallbackException(new Callback() {
            });
        }
    }
}

Improve coverage for security code in oak-core


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

import static com.clicktravel.cheddar.server.application.lifecycle.LifecycleStatus.INACTIVE;
import static com.clicktravel.cheddar.server.application.lifecycle.LifecycleStatus.RUNNING;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class LifecycleStatusHolder {

    private volatile LifecycleStatus lifecycleStatus;

    @Autowired
    public LifecycleStatusHolder(@Value("${blue.green.mode}") final boolean blueGreenMode) {
        lifecycleStatus = blueGreenMode ? INACTIVE : RUNNING;
    }

    public LifecycleStatus getLifecycleStatus() {
        return lifecycleStatus;
    }

    public void setLifecycleStatus(final LifecycleStatus lifecycleStatus) {
        this.lifecycleStatus = lifecycleStatus;
    }

}

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

import static com.clicktravel.cheddar.server.application.lifecycle.LifecycleStatus.INACTIVE;
import static com.clicktravel.cheddar.server.application.lifecycle.LifecycleStatus.RUNNING;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class LifecycleStatusHolder {

    private final Logger logger = LoggerFactory.getLogger(getClass());
    private volatile LifecycleStatus lifecycleStatus;

    @Autowired
    public LifecycleStatusHolder(@Value("${blue.green.startup:false}") final boolean blueGreenStartup) {
        logger.debug("Blue-green startup: " + blueGreenStartup);
        lifecycleStatus = blueGreenStartup ? INACTIVE : RUNNING;
    }

    public LifecycleStatus getLifecycleStatus() {
        return lifecycleStatus;
    }

    public void setLifecycleStatus(final LifecycleStatus lifecycleStatus) {
        this.lifecycleStatus = lifecycleStatus;
    }

}

Allow blue-green startup to be specified from "-Dblue.green.startup" param.


package com.thoughtworks.xstream.core.util;

public final class ClassStack {

    private Class[] stack;
    private int pointer;

    public ClassStack(int initialCapacity) {
        stack = new Class[initialCapacity];
    }

    public void push(Class value) {
        if (pointer + 1 >= stack.length) {
            resizeStack(stack.length * 2);
        }
        stack[pointer++] = value;
    }

    public void popSilently() {
        pointer--;
    }

    public Class pop() {
        return stack[--pointer];
    }

    public Class peek() {
        return pointer == 0 ? null : stack[pointer - 1];
    }

    public int size() {
        return pointer;
    }

    public Class get(int i) {
        return stack[i];
    }

    private void resizeStack(int newCapacity) {
        Class[] newStack = new Class[newCapacity];
        System.arraycopy(stack, 0, newStack, 0, Math.min(stack.length, newCapacity));
        stack = newStack;
    }
}

package com.thoughtworks.xstream.core.util;

public final class ClassStack {

    private Class[] stack;
    private int pointer;

    public ClassStack(int initialCapacity) {
        stack = new Class[initialCapacity];
    }

    public void push(Class value) {
        if (pointer + 1 >= stack.length) {
            resizeStack(stack.length * 2);
        }
        stack[pointer++] = value;
    }

    public void popSilently() {
        stack[--pointer] = null;
    }

    public Class pop() {
        final Class result = stack[--pointer];
        stack[pointer] = null;
        return result;
    }

    public Class peek() {
        return pointer == 0 ? null : stack[pointer - 1];
    }

    public int size() {
        return pointer;
    }

    public Class get(int i) {
        return stack[i];
    }

    private void resizeStack(int newCapacity) {
        Class[] newStack = new Class[newCapacity];
        System.arraycopy(stack, 0, newStack, 0, Math.min(stack.length, newCapacity));
        stack = newStack;
    }
}

Drop references from popped classes.


package org.gbif.registry;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.solr.SolrHealthContributorAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;

@SpringBootApplication(
  scanBasePackages = {
    "org.gbif.ws.server.interceptor",
    "org.gbif.ws.server.aspect",
    "org.gbif.ws.server.filter",
    "org.gbif.ws.security",
    "org.gbif.registry"},
  exclude = {
    SolrAutoConfiguration.class,
    SolrHealthContributorAutoConfiguration.class
  })
@MapperScan("org.gbif.registry.persistence.mapper")
@EnableConfigurationProperties
public class RegistryWsApplication {
  public static void main(String[] args) {
    SpringApplication.run(RegistryWsApplication.class, args);
  }
}

package org.gbif.registry;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.solr.SolrHealthContributorAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;

@SpringBootApplication(
  scanBasePackages = {
    "org.gbif.ws.server.interceptor",
    "org.gbif.ws.server.aspect",
    "org.gbif.ws.server.filter",
    "org.gbif.ws.server.advice",
    "org.gbif.ws.security",
    "org.gbif.registry"},
  exclude = {
    SolrAutoConfiguration.class,
    SolrHealthContributorAutoConfiguration.class
  })
@MapperScan("org.gbif.registry.persistence.mapper")
@EnableConfigurationProperties
public class RegistryWsApplication {
  public static void main(String[] args) {
    SpringApplication.run(RegistryWsApplication.class, args);
  }
}

Add package org.gbif.ws.server.advice to scan


package com.github.krooken.edxvideoviewer;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class LoginScreen extends Activity {

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

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.login_screen, menu);
		return true;
	}

}

package com.github.krooken.edxvideoviewer;

import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.view.Menu;
import android.view.WindowManager;
import android.webkit.WebView;

public class LoginScreen extends Activity {

	@SuppressLint("SetJavaScriptEnabled")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_login_screen);

		WebView loginWebView = (WebView)findViewById(R.id.login_web_view);
		loginWebView.getSettings().setJavaScriptEnabled(true);
		loginWebView.loadUrl("https://courses.edx.org/login");
		getWindow().setSoftInputMode(
			      WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.login_screen, menu);
		return true;
	}

}

Load EdX login screen in WebView on create.


/*
 * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg
 *
 * 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.b2international.snowowl.api.rest;

/**
 * @since 1.0
 */
public abstract class AbstractRestService {

	/**
	 * The currently supported versioned media type of the snowowl RESTful API.
	 */
	public static final String SO_MEDIA_TYPE = "application/vnd.com.b2international.snowowl+json";

}

/*
 * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg
 *
 * 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.b2international.snowowl.api.rest;

/**
 * @since 1.0
 */
public abstract class AbstractRestService {

	/**
	 * The currently supported versioned media type of the snowowl RESTful API.
	 */
	public static final String SO_MEDIA_TYPE = "application/vnd.com.b2international.snowowl+json";

	public static final String CSV_MEDIA_TYPE = "text/csv";

}

Add text/csv media type constant


/*
 *  Copyright 2007-2008 University Of Southern California
 *
 *  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 edu.usc.glidein.db;

import javax.naming.Context;
import javax.naming.InitialContext;

// TODO: Record event times in the database to match Condor event times

public abstract class Database
{
	public static Database getDatabase() throws DatabaseException
	{
		String location = "java:comp/env/glidein/Database";
		try {
			Context initialContext = new InitialContext();
	    	return (Database)initialContext.lookup(location);
		} catch (Exception e) {
			throw new DatabaseException("Unable to load database: "+location,e);
		}
	}

	public abstract SiteDAO getSiteDAO();
	public abstract GlideinDAO getGlideinDAO();
}

/*
 *  Copyright 2007-2008 University Of Southern California
 *
 *  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 edu.usc.glidein.db;

import javax.naming.Context;
import javax.naming.InitialContext;

// TODO: Combine SQL DAOs and eliminate duplicate code

public abstract class Database
{
	public static Database getDatabase() throws DatabaseException
	{
		String location = "java:comp/env/glidein/Database";
		try {
			Context initialContext = new InitialContext();
	    	return (Database)initialContext.lookup(location);
		} catch (Exception e) {
			throw new DatabaseException("Unable to load database: "+location,e);
		}
	}

	public abstract SiteDAO getSiteDAO();
	public abstract GlideinDAO getGlideinDAO();
}

Remove date todo Add DRY todo


package com.novoda.downloadmanager;

import android.support.annotation.WorkerThread;

import java.util.List;

import static com.novoda.downloadmanager.DownloadBatchStatus.Status.*;

final class DownloadBatchSizeCalculator {

    private DownloadBatchSizeCalculator() {
        // non instantiable
    }

    @WorkerThread
    static long getTotalSize(List<DownloadFile> downloadFiles, DownloadBatchStatus.Status status, DownloadBatchId downloadBatchId) {
        long totalBatchSize = 0;
        for (DownloadFile downloadFile : downloadFiles) {
            if (status == DELETING || status == DELETED || status == PAUSED) {
                Logger.w("abort getTotalSize file " + downloadFile.id().rawId()
                             + " from batch " + downloadBatchId.rawId()
                             + " with status " + status
                             + " returns 0 as totalFileSize");
                return 0;
            }

            long totalFileSize = downloadFile.getTotalSize();
            if (totalFileSize == 0) {
                Logger.w("file " + downloadFile.id().rawId()
                             + " from batch " + downloadBatchId.rawId()
                             + " with status " + status
                             + " returns 0 as totalFileSize");
                return 0;
            }

            totalBatchSize += totalFileSize;
        }
        return totalBatchSize;
    }
}

package com.novoda.downloadmanager;

import android.support.annotation.WorkerThread;

import java.util.List;

import static com.novoda.downloadmanager.DownloadBatchStatus.Status.DELETING;
import static com.novoda.downloadmanager.DownloadBatchStatus.Status.DELETED;
import static com.novoda.downloadmanager.DownloadBatchStatus.Status.PAUSED;

final class DownloadBatchSizeCalculator {

    private DownloadBatchSizeCalculator() {
        // non instantiable
    }

    @WorkerThread
    static long getTotalSize(List<DownloadFile> downloadFiles, DownloadBatchStatus.Status status, DownloadBatchId downloadBatchId) {
        long totalBatchSize = 0;
        for (DownloadFile downloadFile : downloadFiles) {
            if (status == DELETING || status == DELETED || status == PAUSED) {
                Logger.w("abort getTotalSize file " + downloadFile.id().rawId()
                             + " from batch " + downloadBatchId.rawId()
                             + " with status " + status
                             + " returns 0 as totalFileSize");
                return 0;
            }

            long totalFileSize = downloadFile.getTotalSize();
            if (totalFileSize == 0) {
                Logger.w("file " + downloadFile.id().rawId()
                             + " from batch " + downloadBatchId.rawId()
                             + " with status " + status
                             + " returns 0 as totalFileSize");
                return 0;
            }

            totalBatchSize += totalFileSize;
        }
        return totalBatchSize;
    }
}

Replace star inport with explicit ones


package br.com.bloder.blormlib.validation;

import br.com.bloder.blormlib.validation.validations.Checked;
import br.com.bloder.blormlib.validation.validations.Email;
import br.com.bloder.blormlib.validation.validations.Filled;

/**
 * Created by bloder on 05/06/16.
 */
public class Validations {

  public static Validation filled = new Filled();
  public static Validation checked = new Checked();
  public static Validation email = new Email();
}

package br.com.bloder.blormlib.validation;

import br.com.bloder.blormlib.validation.validations.Checked;
import br.com.bloder.blormlib.validation.validations.Email;
import br.com.bloder.blormlib.validation.validations.Filled;
import br.com.bloder.blormlib.validation.validations.Number;

/**
 * Created by bloder on 05/06/16.
 */
public class Validations {

  public static Validation filled = new Filled();
  public static Validation checked = new Checked();
  public static Validation email = new Email();
  public static Validation number = new Number();
}

Add number validation in validations class


package hu.eltesoft.modelexecution.ide.debug.ui;

import java.util.List;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.moka.ui.presentation.AnimationUtils;

public class MokaAnimationBase {

	protected static final AnimationUtils UTILS = AnimationUtils.getInstance();

	public MokaAnimationBase() {
		super();
	}

	protected void openContainingDiagram(EObject element) {
		List<Diagram> diagrams = UTILS.getDiagrams(element);
		for (Diagram diagram : diagrams) {
			UTILS.openDiagram(diagram, false);
		}
	}

}

package hu.eltesoft.modelexecution.ide.debug.ui;

import java.util.List;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.moka.ui.presentation.AnimationUtils;
import org.eclipse.swt.widgets.Display;

public class MokaAnimationBase {

	protected static final AnimationUtils UTILS = AnimationUtils.getInstance();

	public MokaAnimationBase() {
		super();
	}

	protected void openContainingDiagram(EObject element) {
		Display.getDefault().asyncExec(() -> {
			List<Diagram> diagrams = UTILS.getDiagrams(element);
			if (!diagrams.isEmpty()) {
				UTILS.openDiagram(diagrams.get(0), false);
			}
		});
	}

}

Put opening diagrams to a UI thread


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

package com.google.enterprise.connector.traversal;

/**
 * A mock query traverser that runs forever.
 */
public class NeverEndingQueryTraverser implements Traverser {

  /* (non-Javadoc)
   * @see com.google.enterprise.connector.traversal.Traverser#runBatch(int)
   */
  public int runBatch(int batchHint) throws InterruptedException {
    boolean breakLoop = true;
    while (breakLoop) {
      // infinite loop
    }
    return batchHint;
  }

}

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

package com.google.enterprise.connector.traversal;

/**
 * A mock query traverser that runs forever.
 */
public class NeverEndingQueryTraverser implements Traverser {

  /* (non-Javadoc)
   * @see com.google.enterprise.connector.traversal.Traverser#runBatch(int)
   */
  public int runBatch(int batchHint) throws InterruptedException {
    boolean breakLoop = true;
    // infinite loop
    while (breakLoop) {
      try {
        Thread.sleep(1000);
      } catch (InterruptedException ie) {
        // do nothing
      }
    }
    return batchHint;
  }

}

Make never ending traverser consume less CPU.


package info.tregmine.database.db;

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

import info.tregmine.database.IItemDAO;
import info.tregmine.database.DAOException;

public class DBItemDAO implements IItemDAO
{
    private Connection conn;

    public DBItemDAO(Connection conn)
    {
        this.conn = conn;
    }

    @Override
    public int getItemValue(int itemId) throws DAOException
    {
        String sql = "SELECT * FROM item WHERE item_id = ?";

        try (PreparedStatement stmt = conn.prepareStatement(sql)) {
            stmt.setInt(1, itemId);
            stmt.execute();

            try (ResultSet rs = stmt.getResultSet()) {
                if (!rs.next()) {
                    return 0;
                }

                return rs.getInt("item_value");
            }
        } catch (SQLException e) {
            throw new DAOException(sql, e);
        }
    }
}

package info.tregmine.database.db;

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

import info.tregmine.database.IItemDAO;
import info.tregmine.database.DAOException;

public class DBItemDAO implements IItemDAO
{
    private Connection conn;

    public DBItemDAO(Connection conn)
    {
        this.conn = conn;
    }

    @Override
    public int getItemValue(int itemId, byte itemData) throws DAOException
    {
        String sql = "SELECT * FROM item WHERE item_id = ? AND item_data = ?";

        try (PreparedStatement stmt = conn.prepareStatement(sql)) {
            stmt.setInt(1, itemId);
            stmt.setByte(2, itemData);
            stmt.execute();

            try (ResultSet rs = stmt.getResultSet()) {
                if (!rs.next()) {
                    return 0;
                }

                return rs.getInt("item_value");
            }
        } catch (SQLException e) {
            throw new DAOException(sql, e);
        }
    }
}

Add support for item data


/*
 * Copyright 1999-2005 The Apache Software Foundation.
 *
 * 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.
 */

/* $Id$ */

package org.apache.fop.area;

/**
 * The normal-flow-reference-area class.
 * Each span-reference-area contains one or more of these objects
 * See fo:region-body definition in the XSL Rec for more information.
 */
public class NormalFlow extends BlockParent {
    /**
     * Constructor.
     * @param ipd of Normal flow object
     */
    public NormalFlow(int ipd) {
        addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
        setIPD(ipd);
    }
}

/*
 * Copyright 1999-2005 The Apache Software Foundation.
 *
 * 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.
 */

/* $Id$ */

package org.apache.fop.area;

/**
 * The normal-flow-reference-area class.
 * Each span-reference-area contains one or more of these objects
 * See fo:region-body definition in the XSL Rec for more information.
 */
public class NormalFlow extends BlockParent {
    /**
     * Constructor.
     * @param ipd of Normal flow object
     */
    public NormalFlow(int ipd) {
        addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
        setIPD(ipd);
    }

    /** @see org.apache.fop.area.BlockParent#addBlock(org.apache.fop.area.Block) */
    public void addBlock(Block block) {
        super.addBlock(block);
        bpd += block.getAllocBPD();
    }
}

Accumulate the BPD extent used by the normal flow's children.


package com.creatubbles.api.model.comment;

import android.support.annotation.NonNull;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.github.jasminb.jsonapi.annotations.Type;

/**
 * Created by Janek on 20.12.2017.
 */
public enum MentionType {

    USER("user"),
    GROUP("group"),
    CREATION("creation"),
    GALLERY("gallery"),
    PARTNER_APPLICATION("partner_application"),
    UNKNOWN("unknown");

    private String typeName;

    MentionType(String typeName) {
        this.typeName = typeName;
    }

    @JsonValue
    @NonNull
    public String getTypeName() {
        return typeName;
    }

    @JsonCreator
    public static MentionType fromName(String typeName) {
        for (MentionType mentionType : MentionType.values()) {
            if (mentionType.getTypeName().equals(typeName)) {
                return mentionType;
            }
        }
        return UNKNOWN;
    }
}

package com.creatubbles.api.model.comment;

import android.support.annotation.NonNull;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Created by Janek on 20.12.2017.
 */
public enum MentionType {

    USER("user"),
    GROUP("group"),
    CREATION("creation"),
    GALLERY("gallery"),
    PARTNER_APPLICATION("partner_application"),
    HASHTAG("hashtag"),
    UNKNOWN("unknown");

    private String typeName;

    MentionType(String typeName) {
        this.typeName = typeName;
    }

    @JsonValue
    @NonNull
    public String getTypeName() {
        return typeName;
    }

    @JsonCreator
    public static MentionType fromName(String typeName) {
        for (MentionType mentionType : MentionType.values()) {
            if (mentionType.getTypeName().equals(typeName)) {
                return mentionType;
            }
        }
        return UNKNOWN;
    }
}

Add Hashtag mention type to comments


package com.cgi.eoss.ftep.api.projections;

import com.cgi.eoss.ftep.model.Group;
import org.springframework.data.rest.core.config.Projection;

/**
 *
Abbreviated representation of a User entity, for embedding in REST responses.

 */
@Projection(name = "shortGroup", types = {Group.class})
public interface ShortGroup extends EmbeddedId {
    String getName();
    ShortUser getOwner();
}

package com.cgi.eoss.ftep.api.projections;

import com.cgi.eoss.ftep.model.Group;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.rest.core.config.Projection;

/**
 *
Abbreviated representation of a User entity, for embedding in REST responses.

 */
@Projection(name = "shortGroup", types = {Group.class})
public interface ShortGroup extends EmbeddedId {
    String getName();
    String getDescription();
    ShortUser getOwner();
    @Value("#{target.members.size()}")
    Integer getSize();
}

Add Group description and size to excerpt projection


package org.adaptlab.chpir.android.survey.QuestionFragments;

import org.adaptlab.chpir.android.survey.QuestionFragment;

import android.view.ViewGroup;
import android.widget.RatingBar;

public class RatingQuestionFragment extends QuestionFragment  {
    private final static int NUM_STARS = 5;
    private float mRating;
    private RatingBar mRatingBar;

    @Override
    protected void createQuestionComponent(ViewGroup questionComponent) {
        mRatingBar = new RatingBar(getActivity());
        mRatingBar.setNumStars(NUM_STARS);
        mRatingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
            @Override
            public void onRatingChanged(RatingBar ratingBar, float rating,
                    boolean fromUser) {
                mRating = rating;
                saveResponse();
            }
        });
        questionComponent.addView(mRatingBar);
    }

    @Override
    protected String serialize() {
        return String.valueOf(mRating);
    }

    @Override
    protected void deserialize(String responseText) {
        if (!responseText.equals("")) {
            mRating = Float.parseFloat(responseText);
            mRatingBar.setRating(mRating);
        }
    }
}

package org.adaptlab.chpir.android.survey.QuestionFragments;

import org.adaptlab.chpir.android.survey.QuestionFragment;

import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RatingBar;

public class RatingQuestionFragment extends QuestionFragment  {
    private final static int NUM_STARS = 5;
    private float mRating;
    private RatingBar mRatingBar;

    @Override
    protected void createQuestionComponent(ViewGroup questionComponent) {
        mRatingBar = new RatingBar(getActivity());
        mRatingBar.setNumStars(NUM_STARS);
        mRatingBar.setLayoutParams(new ViewGroup.LayoutParams(
                LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));
        mRatingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
            @Override
            public void onRatingChanged(RatingBar ratingBar, float rating,
                    boolean fromUser) {
                mRating = rating;
                saveResponse();
            }
        });
        questionComponent.addView(mRatingBar);
    }

    @Override
    protected String serialize() {
        return String.valueOf(mRating);
    }

    @Override
    protected void deserialize(String responseText) {
        if (!responseText.equals("")) {
            mRating = Float.parseFloat(responseText);
            mRatingBar.setRating(mRating);
        }
    }
}

Fix unpredictable number of stars in rating question type bug


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

import com.speedment.runtime.Speedment;
import com.speedment.runtime.internal.runtime.DefaultApplicationBuilder;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;

/**
 *
 * @author Emil Forslund
 */
public class CreateSpeedmentInstanceTest {

    @Test
    public void createSpeedmentInstance() {
        final Speedment speedment = new DefaultApplicationBuilder()
            .withCheckDatabaseConnectivity(false)
            .withValidateRuntimeConfig(false)
            .build();

        assertNotNull(speedment);
    }

}

Fix license header in file


package org.xcolab.client.activities.enums;

public enum ActivityCategory {
    MEMBER,
    DISCUSSION,
    PROPOSAL,
    CONTEST;
}

package org.xcolab.client.activities.enums;

import java.util.Arrays;

public enum ActivityCategory {

    MEMBER(ContestActivityType.values()),
    DISCUSSION(DiscussionActivityType.values()),
    PROPOSAL(ProposalActivityType.values()),
    CONTEST(ContestActivityType.values());

    private final ActivityType[] activityTypes;

    ActivityCategory(ActivityType[] activityTypes) {
        this.activityTypes = activityTypes;
    }

    public ActivityType getActivityType(String activityType) {
        return Arrays.stream(activityTypes)
                .filter(s -> s.name().equalsIgnoreCase(activityType))
                .findAny()
                .orElseThrow(() -> new IllegalArgumentException(
                        "No enum constant " + name() + "." + activityType));
    }
}

Add method to get type from category


package model;

import org.junit.Test;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Scanner;

import static org.junit.Assert.*;

/**
 * Created by Elliad on 2016-05-08.
 */
public class FileModelTest {
    @Test
    public void singletonTest() {
        assertNotNull(FileModel.getModel());
    }

    @Test
    public void fileReadTest() {
        ArrayList<String> testArraylist = new ArrayList<String>();
        testArraylist.add("asdf\n");
        testArraylist.add("asdf");
        assertTrue(FileModel.getModel().readFile("A.txt"));
        assertEquals(FileModel.getModel().getStringArrayList(),testArraylist);

    }

    @Test
    public void fileWriteTest() {
        assertTrue(FileModel.getModel().writeFile("AA.txt"));
        ArrayList<String> testArraylist = new ArrayList<String>();
        try(Scanner in = new Scanner(new FileReader("AA.txt")))
        {
            String tempString = "";
            while(in.hasNext()) {
                tempString = in.next(); //임시 텍스트에 개행을 제외한 한 줄을 불러온다
                if(in.hasNext()) tempString +="\n"; //다음 줄이 없을 때는 개행을 추가하지 않는다.
                testArraylist.add(tempString);
            }
        } catch (FileNotFoundException e) {

            e.printStackTrace();
        }
        assertEquals(FileModel.getModel().getStringArrayList(),testArraylist);

    }
}

package model;

import org.junit.Test;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Scanner;

import static org.junit.Assert.*;

/**
 * Created by Elliad on 2016-05-08.
 */
public class FileModelTest {
    @Test
    public void fileReadTest() {
        ArrayList<String> testArraylist = new ArrayList<String>();
        testArraylist.add("asdf\n");
        testArraylist.add("asdf");
        assertTrue(FileModel.getModel().readFile("A.txt"));
        assertEquals(FileModel.getModel().getStringArrayList(),testArraylist);

    }

    @Test
    public void fileWriteTest() {
        assertTrue(FileModel.getModel().writeFile("AA.txt"));
        ArrayList<String> testArraylist = new ArrayList<String>();
        try(Scanner in = new Scanner(new FileReader("AA.txt")))
        {
            String tempString = "";
            while(in.hasNext()) {
                tempString = in.next(); //임시 텍스트에 개행을 제외한 한 줄을 불러온다
                if(in.hasNext()) tempString +="\n"; //다음 줄이 없을 때는 개행을 추가하지 않는다.
                testArraylist.add(tempString);
            }
        } catch (FileNotFoundException e) {

            e.printStackTrace();
        }
        assertEquals(FileModel.getModel().getStringArrayList(),testArraylist);

    }
}

Remove Singletone Test of FileModel


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

import com.google.common.collect.ImmutableList;
import io.prestosql.spi.type.Type;

import java.util.List;
import java.util.Optional;

import static java.util.Objects.requireNonNull;

public class GroupField
        extends Field
{
    private final ImmutableList<Optional<Field>> children;

    public GroupField(Type type, int repetitionLevel, int definitionLevel, boolean required, ImmutableList<Optional<Field>> children)
    {
        super(type, repetitionLevel, definitionLevel, required);
        this.children = requireNonNull(children, "children is required");
    }

    public List<Optional<Field>> getChildren()
    {
        return children;
    }
}

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

import com.google.common.collect.ImmutableList;
import io.prestosql.spi.type.Type;

import java.util.List;
import java.util.Optional;

import static java.util.Objects.requireNonNull;

public class GroupField
        extends Field
{
    private final List<Optional<Field>> children;

    public GroupField(Type type, int repetitionLevel, int definitionLevel, boolean required, List<Optional<Field>> children)
    {
        super(type, repetitionLevel, definitionLevel, required);
        this.children = ImmutableList.copyOf(requireNonNull(children, "children is null"));
    }

    public List<Optional<Field>> getChildren()
    {
        return children;
    }
}

Declare field as a List


package com.github.blindpirate.gogradle.build;

import com.github.blindpirate.gogradle.util.ExceptionHandler;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.concurrent.CountDownLatch;
import java.util.function.Consumer;
import java.util.function.Supplier;

import static com.github.blindpirate.gogradle.GogradleGlobal.DEFAULT_CHARSET;

public class SubprocessReader extends Thread {
    private Supplier<InputStream> is;
    private CountDownLatch latch;
    private Consumer<String> consumer;

    public SubprocessReader(Supplier<InputStream> is,
                            Consumer<String> consumer,
                            CountDownLatch latch) {
        this.is = is;
        this.latch = latch;
        this.consumer = consumer;
    }

    @Override
    public void run() {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(is.get(), DEFAULT_CHARSET))) {
            String line;
            try {
                while ((line = br.readLine()) != null) {
                    consumer.accept(line);
                }
            } catch (IOException e) {
                consumer.accept(ExceptionHandler.getStackTrace(e));
            }
        } catch (IOException e) {
            throw ExceptionHandler.uncheckException(e);
        } finally {
            latch.countDown();
        }
    }
}

package com.github.blindpirate.gogradle.build;

import com.github.blindpirate.gogradle.util.ExceptionHandler;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.concurrent.CountDownLatch;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Supplier;

import static com.github.blindpirate.gogradle.GogradleGlobal.DEFAULT_CHARSET;

public class SubprocessReader extends Thread {
    private Supplier<InputStream> is;
    private CountDownLatch latch;
    private Consumer<String> consumer;
    private Predicate<String> lineFilter = line -> true;

    public SubprocessReader(Supplier<InputStream> is,
                            Consumer<String> consumer,
                            CountDownLatch latch) {
        this.is = is;
        this.latch = latch;
        this.consumer = consumer;
    }

    public SubprocessReader(Supplier<InputStream> is,
                            Consumer<String> consumer,
                            CountDownLatch latch,
                            Predicate<String> lineFilter) {
        this.is = is;
        this.latch = latch;
        this.consumer = consumer;
        this.lineFilter = lineFilter;
    }

    @Override
    public void run() {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(is.get(), DEFAULT_CHARSET))) {
            String line;
            try {
                while ((line = br.readLine()) != null) {
                    if (lineFilter.test(line)) {
                        consumer.accept(line);
                    }
                }
            } catch (IOException e) {
                consumer.accept(ExceptionHandler.getStackTrace(e));
            }
        } catch (IOException e) {
            throw ExceptionHandler.uncheckException(e);
        } finally {
            latch.countDown();
        }
    }
}

Add line predicate to filter output lines


package org.springframework.security.config;

/**
 * Contains globally used default Bean IDs for beans created by the namespace support in Spring Security 2.
 * <p>
 * These are intended for internal use.
 *
 * @author Ben Alex
 * @author Luke Taylor
 */
public abstract class BeanIds {
    private static final String PREFIX = "org.springframework.security.";

    /** The "global" AuthenticationManager instance, registered by the <authentication-manager> element */
    public static final String AUTHENTICATION_MANAGER = PREFIX + "authenticationManager";

    /** External alias for FilterChainProxy bean, for use in web.xml files */
    public static final String SPRING_SECURITY_FILTER_CHAIN = "springSecurityFilterChain";

    public static final String CONTEXT_SOURCE_SETTING_POST_PROCESSOR = PREFIX + "contextSettingPostProcessor";

    public static final String USER_DETAILS_SERVICE = PREFIX + "userDetailsService";
    public static final String USER_DETAILS_SERVICE_FACTORY = PREFIX + "userDetailsServiceFactory";

    public static final String METHOD_ACCESS_MANAGER = PREFIX + "defaultMethodAccessManager";

    public static final String FILTER_CHAIN_PROXY = PREFIX + "filterChainProxy";
    public static final String FILTER_CHAINS = PREFIX + "filterChains";

    public static final String METHOD_SECURITY_METADATA_SOURCE_ADVISOR = PREFIX + "methodSecurityMetadataSourceAdvisor";
    public static final String EMBEDDED_APACHE_DS = PREFIX + "apacheDirectoryServerContainer";
    public static final String CONTEXT_SOURCE = PREFIX + "securityContextSource";

    public static final String DEBUG_FILTER = PREFIX + "debugFilter";
}

Fix javadoc to work with jdk 1.5


package com.formulasearchengine.mathosphere.mlp.contracts;

import com.formulasearchengine.mathosphere.mlp.cli.FlinkMlpCommandConfig;
import com.formulasearchengine.mathosphere.mlp.pojos.ParsedWikiDocument;
import com.formulasearchengine.mathosphere.mlp.pojos.RawWikiDocument;

import org.junit.Test;

import java.util.List;

public class RussianWikiPipelineTest {

  @Test
  public void fullPipeline() throws Exception {
    String wikiRuFile = "com/formulasearchengine/mathosphere/mlp/wikirusample.xml";

    TextAnnotatorMapper textAnnotator = ruTextAnnotator();

    List<RawWikiDocument> docs = readDocs(wikiRuFile);

    for (RawWikiDocument doc : docs) {
      ParsedWikiDocument parsedDoc = textAnnotator.map(doc);
      System.out.println(parsedDoc);
    }
  }

  private List<RawWikiDocument> readDocs(String wikiRuFile) throws Exception {
    return TextAnnotatorMapperTest.readWikiTextDocuments(wikiRuFile);
  }

  private static TextAnnotatorMapper ruTextAnnotator() throws Exception {
    String[] params = {"--language", "ru", "-pos", ""};
    FlinkMlpCommandConfig config = FlinkMlpCommandConfig.from(params);

    TextAnnotatorMapper textAnnotator = new TextAnnotatorMapper(config);
    textAnnotator.open(null);
    return textAnnotator;
  }
}

package com.formulasearchengine.mathosphere.mlp.contracts;

import com.formulasearchengine.mathosphere.mlp.cli.FlinkMlpCommandConfig;
import com.formulasearchengine.mathosphere.mlp.pojos.ParsedWikiDocument;
import com.formulasearchengine.mathosphere.mlp.pojos.RawWikiDocument;
import org.junit.Test;

import java.util.List;

public class RussianWikiPipelineTest {

    private static TextAnnotatorMapper ruTextAnnotator() throws Exception {
        String[] params = {"--language", "ru", "-pos", "", "-in", "fake-input", "-out", "fake-output"};
        FlinkMlpCommandConfig config = FlinkMlpCommandConfig.from(params);

        TextAnnotatorMapper textAnnotator = new TextAnnotatorMapper(config);
        textAnnotator.open(null);
        return textAnnotator;
    }

    @Test
    public void fullPipeline() throws Exception {
        String wikiRuFile = "com/formulasearchengine/mathosphere/mlp/wikirusample.xml";

        TextAnnotatorMapper textAnnotator = ruTextAnnotator();

        List<RawWikiDocument> docs = readDocs(wikiRuFile);

        for (RawWikiDocument doc : docs) {
            ParsedWikiDocument parsedDoc = textAnnotator.map(doc);
            System.out.println(parsedDoc);
        }
    }

    private List<RawWikiDocument> readDocs(String wikiRuFile) throws Exception {
        return TextAnnotatorMapperTest.readWikiTextDocuments(wikiRuFile);
    }
}

Repair more broken cli tests


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

import java.util.Map;
import java.util.Map.Entry;

public class URLQuery {
    private Map<String, String[]> parameterMap;
    public URLQuery(Map<String, String[]> parameterMap){
        this.parameterMap = parameterMap;
    }

    public String toString(Map<String, String[]> overrideMap){
        StringBuffer s = new StringBuffer();
        s.append("?");
        for (Entry<String, String[]> entry: parameterMap.entrySet()){

            String key = entry.getKey();

            String[] values = overrideMap.containsKey(key)?
                    overrideMap.get(key) : parameterMap.get(key);

            for (String query: values){
                s.append(key);
                s.append("=");
                s.append(query);
                s.append("&");
            }

        }
        return s.substring(0, s.length()-1);
    }
}

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

import java.util.Map;
import java.util.Map.Entry;

public class URLQuery {
    private Map<String, String[]> parameterMap;
    public URLQuery(Map<String, String[]> parameterMap){
        this.parameterMap = parameterMap;
    }

    public String toString(Map<String, String[]> overrideMap){
        StringBuilder s = new StringBuilder();
        s.append("?");
        for (Entry<String, String[]> entry: parameterMap.entrySet()){

            String key = entry.getKey();

            String[] values = overrideMap.containsKey(key)?
                    overrideMap.get(key) : parameterMap.get(key);

            for (String query: values){
                s.append(key);
                s.append("=");
                s.append(query);
                s.append("&");
            }

        }
        return s.substring(0, s.length()-1);
    }
}

Use StringBuilder instead of StringBuffer.


/*
 * 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.logging.log4j.core.config.plugins.util;

/**
 * Interface for doing automatic String conversion to a specific type.
 *
 * @param <T> the type this converter converts Strings into.
 */
public interface TypeConverter<T> {

    /**
     * Converts a String to a given type.
     *
     * @param s the String to convert.
     * @return the converted object.
     */
    T convert(String s);
}

/*
 * 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.logging.log4j.core.config.plugins.util;

/**
 * Interface for doing automatic String conversion to a specific type.
 *
 * @param <T> the type this converter converts Strings into.
 */
public interface TypeConverter<T> {

    /**
     * Converts a String to a given type.
     *
     * @param s the String to convert. Cannot be {@code null}.
     * @return the converted object.
     */
    T convert(String s);
}

Add documentation requiring non-null values.


package nl.idgis.publisher.provider.database.messages;

import java.io.Serializable;

import nl.idgis.publisher.domain.service.Type;

public class DatabaseColumnInfo implements Serializable {

	private static final long serialVersionUID = 8052868017910750424L;

	private final String name;

	private final String typeName;

	public DatabaseColumnInfo(String name, String typeName) {
		this.name = name;
		this.typeName = typeName;
	}

	public String getName() {
		return name;
	}

	public String getTypeName() {
		return typeName;
	}

	public Type getType() {
		switch(typeName.toUpperCase()) {
			case "NUMBER":
				return Type.NUMERIC;
			case "DATE":
				return Type.DATE;
			case "VARCHAR2":
			case "NVARCHAR2":
			case "NCHAR":
			case "CHAR":
			case "CLOB":
				return Type.TEXT;
			case "SDO_GEOMETRY":
			case "ST_GEOMETRY":
				return Type.GEOMETRY;
		}

		return null;
	}

	@Override
	public String toString() {
		return "DatabaseColumnInfo [name=" + name + ", typeName=" + typeName + "]";
	}
}

package nl.idgis.publisher.provider.database.messages;

import java.io.Serializable;

import nl.idgis.publisher.domain.service.Type;

public class DatabaseColumnInfo implements Serializable {

	private static final long serialVersionUID = 8052868017910750424L;

	private final String name;

	private final String typeName;

	public DatabaseColumnInfo(String name, String typeName) {
		this.name = name;
		this.typeName = typeName;
	}

	public String getName() {
		return name;
	}

	public String getTypeName() {
		return typeName;
	}

	public Type getType() {
		switch(typeName.toUpperCase()) {
			case "NUMBER":
				return Type.NUMERIC;
			case "DATE":
				return Type.DATE;
			case "VARCHAR2":
			case "NVARCHAR2":
			case "NCHAR":
			case "CHAR":
			case "CLOB":
			case "NCLOB":
				return Type.TEXT;
			case "SDO_GEOMETRY":
			case "ST_GEOMETRY":
				return Type.GEOMETRY;
		}

		return null;
	}

	@Override
	public String toString() {
		return "DatabaseColumnInfo [name=" + name + ", typeName=" + typeName + "]";
	}
}

Add support for NCLOB sql type


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

import org.testcontainers.containers.OracleContainer;

public final class OracleServerConfig extends AbstractContainerBasedDbConfig<OracleContainer> {
    public OracleServerConfig() {
        super(new OracleContainer("oracleinanutshell/oracle-xe-11g"));
    }

    @Override
    public String getCreateTableStatement() {
        return "CREATE TABLE shedlock(name VARCHAR(64) NOT NULL, lock_until TIMESTAMP(3) NOT NULL, locked_at TIMESTAMP(3) NOT NULL, locked_by VARCHAR(255) NOT NULL, PRIMARY KEY (name))";
    }

    @Override
    public String nowExpression() {
        return "SYS_EXTRACT_UTC(SYSTIMESTAMP)";
    }

    @Override
    public String getR2dbcUrl() {
        return "r2dbc:oracle://localhost:" + container.getOraclePort() + "/" + container.getSid();
    }
}

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

import org.testcontainers.containers.OracleContainer;

public final class OracleServerConfig extends AbstractContainerBasedDbConfig<OracleContainer> {
    public OracleServerConfig() {
        super(createContainer());
    }

    @Override
    public String getCreateTableStatement() {
        return "CREATE TABLE shedlock(name VARCHAR(64) NOT NULL, lock_until TIMESTAMP(3) NOT NULL, locked_at TIMESTAMP(3) NOT NULL, locked_by VARCHAR(255) NOT NULL, PRIMARY KEY (name))";
    }

    @Override
    public String nowExpression() {
        return "SYS_EXTRACT_UTC(SYSTIMESTAMP)";
    }

    @Override
    public String getR2dbcUrl() {
        return "r2dbc:oracle://localhost:" + container.getOraclePort() + "/" + container.getSid();
    }

    private static OracleContainer createContainer() {
        return new OracleContainer("gvenzl/oracle-xe")
            .withEnv("ORACLE_PASSWORD", "oracle");
    }
}

Use newer version of Oracle


package ie.lero.evoting.scenario;

import junit.framework.TestCase;
import election.tally.BallotCounting;
import election.tally.Constituency;

public class CountContinuingCandidatesEventK extends TestCase {

 	public void testEvent() {
 	 BallotCounting ballotCounting = new BallotCounting();
   Constituency constituency = new Constituency();
   constituency.setNumberOfSeats(3,3);
   constituency.setNumberOfCandidates(4);
   ballotCounting.setup(constituency);
	 assertTrue (4 == ballotCounting.getContinuingCandidates());
	}
}

package ie.lero.evoting.scenario;

import junit.framework.TestCase;
import election.tally.BallotCounting;
import election.tally.Constituency;

public class CountContinuingCandidatesEventK extends TestCase {

 	public void testEvent() {
 	 final BallotCounting ballotCounting = new BallotCounting();
   final Constituency constituency = new Constituency();
   constituency.setNumberOfSeats(3,3);
   constituency.setNumberOfCandidates(4);
   ballotCounting.setup(constituency);
	 assertTrue (4 == ballotCounting.getContinuingCandidates());
	}
}

Use final variables for Ballot Counting and Constituency objects being tested.


package com.hamishrickerby.http_server;

/**
 * Created by rickerbh on 17/08/2016.
 */
public class ResponseFactory {
    String rootPath;

    public ResponseFactory(String rootPath) {
        this.rootPath = rootPath;
    }

    public Response makeResponse(Request request) {
        Response response = null;
        if (isFileResponse(request)) {
            FileContentsResponse fcr = new FileContentsResponse(request, rootPath);
            response = fcr;
        } else if (isDirectoryResponse(request)) {
            DirectoryListingResponse dlr = new DirectoryListingResponse(request, rootPath);
            response = dlr;
        } else {
            response = new FourOhFourResponse(request);
        }
        return response;
    }

    private boolean isFileResponse(Request request) {
        FileServer server = new FileServer(rootPath);
        return server.fileExists(request.getPath());
    }

    private boolean isDirectoryResponse(Request request) {
        FileDirectoryServer server = new FileDirectoryServer(rootPath);
        return server.directoryExists(request.getPath());
    }

}

package com.hamishrickerby.http_server;

/**
 * Created by rickerbh on 17/08/2016.
 */
public class ResponseFactory {
    String rootPath;

    public ResponseFactory(String rootPath) {
        this.rootPath = rootPath;
    }

    public Response makeResponse(Request request) {
        Response response;
        if (isFileResponse(request)) {
            response = new FileContentsResponse(request, rootPath);
        } else if (isDirectoryResponse(request)) {
            response = new DirectoryListingResponse(request, rootPath);
        } else {
            response = new FourOhFourResponse(request);
        }
        return response;
    }

    private boolean isFileResponse(Request request) {
        FileServer server = new FileServer(rootPath);
        return server.fileExists(request.getPath());
    }

    private boolean isDirectoryResponse(Request request) {
        FileDirectoryServer server = new FileDirectoryServer(rootPath);
        return server.directoryExists(request.getPath());
    }

}

Drop some unnecessary code from Response


package net.openhft.chronicle.bytes;

public interface ByteStringAppender<B extends ByteStringAppender<B>> extends StreamingDataOutput<B> {
    default B append(char ch) {
        BytesUtil.appendUTF(this, ch);
        return (B) this;
    }

    default B append(CharSequence cs) {
        return append(cs, 0, cs.length());
    }

    default B append(long value) {
        BytesUtil.append(this, value);
        return (B) this;
    }

    default B append(float f) {
        BytesUtil.append(this, f);
        return (B) this;
    }

    default B append(double d) {
        BytesUtil.append(this, d);
        return (B) this;
    }

    default B append(CharSequence cs, int start, int end) {
        BytesUtil.appendUTF(this, cs, start, end - start);
        return (B) this;
    }
}

package net.openhft.chronicle.bytes;

public interface ByteStringAppender<B extends ByteStringAppender<B>> extends StreamingDataOutput<B> {
    default B append(char ch) {
        BytesUtil.appendUTF(this, ch);
        return (B) this;
    }

    default B append(CharSequence cs) {
        return append(cs, 0, cs.length());
    }

    default B append(long value) {
        BytesUtil.append(this, value);
        return (B) this;
    }

    default B append(float f) {
        BytesUtil.append(this, f);
        return (B) this;
    }

    default B append(double d) {
        BytesUtil.append(this, d);
        return (B) this;
    }

    default B append(CharSequence cs, int start, int end) {
        BytesUtil.appendUTF(this, cs, start, end - start);
        return (B) this;
    }

    default B append(long value, int digits) {
        BytesUtil.append((RandomDataOutput) this, position(), value, digits);
        this.skip(digits);
        return (B) this;
    }

}

Add support for text based LongArrayTextReference


package com.arondor.common.reflection.parser.java;

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

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

import com.arondor.common.reflection.api.catalog.AccessibleClassCatalog;
import com.arondor.common.reflection.catalog.SimpleAccessibleClassCatalog;

public class TestDirectoryAccessibleClassParser
{
    @Test
    public void testParseLibsFolder() throws ClassNotFoundException
    {
        AccessibleClassCatalog catalog = new SimpleAccessibleClassCatalog();
        DirectoryAccessibleClassProvider provider = new DirectoryAccessibleClassProvider();
        JavaAccessibleClassParser parser = new JavaAccessibleClassParser();
        parser.setTryInstantiateClassForDefaultValue(true);
        provider.setAccessibleClassParser(parser);

        List<String> packagePrefixes = Arrays.asList("org.junit");
        provider.setPackagePrefixes(packagePrefixes);
        List<String> directories = Arrays.asList("src/test/resources/libs");
        provider.setDirectories(directories);
        provider.provideClasses(catalog);

        Assert.assertNotNull(catalog.getAccessibleClass("org.junit.Test"));
        try
        {
            catalog.getAccessibleClass("org.apache.log4j.Logger");
            Assert.fail();
        }
        catch (ClassNotFoundException e)
        {

        }

    }
}

package com.arondor.common.reflection.parser.java;

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

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

import com.arondor.common.reflection.api.catalog.AccessibleClassCatalog;
import com.arondor.common.reflection.catalog.SimpleAccessibleClassCatalog;

public class TestDirectoryAccessibleClassParser
{
    @Test
    public void testParseLibsFolder() throws ClassNotFoundException
    {
        AccessibleClassCatalog catalog = new SimpleAccessibleClassCatalog();
        DirectoryAccessibleClassProvider provider = new DirectoryAccessibleClassProvider();
        JavaAccessibleClassParser parser = new JavaAccessibleClassParser();
        parser.setTryInstantiateClassForDefaultValue(true);
        provider.setAccessibleClassParser(parser);

        List<String> packagePrefixes = Arrays.asList("org.junit");
        provider.setPackagePrefixes(packagePrefixes);
        List<String> directories = Arrays.asList("src/test/resources/libs");
        provider.setDirectories(directories);
        provider.provideClasses(catalog);

        Assert.assertNotNull(catalog.getAccessibleClass("org.junit.Test"));
        Assert.assertNull(catalog.getAccessibleClass("org.apache.log4j.Logger"));

    }
}

Fix unit test after exception removal


/**
 * Project RSA Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Feb 24, 2014.
 */

import java.io.IOException;
import java.io.OutputStream;

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

/**
 * This class is resposnible for testing and representation data for RSA
 * encryption algorithm.
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class Main {

    /**
     * This logger is responsible for the registration of events.
     */
    static final Logger logger = LogManager.getLogger(Main.class.getName());

    /**
     * This method sets up configuration for loggers.
     */
    private static void loggerSetup() {
        // BasicConfigurator.configure();
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        loggerSetup();
        RSA rsa = new RSA(1024);

        try {
            OutputStream encryptedStream = IOOperations.encryptStream(
                    IOOperations.readFile("data.txt"), rsa, RSA.BLOCK_SIZE);
            logger.info(encryptedStream.toString());
            logger.info(IOOperations.decryptStream(encryptedStream, rsa,
                    RSA.BLOCK_SIZE));
        } catch (IOException e) {
            logger.debug(e);
            logger.error(e);
        }
    }

}

/**
 * Project RSA Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Feb 24, 2014.
 */

import java.io.IOException;
import java.io.OutputStream;

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

/**
 * This class is resposnible for testing and representation data for RSA
 * encryption algorithm.
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class Main {

    /**
     * This logger is responsible for the registration of events.
     */
    static final Logger logger = LogManager.getLogger(Main.class.getName());

    /**
     * This method sets up configuration for loggers.
     */
    private static void loggerSetup() {
        // BasicConfigurator.configure();
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        if (args.length == 1) {
            loggerSetup();
            RSA rsa = new RSA(1024);

            try {
                OutputStream encryptedStream = IOOperations.encryptStream(
                        IOOperations.readFile(args[0]), rsa, RSA.BLOCK_SIZE);
                logger.info(encryptedStream.toString());
                logger.info(IOOperations.decryptStream(encryptedStream, rsa,
                        RSA.BLOCK_SIZE));
            } catch (IOException e) {
                logger.debug(e);
                logger.error(e);
            }
        } else {
            logger.warn("The application needs 1 argument as file to encrypt");
        }
    }

}

Add parameter to app as executable file


/*
 * Copyright 2014 Space Dynamics Laboratory - Utah State University Research Foundation.
 *
 * 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 edu.usu.sdl.openstorefront.service.message;

import org.codemonkey.simplejavamail.Email;

/**
 *
 * @author dshurtleff
 */
public class TestMessageGenerator
		extends BaseMessageGenerator
{

	public TestMessageGenerator(MessageContext messageContext)
	{
		super(messageContext);
	}

	@Override
	protected String getSubject()
	{
		return "Email Check";
	}

	@Override
	protected String generateMessageInternal(Email email)
	{
		StringBuilder message = new StringBuilder();
		message.append("This is a test message used to confirm that emails can be sent to you as intended.");
		return message.toString();
	}

	@Override
	protected String getUnsubscribe()
	{
		return "If you are not the intended user of this message.  Please delete this message. ";
	}

}

/*
 * Copyright 2014 Space Dynamics Laboratory - Utah State University Research Foundation.
 *
 * 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 edu.usu.sdl.openstorefront.service.message;

import org.codemonkey.simplejavamail.Email;

/**
 *
 * @author dshurtleff
 */
public class TestMessageGenerator
		extends BaseMessageGenerator
{

	public TestMessageGenerator(MessageContext messageContext)
	{
		super(messageContext);
	}

	@Override
	protected String getSubject()
	{
		return "Email Check";
	}

	@Override
	protected String generateMessageInternal(Email email)
	{
		StringBuilder message = new StringBuilder();
		message.append("This is a test message used to confirm that emails can be sent to you as intended.");
		return message.toString();
	}

	@Override
	protected String getUnsubscribe()
	{
		return "If you are not the intended user of this message, please delete this message. ";
	}

}

Correct grammar in e-mail test message


/**
 */
package org.example.activemq.orbweaver.cc;

import javax.ws.rs.ext.RuntimeDelegate;

import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;

/**
 * JAX-RS ControlCenter root resource
 */
public class ControlCenterServer {
    private static Server server;

    protected ControlCenterServer() throws Exception {
        ControlCenterApp application = new ControlCenterApp();
        RuntimeDelegate delegate = RuntimeDelegate.getInstance();

        JAXRSServerFactoryBean bean = delegate.createEndpoint(application, JAXRSServerFactoryBean.class);
        bean.setAddress("http://localhost:9000/services" + bean.getAddress());
        server = bean.create();
        server.start();
    }

    public static void main(String args[]) throws Exception {
        new ControlCenterServer();
        System.out.println("Server ready...");

        Thread.sleep(125 * 60 * 1000);
        System.out.println("Server exiting");
        server.stop();
        server.destroy();
        System.exit(0);
    }
}

/**
 */
package org.example.activemq.orbweaver.cc;

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

import javax.ws.rs.ext.RuntimeDelegate;

import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;

/**
 * JAX-RS ControlCenter root resource
 */
public class ControlCenterServer {
    private static Server server;

    protected ControlCenterServer() throws Exception {
        ControlCenterApp application = new ControlCenterApp();
        RuntimeDelegate delegate = RuntimeDelegate.getInstance();

        Map<Object, Object> mappings = new HashMap<Object, Object>();
        mappings.put("json", "application/json");
        mappings.put("xml", "application/xml");

        JAXRSServerFactoryBean bean = delegate.createEndpoint(application, JAXRSServerFactoryBean.class);
        bean.setAddress("http://localhost:9000/services" + bean.getAddress());
        bean.setExtensionMappings(mappings);
        server = bean.create();
        server.start();
    }

    public static void main(String args[]) throws Exception {
        new ControlCenterServer();
        System.out.println("Server ready...");

        Thread.sleep(125 * 60 * 1000);
        System.out.println("Server exiting");
        server.stop();
        server.destroy();
        System.exit(0);
    }
}

Add extension mappings to server.


package org.ovirt.engine.core.bll.network.host;

import org.ovirt.engine.core.bll.Backend;
import org.ovirt.engine.core.bll.VdsCommand;
import org.ovirt.engine.core.common.AuditLogType;
import org.ovirt.engine.core.common.action.VdsActionParameters;
import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
import org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase;

@SuppressWarnings("serial")
public class CommitNetworkChangesCommand<T extends VdsActionParameters> extends VdsCommand<T> {
    public CommitNetworkChangesCommand(T param) {
        super(param);
    }

    @Override
    protected void executeCommand() {
        VDSReturnValue retVal = Backend
                .getInstance()
                .getResourceManager()
                .RunVdsCommand(VDSCommandType.SetSafeNetworkConfig,
                        new VdsIdVDSCommandParametersBase(getParameters().getVdsId()));

        getVds().setNetConfigDirty(false);
        getDbFacade().getVdsDynamicDao().update(getVds().getDynamicData());
        setSucceeded(retVal.getSucceeded());
    }

    @Override
    protected boolean canDoAction() {
        return true;
    }

    @Override
    public AuditLogType getAuditLogTypeValue() {
        return getSucceeded() ? AuditLogType.NETWORK_COMMINT_NETWORK_CHANGES
                : AuditLogType.NETWORK_COMMINT_NETWORK_CHANGES_FAILED;
    }
}

package org.ovirt.engine.core.bll.network.host;

import org.ovirt.engine.core.bll.VdsCommand;
import org.ovirt.engine.core.common.AuditLogType;
import org.ovirt.engine.core.common.action.VdsActionParameters;
import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
import org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase;

@SuppressWarnings("serial")
public class CommitNetworkChangesCommand<T extends VdsActionParameters> extends VdsCommand<T> {
    public CommitNetworkChangesCommand(T param) {
        super(param);
    }

    @Override
    protected void executeCommand() {
        VDSReturnValue retVal =
                runVdsCommand(VDSCommandType.SetSafeNetworkConfig,
                        new VdsIdVDSCommandParametersBase(getParameters().getVdsId()));

        getDbFacade().getVdsDynamicDao().updateNetConfigDirty(getParameters().getVdsId(), false);
        setSucceeded(retVal.getSucceeded());
    }

    @Override
    protected boolean canDoAction() {
        return true;
    }

    @Override
    public AuditLogType getAuditLogTypeValue() {
        return getSucceeded() ? AuditLogType.NETWORK_COMMINT_NETWORK_CHANGES
                : AuditLogType.NETWORK_COMMINT_NETWORK_CHANGES_FAILED;
    }
}

Use proper method to mark net changes as saved


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

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

import io.methvin.watcher.hashing.FileHasher;
import io.methvin.watcher.hashing.HashCode;

/**
 * For unit test only!
 */
public class TestHasher implements FileHasher {
    @Override
    public HashCode hash(Path path) throws IOException {
        // Always return constant
        // This should cause every event is triggered only once (hashcode remains the same), so we can test this.
        // Never use this in production code
        return HashCode.fromLong(1L);
    }
}

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

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

import io.methvin.watcher.hashing.FileHash;
import io.methvin.watcher.hashing.FileHasher;

/**
 * For unit test only!
 */
public class TestHasher implements FileHasher {
    @Override
    public FileHash hash(Path path) throws IOException {
        // Always return constant
        // This should cause every event is triggered only once (hashcode remains the same), so we can test this.
        // Never use this in production code
        return FileHash.fromLong(1L);
    }
}

Use FileHash because HashCode has been removed


package com.cldfire.xenforonotifier.util;

import java.awt.Image;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.TrayIcon.MessageType;

public class NotificationUtils {
    private static Image image = Toolkit.getDefaultToolkit().getImage(""); // TODO: Get this working
    private static TrayIcon trayIcon = new TrayIcon(image, "Spigot Notifier");

    public static void createNotification(String mainText, String message) { // TODO: Make sure this is thread-safe, use TrayNotification notifications for OS other than Windows
        if (SystemTray.isSupported()) {
            try {
                SystemTray.getSystemTray().add(trayIcon); // TODO: Prevent this from duplicating
            } catch (Exception e) {
                e.printStackTrace();
            }
            trayIcon.displayMessage(mainText, message, MessageType.NONE);
        }
    }

}

package com.cldfire.xenforonotifier.util;

import java.awt.Image;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.TrayIcon.MessageType;

public class NotificationUtils {
    private static Image image = Toolkit.getDefaultToolkit().getImage(""); // TODO: Get this working
    private static TrayIcon trayIcon = new TrayIcon(image, "XenForo Notifier");

    public static void createNotification(String mainText, String message) { // TODO: Make sure this is thread-safe, use TrayNotification notifications for OS other than Windows
        if (SystemTray.isSupported()) {
            if (!trayIconExists()) {
                try {
                    SystemTray.getSystemTray().add(trayIcon);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            trayIcon.displayMessage(mainText, message, MessageType.NONE);
        }
    }

    private static boolean trayIconExists() {
        for (TrayIcon _trayIcon : SystemTray.getSystemTray().getTrayIcons()) {
            if (trayIcon == _trayIcon) {
                return true;
            }
        }
        return false;
    }

}

Rename Spigot to XenForo and fix duplicating the TrayIcon


package io.github.lukehutch.fastclasspathscanner.classloaderhandler;

import io.github.lukehutch.fastclasspathscanner.classloaderhandler.ClassLoaderHandler;
import io.github.lukehutch.fastclasspathscanner.scanner.ClasspathFinder;
import io.github.lukehutch.fastclasspathscanner.utils.LogNode;
import io.github.lukehutch.fastclasspathscanner.utils.ReflectionUtils;

public class WebsphereTraditionalClassLoaderHandler implements ClassLoaderHandler {

    public boolean handle(ClassLoader classloader, ClasspathFinder classpathFinder, LogNode log) throws Exception {
        for (Class<?> c = classloader.getClass(); c != null; c = c.getSuperclass()) {
            if (!"com.ibm.ws.classloader.CompoundClassLoader".equals(c.getName())) {
                continue;
            }
            String classpath = (String) ReflectionUtils.invokeMethod(classloader, "getClassPath");
            return classpathFinder.addClasspathElements(classpath, classloader, log);
        }
        return false;
    }

}

/*
 * This file is part of FastClasspathScanner.
 *
 * Author: Sergey Bespalov
 *
 * Hosted at: https://github.com/lukehutch/fast-classpath-scanner
 *
 * --
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2017 Sergey Bespalov
 *
 * 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 io.github.lukehutch.fastclasspathscanner.classloaderhandler;

import io.github.lukehutch.fastclasspathscanner.scanner.ClasspathFinder;
import io.github.lukehutch.fastclasspathscanner.utils.LogNode;
import io.github.lukehutch.fastclasspathscanner.utils.ReflectionUtils;

public class WebsphereTraditionalClassLoaderHandler implements ClassLoaderHandler {

    @Override
    public boolean handle(final ClassLoader classloader, final ClasspathFinder classpathFinder, final LogNode log)
            throws Exception {
        for (Class<?> c = classloader.getClass(); c != null; c = c.getSuperclass()) {
            if (!"com.ibm.ws.classloader.CompoundClassLoader".equals(c.getName())) {
                continue;
            }
            final String classpath = (String) ReflectionUtils.invokeMethod(classloader, "getClassPath");
            return classpathFinder.addClasspathElements(classpath, classloader, log);
        }
        return false;
    }

}

Add copyright and license info