package com.marverenic.music.ui.settings;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.MenuItem;

import com.marverenic.music.R;
import com.marverenic.music.ui.BaseActivity;

public class SettingsActivity extends BaseActivity {

    public static Intent newIntent(Context context) {
        return new Intent(context, SettingsActivity.class);
    }

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);

        if (getSupportActionBar() != null
                && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getSupportActionBar()
                    .setElevation(getResources().getDimension(R.dimen.header_elevation));
        }

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.pref_fragment_container, new PreferenceFragment())
                    .commit();
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                if (!getSupportFragmentManager().popBackStackImmediate()) {
                    super.onOptionsItemSelected(item);
                }
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    @Override
    public void onBackPressed() {
        if (!getSupportFragmentManager().popBackStackImmediate()) {
            super.onBackPressed();
        }
    }
}

package com.marverenic.music.ui.settings;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.ActionBar;

import com.marverenic.music.R;
import com.marverenic.music.ui.BaseActivity;

public class SettingsActivity extends BaseActivity {

    public static Intent newIntent(Context context) {
        return new Intent(context, SettingsActivity.class);
    }

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);

        setSupportActionBar(findViewById(R.id.toolbar));
        ActionBar toolbar = getSupportActionBar();
        toolbar.setDisplayShowHomeEnabled(true);
        toolbar.setDisplayHomeAsUpEnabled(true);
        toolbar.setHomeButtonEnabled(true);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            toolbar.setElevation(getResources().getDimension(R.dimen.header_elevation));
        }

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.pref_fragment_container, new PreferenceFragment())
                    .commit();
        }
    }

    @Override
    public boolean onSupportNavigateUp() {
        if (!getSupportFragmentManager().popBackStackImmediate()) {
            finish();
        }
        return true;
    }

    @Override
    public void onBackPressed() {
        if (!getSupportFragmentManager().popBackStackImmediate()) {
            super.onBackPressed();
        }
    }
}

Fix missing up button on settings page


package org.ovirt.engine.core.bll.storage.repoimage;

import java.util.List;

import org.ovirt.engine.core.bll.QueriesCommandBase;
import org.ovirt.engine.core.bll.storage.domain.IsoDomainListSyncronizer;
import org.ovirt.engine.core.common.businessentities.storage.RepoImage;
import org.ovirt.engine.core.common.queries.GetImagesListParametersBase;
import org.ovirt.engine.core.compat.Guid;

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

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

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

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

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

package org.ovirt.engine.core.bll.storage.repoimage;

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

import org.ovirt.engine.core.bll.QueriesCommandBase;
import org.ovirt.engine.core.bll.storage.domain.IsoDomainListSyncronizer;
import org.ovirt.engine.core.common.businessentities.storage.RepoImage;
import org.ovirt.engine.core.common.queries.GetImagesListParametersBase;
import org.ovirt.engine.core.compat.Guid;

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

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

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

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

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

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

Fix ISO Domain List refresh NPE


/**
 *
 */
package org.corpus_tools.atomic.api.commands;

import org.corpus_tools.atomic.api.editors.DocumentGraphEditor;
import org.corpus_tools.salt.common.SDocumentGraph;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;

/**
 * TODO Description
 *
 * @author Stephan Druskat <mail@sdruskat.net>
 *
 */
public class DocumentGraphAwareHandler extends AbstractHandler {

	private final SDocumentGraph graph;

	/**
	 *
	 */
	public DocumentGraphAwareHandler() {
		IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
		if (editor instanceof DocumentGraphEditor) {
			graph = ((DocumentGraphEditor) editor).getGraph();
		}
		else {
			graph = null;
		}
	}

	/* (non-Javadoc)
	 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
	 */
	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * @return the graph
	 */
	public final SDocumentGraph getGraph() {
		return graph;
	}

}

/**
 *
 */
package org.corpus_tools.atomic.api.commands;

import org.corpus_tools.atomic.api.editors.DocumentGraphEditor;
import org.corpus_tools.salt.common.SDocumentGraph;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;

/**
 * TODO Description
 *
 * @author Stephan Druskat <mail@sdruskat.net>
 *
 */
public abstract class DocumentGraphAwareHandler extends AbstractHandler {

	private final SDocumentGraph graph;

	/**
	 *
	 */
	public DocumentGraphAwareHandler() {
		IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
		if (editor instanceof DocumentGraphEditor) {
			graph = ((DocumentGraphEditor) editor).getGraph();
		}
		else {
			graph = null;
		}
	}

	/**
	 * @return the graph
	 */
	public final SDocumentGraph getGraph() {
		return graph;
	}
}

Add API for handler that know the SDocumentGraph of the editor


package com.kiselev.reflection.ui.bytecode.agent;

import com.kiselev.reflection.ui.bytecode.holder.ByteCodeHolder;

import java.lang.instrument.Instrumentation;
import java.util.List;

/**
 * Created by Vadim Kiselev on 6/12/2017.
 */
public class Agent {

    public static void agentmain(String args, Instrumentation instrumentation) {
        try {
            instrumentation.addTransformer(new Transformer(), true);
            Class[] allLoadedClasses = instrumentation.getAllLoadedClasses();

            for (Class loadedClass : allLoadedClasses) {
                if (!loadedClass.isArray()) {
                    instrumentation.retransformClasses(loadedClass);
                }
            }

        } catch (Exception exception) {
            // sin
        }
    }
}

package com.kiselev.reflection.ui.bytecode.agent;

import java.lang.instrument.Instrumentation;

/**
 * Created by Vadim Kiselev on 6/12/2017.
 */
public class Agent {

    public static void agentmain(String args, Instrumentation instrumentation) {
        try {
            instrumentation.addTransformer(new Transformer(), true);
            Class[] allLoadedClasses = instrumentation.getAllLoadedClasses();

            for (Class loadedClass : allLoadedClasses) {
                if (!loadedClass.isArray()) {
                    instrumentation.retransformClasses(loadedClass);
                }
            }
        } catch (Exception exception) {
            // sin
        }
    }
}

Fix agent class after merging


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

/**
 * An OAuth Server provides the functionality required to deliver OAuth Provider
 * functionality. It can be exposed by wrapping it in an HTTP layer, e.g. that
 * provided by the Servlet Spec or perhaps directly exposed by a custom HTTP
 * server.
 *
 * @version $Id$
 */
public abstract class OAuthServer implements OAuthnServer, OAuthzServer {

	/**
	 * @return access storage
	 */
	protected abstract AccessStorage getAccessStorage();

	/**
	 * @return consumer storage
	 */
	protected abstract ConsumerStorage getConsumerStorage();

	/**
	 * @return token storage
	 */
	protected abstract TokenStorage getTokenStorage();

}

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

/**
 * An OAuth Server provides the functionality required to deliver OAuth Provider
 * functionality. It can be exposed by wrapping it in an HTTP layer, e.g. that
 * provided by the Servlet Spec or perhaps directly exposed by a custom HTTP
 * server.
 *
 * @version $Id$
 */
public abstract class OAuthServer implements OAuthnServer, OAuthzServer {

}

Revert previous commit adding storage methods


/*
 * 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.jmeter.testelement.property;

import java.util.Collection;
import java.util.Iterator;

public class PropertyIteratorImpl implements PropertyIterator {

    Iterator iter;

    public PropertyIteratorImpl(Collection value) {
        iter = value.iterator();
    }

    public PropertyIteratorImpl() {
    }

    public void setCollection(Collection value) {
        iter = value.iterator();
    }

    public boolean hasNext() {
        return iter.hasNext();
    }

    public JMeterProperty next() {
        return (JMeterProperty) iter.next();
    }

    /**
     * @see org.apache.jmeter.testelement.property.PropertyIterator#remove()
     */
    public void remove() {
        iter.remove();
    }

}

/*
 * 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.jmeter.testelement.property;

import java.util.Collection;
import java.util.Iterator;

public class PropertyIteratorImpl implements PropertyIterator {

    private final Iterator<JMeterProperty> iter;

    public PropertyIteratorImpl(Collection<JMeterProperty> value) {
        iter = value.iterator();
    }

    /** {@inheritDoc} */
    public boolean hasNext() {
        return iter.hasNext();
    }

    /** {@inheritDoc} */
    public JMeterProperty next() {
        return iter.next();
    }

    /** {@inheritDoc} */
    public void remove() {
        iter.remove();
    }

}

Tidy types Make class final and remove unused ctor/setter


package com.oneandone.snmpman;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.kohsuke.args4j.Option;

import java.io.File;

/** The command-line options for the {@link Snmpman} application. */
@Slf4j
public final class CommandLineOptions {

    /** The {@code Snmpman} configuration. */
    @Option(name = "-c", aliases = "--configuration", usage = "the path to the configuration XML", required = true)
    @Getter private File configurationFile;

    /** Flag that defines that a help message should be displayed when {@code true}. */
    @Option(name = "-h", aliases = "--help", usage = "print the help message", help = true)
    @Getter private boolean showHelp = false;
}

package com.oneandone.snmpman;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.kohsuke.args4j.Option;

import java.io.File;

/** The command-line options for the {@link Snmpman} application. */
@Slf4j
public final class CommandLineOptions {

    /** The {@code Snmpman} configuration. */
    @Option(name = "-c", aliases = "--configuration", usage = "the path to the configuration YAML", required = true)
    @Getter private File configurationFile;

    /** Flag that defines that a help message should be displayed when {@code true}. */
    @Option(name = "-h", aliases = "--help", usage = "print the help message", help = true)
    @Getter private boolean showHelp = false;
}

Fix typo -> config is YAML now


package org.callimachusproject.webdriver.pages;

import org.callimachusproject.webdriver.helpers.WebBrowserDriver;
import org.openqa.selenium.By;

public class DigestUserEdit extends CalliPage {

	public DigestUserEdit(WebBrowserDriver driver) {
		super(driver);
	}

	public FileUploadForm openPhotoUpload() {
		driver.click(By.cssSelector("#photo label.control-label a"));
		driver.waitForScript();
		driver.focusInFrame("photo");
		driver.waitForScript();
		final DigestUserEdit edit = this;
		return new FileUploadForm(driver) {
			@Override
			public DigestUserEdit uploadAs(String fileName) {
				driver.click(By.id("upload"));
				driver.focusInFrame("photo", "save-as___");
				driver.type(By.id("label"), fileName);
				driver.focusInFrame("photo");
				driver.click(By.xpath("(//button[@type='button'])[2]"));
				return edit;
			}
		};
	}

	public CalliPage save() {
		driver.click(By.id("save"));
		return page();
	}

}

package org.callimachusproject.webdriver.pages;

import org.callimachusproject.webdriver.helpers.WebBrowserDriver;
import org.openqa.selenium.By;

public class DigestUserEdit extends CalliPage {

	public DigestUserEdit(WebBrowserDriver driver) {
		super(driver);
	}

	public FileUploadForm openPhotoUpload() {
		driver.click(By.cssSelector("#photo label.control-label a"));
		driver.waitForScript();
		driver.focusInFrame("photo");
		driver.waitForScript();
		final DigestUserEdit edit = this;
		return new FileUploadForm(driver) {
			@Override
			public DigestUserEdit uploadAs(String fileName) {
				driver.click(By.id("upload"));
				driver.focusInFrame("photo", "save-as___");
				driver.type(By.id("label"), fileName);
				driver.focusInFrame("photo");
				driver.click(By.xpath("(//button[@type='button'])[2]"));
				return edit;
			}
		};
	}

	public CalliPage save() {
		driver.focusInTopWindow();
		driver.click(By.id("save"));
		return page();
	}

}

Switch focus back to top window


package roycurtis.signshopexport.json;

import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;

public class Exclusions implements ExclusionStrategy
{
    @Override
    public boolean shouldSkipField(FieldAttributes f)
    {
        String name = f.getName();

        return
            // Ignore dynamic CraftBukkit handle field
            name.equalsIgnoreCase("handle")
            // Ignore book page contents
            || name.equalsIgnoreCase("pages")
            // Ignore unsupported tags
            || name.equalsIgnoreCase("unhandledTags")
            // Ignore redundant data object
            || name.equalsIgnoreCase("data")
            // Ignore hide flags
            || name.equalsIgnoreCase("hideFlag")
            // Ignore shield patterns
            || name.equalsIgnoreCase("blockEntityTag");
    }

    @Override
    public boolean shouldSkipClass(Class<?> clazz)
    {
        String name = clazz.getSimpleName();

        if ( name.equalsIgnoreCase("ItemStack") )
        if ( clazz.getTypeName().startsWith("net.minecraft.server") )
            return true;

        return name.equalsIgnoreCase("ChatComponentText");
    }
}

package roycurtis.signshopexport.json;

import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;

public class Exclusions implements ExclusionStrategy
{
    @Override
    public boolean shouldSkipField(FieldAttributes f)
    {
        String name = f.getName();

        return
            // Ignore dynamic CraftBukkit handle field
            name.equalsIgnoreCase("handle")
            // Ignore book page contents
            || name.equalsIgnoreCase("pages")
            // Ignore unsupported tags
            || name.equalsIgnoreCase("unhandledTags")
            // Ignore redundant data object
            || name.equalsIgnoreCase("data")
            // Ignore hide flags
            || name.equalsIgnoreCase("hideFlag")
            // Ignore skull profiles
            || name.equalsIgnoreCase("profile")
            // Ignore shield patterns
            || name.equalsIgnoreCase("blockEntityTag");
    }

    @Override
    public boolean shouldSkipClass(Class<?> clazz)
    {
        String name = clazz.getSimpleName();

        if ( name.equalsIgnoreCase("ItemStack") )
        if ( clazz.getTypeName().startsWith("net.minecraft.server") )
            return true;

        return name.equalsIgnoreCase("ChatComponentText");
    }
}

Exclude skull profile tags from export


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

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

public class StreamUtils {

    private StreamUtils() {
    }

    public static void close(Closeable... closeables) {
        for (Closeable c : closeables) {
            try {
                c.close();
            } catch (IOException e) {
                // Ignore
            }
        }
    }

}

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

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

public class StreamUtils {

    private StreamUtils() {
    }

    public static void close(Closeable... closeables) {
        for (Closeable c : closeables) {
            try {
            	if (c != null) {
            		c.close();
            	}
            } catch (IOException e) {
                // Ignore
            }
        }
    }

}

Make sure StreamUtil.close also works for null


/*
 * Copyright 2002-2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://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.springframework.core.testfixture.aot.generator.visibility;

import org.springframework.core.ResolvableType;

public class PublicFactoryBean<T> {

	private final Class<T> type;

	public PublicFactoryBean(Class<T> type) {
		this.type = type;
	}

	public static PublicFactoryBean<ProtectedType> protectedTypeFactoryBean() {
		return new PublicFactoryBean<>(ProtectedType.class);
	}

	public static ResolvableType resolveToProtectedGenericParameter() {
		return ResolvableType.forClassWithGenerics(PublicFactoryBean.class, ProtectedType.class);
	}

}

/*
 * Copyright 2002-2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://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.springframework.core.testfixture.aot.generator.visibility;

import org.springframework.core.ResolvableType;

public class PublicFactoryBean<T> {

	PublicFactoryBean(Class<T> type) {
	}

	public static PublicFactoryBean<ProtectedType> protectedTypeFactoryBean() {
		return new PublicFactoryBean<>(ProtectedType.class);
	}

	public static ResolvableType resolveToProtectedGenericParameter() {
		return ResolvableType.forClassWithGenerics(PublicFactoryBean.class, ProtectedType.class);
	}

}

Clean up warnings in test fixture


package fr.synchrotron.soleil.ica.ci.lib.mongodb.domainobjects.project;

import fr.synchrotron.soleil.ica.ci.lib.mongodb.domainobjects.artifact.DeveloperDocument;

import java.util.List;

/**
 * @author Gregory Boissinot
 */
public class ProjectDocument {

    private String org;

    private String name;

    private List<DeveloperDocument> developers;

    private String description;

    private String scmConnection;

    private String language;

    public String getOrg() {
        return org;
    }

    public void setOrg(String org) {
        this.org = org;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<DeveloperDocument> getDevelopers() {
        return developers;
    }

    public void setDevelopers(List<DeveloperDocument> developers) {
        this.developers = developers;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getScmConnection() {
        return scmConnection;
    }

    public void setScmConnection(String scmConnection) {
        this.scmConnection = scmConnection;
    }

    public MavenProjectInfo getMaven() {
        return maven;
    }

    public void setMaven(MavenProjectInfo maven) {
        this.maven = maven;
    }
}

package fr.synchrotron.soleil.ica.ci.lib.mongodb.domainobjects.project;

import fr.synchrotron.soleil.ica.ci.lib.mongodb.domainobjects.artifact.DeveloperDocument;

import java.util.List;

/**
 * @author Gregory Boissinot
 */
public class ProjectDocument {

    private String org;

    private String name;

    private List<DeveloperDocument> developers;

    private String description;

    private String scmConnection;

    private String language;

    public String getOrg() {
        return org;
    }

    public void setOrg(String org) {
        this.org = org;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<DeveloperDocument> getDevelopers() {
        return developers;
    }

    public void setDevelopers(List<DeveloperDocument> developers) {
        this.developers = developers;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getScmConnection() {
        return scmConnection;
    }

    public void setScmConnection(String scmConnection) {
        this.scmConnection = scmConnection;
    }

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language;
    }
}

Change Elements from Import And Export


package com.nirima.jenkins.plugins.docker;

import hudson.slaves.OfflineCause;

/**
 * @author Kanstantsin Shautsou
 */
public class DockerOfflineCause extends OfflineCause {
    @Override
    public String toString() {
        return "Shutting down Docker";
    }
}

package com.nirima.jenkins.plugins.docker;

import hudson.slaves.OfflineCause;

/**
 * @author Kanstantsin Shautsou
 */
public class DockerOfflineCause extends OfflineCause {
    @Override
    public String toString() {
        return "Shutting down Docker container";
    }
}

Clarify the offline cause text.


package com.sandbox.runtime.js.serializers;

import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.script.ScriptEngine;
import javax.script.ScriptException;

/**
 * Created by nickhoughton on 16/07/2015.
 */
public class NashornSerializer {

    private static final Logger logger = LoggerFactory.getLogger(NashornSerializer.class);

    private ScriptObjectMirror jsonParser;

    public NashornSerializer(ScriptObjectMirror jsonParser) {
        this.jsonParser = jsonParser;
    }

    private static NashornSerializer instance = null;
    public static NashornSerializer instance(){
        if(instance == null){
            try {
                ScriptEngine engine = new NashornScriptEngineFactory().getScriptEngine(new String[]{"--no-java"});
                instance = new NashornSerializer((ScriptObjectMirror) engine.eval("JSON"));
            } catch (ScriptException e) {
                logger.error("Error starting nashorn serialiser!", e);
            }
        }
        return instance;
    }

    public String serialize(Object value){
        Object result = jsonParser.callMember("stringify", value, null, 2);
        return (String) result;
    }

}

package com.sandbox.runtime.js.serializers;

import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.script.ScriptEngine;
import javax.script.ScriptException;

/**
 * Created by nickhoughton on 16/07/2015.
 */
public class NashornSerializer {

    private static final Logger logger = LoggerFactory.getLogger(NashornSerializer.class);

    private ScriptObjectMirror jsonParser;

    public NashornSerializer(ScriptObjectMirror jsonParser) {
        this.jsonParser = jsonParser;
    }

    private static NashornSerializer instance = null;
    public static NashornSerializer instance(){
        if(instance == null){
            try {
                ScriptEngine engine = new NashornScriptEngineFactory().getScriptEngine(new String[]{"--no-java"});
                instance = new NashornSerializer((ScriptObjectMirror) engine.eval("JSON"));
            } catch (ScriptException e) {
                logger.error("Error starting nashorn serialiser!", e);
            }
        }
        return instance;
    }

    public String serialize(Object value){
        Object result = jsonParser.callMember("stringify", value, null, 2);
        if(!(result instanceof String)){
            result = "null";
            logger.warn("Serialized unsupported object, returning null..");
        }
        return (String) result;
    }

}

Return null for undefined values.


package org.webik.storm.StormUnit.trident.mock;

import java.util.LinkedList;
import java.util.List;

import storm.trident.operation.TridentCollector;

public class MockCollector implements TridentCollector{

	protected LinkedList<List<Object>> tuplesList = new LinkedList<List<Object>>();

	protected Throwable lastError = null;

	public void emit( List<Object> values ) {
		tuplesList.add( values );

	}

	public void reportError(Throwable t) {
		lastError = t;
	}

	public List<Object> getEmmitedTuple( int offset ){
		return tuplesList.get( offset );
	}

	public List<Object> getEmmitedTuple(){
		return tuplesList.getLast();
	}

	public boolean assertTuplesListSize( int expectedSize ){
		return tuplesList.size() == expectedSize;
	}

	public boolean assertTuple( List<Object> expectedTuple ){
		return getEmmitedTuple().equals( expectedTuple );
	}

	public boolean assertTuple( int offset, List<Object> expectedTuple ){
		return getEmmitedTuple(offset).equals( expectedTuple );
	}

	public boolean assertError(){
		return lastError != null;
	}

	public Throwable getLastError(){
		return lastError;
	}
}

package org.webik.storm.StormUnit.trident.mock;

import java.util.LinkedList;
import java.util.List;

import storm.trident.operation.TridentCollector;

public class MockCollector implements TridentCollector{

	protected LinkedList<List<Object>> tuplesList = new LinkedList<List<Object>>();

	protected Throwable lastError = null;

	public void emit( List<Object> values ) {
		tuplesList.add( values );

	}

	public void reportError(Throwable t) {
		lastError = t;
	}

	public List<Object> getEmmitedTuple( int offset ){
		if( tuplesList.isEmpty() ){
			return null;
		}

		return tuplesList.get( offset );
	}

	public List<Object> getEmmitedTuple(){

		if( tuplesList.isEmpty() ){
			return null;
		}

		return tuplesList.getLast();
	}

	public boolean assertTuplesListSize( int expectedSize ){
		return tuplesList.size() == expectedSize;
	}

	public boolean assertTuple( List<Object> expectedTuple ){
		List<Object> tuple = getEmmitedTuple();

		if( tuple == null ){
			return false;
		}

		return tuple.equals( expectedTuple );
	}

	public boolean assertTuple( int offset, List<Object> expectedTuple ){
		List<Object> tuple = getEmmitedTuple( offset );

		if( tuple == null ){
			return false;
		}

		return tuple.equals( expectedTuple );
	}

	public boolean assertError(){
		return lastError != null;
	}

	public Throwable getLastError(){
		return lastError;
	}
}

Check if tuple list is empty


/**
 * Copyright 2015 The OpenZipkin 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 io.zipkin.server;

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

import org.springframework.context.annotation.Import;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import({ ZipkinServerConfiguration.class })
public @interface EnableZipkinServer {

}

/**
 * Copyright 2015 The OpenZipkin 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 io.zipkin.server;

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

import org.springframework.context.annotation.Import;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import({ ZipkinServerConfiguration.class, ZipkinQueryApiV1.class })
public @interface EnableZipkinServer {

}

Add @RestController to default server config


/*
 * 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.test.infra.aws2.services;

public class AWSSQSLocalContainerService extends AWSLocalContainerService {

    public AWSSQSLocalContainerService() {
        super("localstack/localstack:0.12.5", Service.SQS);
    }
}

/*
 * 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.test.infra.aws2.services;

public class AWSSQSLocalContainerService extends AWSLocalContainerService {

    public AWSSQSLocalContainerService() {
        super("localstack/localstack:0.12.6", Service.SQS);
    }
}

Upgrade Localstack image to 0.12.6 for SQS too


package com.example.android.waitlist.data;

// TODO (1) extend the SQLiteOpenHelper class
public class WaitlistDbHelper {

    // TODO (2) Create a static final String called DATABASE_NAME and set it to "waitlist.db"

    // TODO (3) Create a static final int called DATABASE_VERSION and set it to 1

    // TODO (4) Create a Constructor that takes a context and calls the parent constructor

    // TODO (5) Override the onCreate method

        // TODO (6) Inside, create an String query called SQL_CREATE_WAITLIST_TABLE that will create the table

        // TODO (7) Execute the query by calling execSQL on sqLiteDatabase and pass the string query SQL_CREATE_WAITLIST_TABLE

    // TODO (8) Override the onUpgrade method

        // TODO (9) Inside, execute a drop table query, and then call onCreate to re-create it

}

package com.example.android.waitlist.data;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.example.android.waitlist.data.WaitlistContract.WaitlistEntry;

// TODO (1) extend the SQLiteOpenHelper class
public class WaitlistDbHelper extends SQLiteOpenHelper {

    public static final String DATABASE_NAME = "waitlist.db";

    public static final int DATABASE_VERSION = 1;

    public WaitlistDbHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String SQL_CREATE_WAITLIST_TABLE= "CREATE TABLE " +
                WaitlistEntry.TABLE_NAME + "(" +
                WaitlistEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
                WaitlistEntry.COLUMN_GUEST_NAME + " TEXT NOT NULL, " +
                WaitlistEntry.COLUMN_PARTY_SIZE + " INTEGER NOT NULL, " +
                WaitlistEntry.COLUMN_TIMESTAMP + " TIMESTAMP DEFAULT CURRENT_TIMESTAMP)";
        db.execSQL(SQL_CREATE_WAITLIST_TABLE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS " + WaitlistEntry.TABLE_NAME);
        onCreate(db);
    }

    // TODO (2) Create a static final String called DATABASE_NAME and set it to "waitlist.db"

    // TODO (3) Create a static final int called DATABASE_VERSION and set it to 1

    // TODO (4) Create a Constructor that takes a context and calls the parent constructor

    // TODO (5) Override the onCreate method

        // TODO (6) Inside, create an String query called SQL_CREATE_WAITLIST_TABLE that will create the table

        // TODO (7) Execute the query by calling execSQL on sqLiteDatabase and pass the string query SQL_CREATE_WAITLIST_TABLE

    // TODO (8) Override the onUpgrade method

        // TODO (9) Inside, execute a drop table query, and then call onCreate to re-create it

}

Complete TODOs for T07.02 CreateTheDatabase exercise


package org.ethereum.config.net;

import org.ethereum.config.blockchain.MordenConfig;

/**
 * Created by Anton Nashatyrev on 25.02.2016.
 */
public class MordenNetConfig extends AbstractNetConfig {
    public MordenNetConfig() {
        add(0, new MordenConfig.Frontier());
        add(494_000, new MordenConfig.Homestead());
    }
}

package org.ethereum.config.net;

import org.apache.commons.lang3.tuple.Pair;
import org.ethereum.config.blockchain.Eip150HFConfig;
import org.ethereum.config.blockchain.MordenConfig;
import org.spongycastle.util.encoders.Hex;

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

/**
 * Created by Anton Nashatyrev on 25.02.2016.
 */
public class MordenNetConfig extends AbstractNetConfig {
    private static final long EIP150_HF_BLOCK = 1_783_000;
    private static final byte[] EIP150_HF_BLOCK_HASH =
            Hex.decode("f376243aeff1f256d970714c3de9fd78fa4e63cf63e32a51fe1169e375d98145");

    public MordenNetConfig() {
        add(0, new MordenConfig.Frontier());
        add(494_000, new MordenConfig.Homestead());
        add(EIP150_HF_BLOCK, new Eip150HFConfig(new MordenConfig.Homestead()) {
            @Override
            public List<Pair<Long, byte[]>> blockHashConstraints() {
                return Collections.singletonList(Pair.of(EIP150_HF_BLOCK, EIP150_HF_BLOCK_HASH));
            }
        });
    }
}

Update for Morden EIP150 HF


package com.hjcubed.mysterytetris;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.ui.activity.SimpleBaseGameActivity;

import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Menu;

public class MainGameActivity extends SimpleBaseGameActivity {
	Camera camera;
	Scene scene;

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

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

	@Override
	public EngineOptions onCreateEngineOptions() {
		DisplayMetrics metrics = getResources().getDisplayMetrics();
		int width  = metrics.widthPixels;
		int height = metrics.heightPixels;
		camera = new Camera(0, 0, width, height);

		return new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED,
		new RatioResolutionPolicy(width, height), camera);
	}

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

	}

	@Override
	protected Scene onCreateScene() {
		scene = new Scene();
		scene.setBackground(new Background(0,0,0));
		return scene;
	}

}

package com.hjcubed.mysterytetris;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.ui.activity.SimpleBaseGameActivity;

import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Menu;

public class MainGameActivity extends SimpleBaseGameActivity {
	Camera camera;
	Scene scene;

	@Override
	public EngineOptions onCreateEngineOptions() {
		DisplayMetrics metrics = getResources().getDisplayMetrics();
		int width  = metrics.widthPixels;
		int height = metrics.heightPixels;
		camera = new Camera(0, 0, width, height);

		return new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED,
		new RatioResolutionPolicy(width, height), camera);
	}

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

	}

	@Override
	protected Scene onCreateScene() {
		scene = new Scene();
		scene.setBackground(new Background(0,0,0));
		return scene;
	}

}

Create a scene with black background


/*
 *  Copyright (c) 2012 Malhar, Inc.
 *  All Rights Reserved.
 */
package com.malhartech.bufferserver;

import com.malhartech.bufferserver.util.SerializedData;
import org.jboss.netty.channel.Channel;

/**
 *
 * @author chetan
 */
public class PhysicalNode
{
  private final long starttime;
  private final Channel channel;
  private long processedMessageCount;

  public PhysicalNode(Channel channel)
  {
    this.channel = channel;
    starttime = System.currentTimeMillis();
    processedMessageCount = 0;
  }

  public long getstartTime()
  {
    return starttime;
  }

  public long getUptime()
  {
    return System.currentTimeMillis() - starttime;
  }

  public void send(SerializedData d)
  {
    getChannel().write(d);
    processedMessageCount++;
  }

  public final long getProcessedMessageCount()
  {
    return processedMessageCount;
  }

  @Override
  public boolean equals(Object o)
  {
    return o.hashCode() == this.hashCode();
  }

  public final int getId()
  {
    return getChannel().getId();
  }

  @Override
  public final int hashCode()
  {
    return getChannel().getId();
  }

  /**
   * @return the channel
   */
  public Channel getChannel()
  {
    return channel;
  }
}

/*
 *  Copyright (c) 2012 Malhar, Inc.
 *  All Rights Reserved.
 */
package com.malhartech.bufferserver;

import com.malhartech.bufferserver.util.SerializedData;
import org.jboss.netty.channel.Channel;

/**
 *
 * @author chetan
 */
public class PhysicalNode
{
  private final long starttime;
  private final Channel channel;
  private long processedMessageCount;

  public PhysicalNode(Channel channel)
  {
    this.channel = channel;
    starttime = System.currentTimeMillis();
    processedMessageCount = 0;
  }

  public long getstartTime()
  {
    return starttime;
  }

  public long getUptime()
  {
    return System.currentTimeMillis() - starttime;
  }

  public void send(SerializedData d)
  {
    getChannel().write(d);
    processedMessageCount++;
  }

  public final long getProcessedMessageCount()
  {
    return processedMessageCount;
  }

  @Override
  public boolean equals(Object o)
  {
    return o == this
           || o.getClass() == this.getClass() && o.hashCode() == this.hashCode();
  }

  public final int getId()
  {
    return getChannel().getId();
  }

  @Override
  public final int hashCode()
  {
    return getChannel().getId();
  }

  /**
   * @return the channel
   */
  public Channel getChannel()
  {
    return channel;
  }
}

Optimize and Properly implement equals method.


/*
 * Directory Entry Filler Implementation Class of JSFSFillDir for JSyndicateFS
 */
package JSyndicateFS;

import JSyndicateFSJNI.struct.JSFSFillDir;
import JSyndicateFSJNI.struct.JSFSStat;
import java.util.ArrayList;

/**
 *
 * @author iychoi
 */
public class DirFillerImpl extends JSFSFillDir {

    private ArrayList<String> entries = new ArrayList<String>();

    DirFillerImpl() {

    }

    @Override
    public void fill(String name, JSFSStat stbuf, long off) {
        entries.add(name);
    }

    public String[] getEntryNames() {
        String[] arr = new String[this.entries.size()];
        arr = entries.toArray(arr);
        return arr;
    }
}

/*
 * Directory Entry Filler Implementation Class of JSFSFillDir for JSyndicateFS
 */
package JSyndicateFS;

import JSyndicateFSJNI.struct.JSFSFillDir;
import JSyndicateFSJNI.struct.JSFSStat;
import java.util.ArrayList;

/**
 *
 * @author iychoi
 */
public class DirFillerImpl extends JSFSFillDir {

    private static final String[] SKIP_FILES = {".", ".."};

    private ArrayList<String> entries = new ArrayList<String>();

    DirFillerImpl() {

    }

    @Override
    public void fill(String name, JSFSStat stbuf, long off) {
        boolean skip = false;
        for(String skip_file : SKIP_FILES) {
            if(name.equals(skip_file)) {
                skip = true;
            }
        }

        if(!skip) {
            entries.add(name);
        }
    }

    public String[] getEntryNames() {
        String[] arr = new String[this.entries.size()];
        arr = entries.toArray(arr);
        return arr;
    }
}

Remove . and .. dirs from list result


package me.rkfg.xmpp.bot.plugins;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import me.rkfg.xmpp.bot.Main;

import org.jivesoftware.smack.packet.Message;

public class StdinPlugin implements MessagePlugin {

    @Override
    public Pattern getPattern() {
        return null;
    }

    @Override
    public String process(Message message, Matcher matcher) {
        return null;
    }

    @Override
    public void init() {
        new Thread(new Runnable() {

            @Override
            public void run() {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
                while (!Thread.interrupted()) {
                    try {
                        String line = bufferedReader.readLine();
                        Main.sendMUCMessage(line);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }, "Stdin handler").start();
    }

    @Override
    public String getManual() {
        return null;
    }

}

package me.rkfg.xmpp.bot.plugins;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import me.rkfg.xmpp.bot.Main;

import org.jivesoftware.smack.packet.Message;

public class StdinPlugin implements MessagePlugin {

    @Override
    public Pattern getPattern() {
        return null;
    }

    @Override
    public String process(Message message, Matcher matcher) {
        return null;
    }

    @Override
    public void init() {
        new Thread(new Runnable() {

            @Override
            public void run() {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
                while (!Thread.interrupted()) {
                    try {
                        String line = bufferedReader.readLine();
                        if (line == null) {
                            // stdin is not connected
                            break;
                        }
                        Main.sendMUCMessage(line);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }, "Stdin handler").start();
    }

    @Override
    public String getManual() {
        return null;
    }

}

Stop the stdin thread if stdin get detached or not connected.


package com.sdsmdg.kd.trianglify.models;

import android.graphics.Point;

public class Triangle {
    public Point a;
    public Point b;
    public Point c;

    public Triangle (Point a, Point b, Point c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    private boolean isClockwise (Point p1, Point p2, Point p3) {
        return (p1.x - p3.x) * (p2.y - p3.y) - (p1.y - p3.y) * (p2.x - p3.x) < 0f;
    }

    public boolean contains (Point p) {
        return isClockwise(p, a, b) == isClockwise(p, b, c) == isClockwise(p, c, a);
    }
}

package com.sdsmdg.kd.trianglify.models;

import android.graphics.Point;

public class Triangle {
    public Point a;
    public Point b;
    public Point c;

    public Triangle (Point a, Point b, Point c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    private boolean isClockwise (Point p1, Point p2, Point p3) {
        return (p1.x - p3.x) * (p2.y - p3.y) - (p1.y - p3.y) * (p2.x - p3.x) < 0;
    }

    public boolean contains (Point p) {
        return isClockwise(p, a, b) == isClockwise(p, b, c) == isClockwise(p, c, a);
    }

    public boolean isInCircumcircle (Point p) {
        int d11 = a.x - p.x;
        int d21 = b.x - p.x;
        int d31 = c.x - p.x;

        int d12 = a.y - p.y;
        int d22 = b.y - p.y;
        int d32 = c.y - p.y;

        int d13 = d11 * d11 + d12 * d12;
        int d23 = d21 * d21 + d22 * d22;
        int d33 = d31 * d31 + d32 * d32;

        int determinant = d11 * (d22 * d33 - d32 * d23)
                        - d12 * (d21 * d33 - d31 * d23)
                        + d13 * (d21 * d32 - d31 * d22);

        return isClockwise(a, b, c) ? determinant < 0 : determinant > 0;
    }
}

Add a method to check if point is in circumcircle of triangle.


package com.tinkerpop.gremlin.driver;

import com.tinkerpop.gremlin.driver.message.ResponseMessage;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public class ResultSet implements Iterable<Item> {
    private final ResponseQueue responseQueue;

    public ResultSet(final ResponseQueue responseQueue) {
        this.responseQueue = responseQueue;
    }

    public boolean isFullyFetched() {
        return responseQueue.getStatus() == ResponseQueue.Status.COMPLETE;
    }

    public CompletableFuture<List<Item>> all() {
        return CompletableFuture.supplyAsync(() -> {
            final List<Item> list = new ArrayList<>();
            while (!isFullyFetched() || responseQueue.size() > 0) {
                final ResponseMessage msg = responseQueue.poll();
                if (msg != null)
                    list.add(new Item(msg.getResult()));
            }
            return list;
        });
    }

    @Override
    public Iterator<Item> iterator() {
        return new Iterator<Item>() {
            private Item current = null;

            @Override
            public boolean hasNext() {
                final ResponseMessage msg = responseQueue.poll();
                if (null == msg)
                    return false;

                // todo: wait??

                this.current = new Item(msg.getResult());
                return true;
            }

            @Override
            public Item next() {
                return current;
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
}

package com.tinkerpop.gremlin.driver;

import com.tinkerpop.gremlin.driver.message.ResponseMessage;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public class ResultSet implements Iterable<Item> {
    private final ResponseQueue responseQueue;

    public ResultSet(final ResponseQueue responseQueue) {
        this.responseQueue = responseQueue;
    }

    public boolean isFullyFetched() {
        return responseQueue.getStatus() == ResponseQueue.Status.COMPLETE;
    }

    public int fetchedCount() {
        return responseQueue.size();
    }

    public CompletableFuture<List<Item>> all() {
        return CompletableFuture.supplyAsync(() -> {
            final List<Item> list = new ArrayList<>();
            while (!isFullyFetched() || fetchedCount() > 0) {
                final ResponseMessage msg = responseQueue.poll();
                if (msg != null)
                    list.add(new Item(msg.getResult()));
            }
            return list;
        });
    }

    @Override
    public Iterator<Item> iterator() {
        return new Iterator<Item>() {
            private Item current = null;

            @Override
            public boolean hasNext() {
                final ResponseMessage msg = responseQueue.poll();
                if (null == msg)
                    return false;

                // todo: wait??

                this.current = new Item(msg.getResult());
                return true;
            }

            @Override
            public Item next() {
                return current;
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
}

Add method to get current number of fetched items.


package com.andela.notelib.mapper;

import static org.junit.Assert.*;

/**
 * Created by andela on 2/13/16.
 */
public class NoteMapperTest {

    @org.junit.Before
    public void setUp() throws Exception {

    }

    @org.junit.After
    public void tearDown() throws Exception {

    }

    @org.junit.Test
    public void testReadNote() throws Exception {

    }

    @org.junit.Test
    public void testWriteNote() throws Exception {

    }
}

package com.andela.notelib.mapper;

import android.test.ApplicationTestCase;

import com.andela.notelib.note.PaperNote;

import junit.framework.TestCase;

/**
 * Created by andela on 2/13/16.
 */
public class NoteMapperTest extends TestCase {

    PaperNote paperNote;
    NoteMapper<PaperNote> noteMapper;

    @Override
    protected void setUp() throws Exception {
        paperNote = new PaperNote("Everybody","Beautiful people", "Arial", 23, 0);
        noteMapper = new NoteMapper<>();
        super.setUp();
    }

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

    public void testReadNote() throws Exception {
        String strPaper = noteMapper.readNote(paperNote);
        assertNotNull(strPaper);
    }

    public void testWriteNote() throws Exception {
        String strPaper = noteMapper.readNote(paperNote);
        PaperNote newPaperNote = noteMapper.writeNote(strPaper, PaperNote.class);
        assertEquals(newPaperNote.getNote(), paperNote.getNote());
    }

}

Write Test to fail NoteMapper class


package org.kumoricon.site.report.attendees;

import com.vaadin.navigator.View;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import org.kumoricon.site.report.ReportView;
import org.kumoricon.site.BaseView;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;

@ViewScope
@SpringView(name = AttendeeReportView.VIEW_NAME)
public class AttendeeReportView extends BaseView implements View, ReportView {
    public static final String VIEW_NAME = "attendeeReport";
    public static final String REQUIRED_RIGHT = "view_attendee_report";
    @Autowired
    private AttendeeReportPresenter handler;

    private Button refresh = new Button("Refresh");
    private Label data = new Label();

    @PostConstruct
    public void init() {
        addComponent(refresh);
        refresh.addClickListener((Button.ClickListener) clickEvent -> handler.fetchReportData(this));
        addComponent(data);
        data.setContentMode(ContentMode.HTML);
        handler.fetchReportData(this);
        setExpandRatio(data, 1f);
        data.setSizeFull();
        data.setWidthUndefined();
    }

    @Override
    public void afterSuccessfulFetch(String data) {
        this.data.setValue(data);
    }

    public String getRequiredRight() {
        return REQUIRED_RIGHT;
    }
}

package org.kumoricon.site.report.attendees;

import com.vaadin.navigator.View;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import org.kumoricon.site.report.ReportView;
import org.kumoricon.site.BaseView;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;

@ViewScope
@SpringView(name = AttendeeReportView.VIEW_NAME)
public class AttendeeReportView extends BaseView implements View, ReportView {
    public static final String VIEW_NAME = "attendeeReport";
    public static final String REQUIRED_RIGHT = "view_attendance_report";
    @Autowired
    private AttendeeReportPresenter handler;

    private Button refresh = new Button("Refresh");
    private Label data = new Label();

    @PostConstruct
    public void init() {
        addComponent(refresh);
        refresh.addClickListener((Button.ClickListener) clickEvent -> handler.fetchReportData(this));
        addComponent(data);
        data.setContentMode(ContentMode.HTML);
        handler.fetchReportData(this);
        setExpandRatio(data, 1f);
        data.setSizeFull();
        data.setWidthUndefined();
    }

    @Override
    public void afterSuccessfulFetch(String data) {
        this.data.setValue(data);
    }

    public String getRequiredRight() {
        return REQUIRED_RIGHT;
    }
}

Make attendance report verify the correct right.


package uk.org.mygrid.cagrid.servicewrapper.service.ncbiblast.invoker;

import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.InvokerException;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.ncbiblast.NCBIBlastInvoker;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.ncbiblast.NCBIBlastInvokerImpl;

public class InvokerFactory {
	private static NCBIBlastInvoker invoker;

	public static NCBIBlastInvoker getInvoker() {
		if (invoker == null) {
			synchronized (InvokerFactory.class) {
				if (invoker == null) {
					//invoker = new DummyNCBIBlastInvoker();
					try {
						invoker = new NCBIBlastInvokerImpl();
					} catch (InvokerException e) {
						throw new RuntimeException("Can't instantiate NCBIBlast invoker", e);
					}
				}
			}
		}
		return invoker;
	}
}

package uk.org.mygrid.cagrid.servicewrapper.service.ncbiblast.invoker;

import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.InvokerException;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.ncbiblast.DummyNCBIBlastInvoker;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.ncbiblast.NCBIBlastInvoker;
import uk.org.mygrid.cagrid.servicewrapper.serviceinvoker.ncbiblast.NCBIBlastInvokerImpl;

public class InvokerFactory {
	private static NCBIBlastInvoker invoker;

	public static NCBIBlastInvoker getInvoker() {
		if (invoker == null) {
			synchronized (InvokerFactory.class) {
				if (invoker == null) {
//					invoker = new DummyNCBIBlastInvoker();
					try {
						invoker = new NCBIBlastInvokerImpl();
					} catch (InvokerException e) {
						throw new RuntimeException("Can't instantiate NCBIBlast invoker", e);
					}
				}
			}
		}
		return invoker;
	}
}

Use real invoker by default


package net.squanchy.contest;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import net.squanchy.R;
import net.squanchy.support.debug.DebugPreferences;

import io.reactivex.android.schedulers.AndroidSchedulers;

class ContestTester {

    private final Activity activity;
    private final DebugPreferences debugPreferences;

    ContestTester(Activity activity) {
        this.activity = activity;
        this.debugPreferences = new DebugPreferences(this.activity);
    }

    boolean testingEnabled() {
        return debugPreferences.contestTestingEnabled();
    }

    void appendDebugControls(ViewGroup viewGroup, ContestService contestService) {
        LayoutInflater factory = LayoutInflater.from(activity);
        View controlsContainer = factory.inflate(R.layout.view_contest_tester, viewGroup, false);
        viewGroup.addView(controlsContainer);

        controlsContainer.findViewById(R.id.contest_testing_add_one)
                .setOnClickListener(view -> unlockRandomAchievement(contestService));
    }

    private void unlockRandomAchievement(ContestService contestService) {
        contestService.addAchievement(String.valueOf(Math.random() * Integer.MAX_VALUE))
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe();
    }
}

package net.squanchy.contest;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.Random;

import net.squanchy.R;
import net.squanchy.support.debug.DebugPreferences;

import io.reactivex.android.schedulers.AndroidSchedulers;

class ContestTester {

    private static final int MAX_ACHIEVEMENT_ID = Integer.MAX_VALUE;

    private final Activity activity;
    private final DebugPreferences debugPreferences;
    private final Random random;

    ContestTester(Activity activity) {
        this.activity = activity;
        this.debugPreferences = new DebugPreferences(this.activity);
        this.random = new Random();
    }

    boolean testingEnabled() {
        return debugPreferences.contestTestingEnabled();
    }

    void appendDebugControls(ViewGroup viewGroup, ContestService contestService) {
        LayoutInflater factory = LayoutInflater.from(activity);
        View controlsContainer = factory.inflate(R.layout.view_contest_tester, viewGroup, false);
        viewGroup.addView(controlsContainer);

        controlsContainer.findViewById(R.id.contest_testing_add_one)
                .setOnClickListener(view -> unlockRandomAchievement(contestService));
    }

    private void unlockRandomAchievement(ContestService contestService) {
        contestService.addAchievement(generateRandomAchievementId())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe();
    }

    private String generateRandomAchievementId() {
        return String.valueOf(random.nextInt(MAX_ACHIEVEMENT_ID));
    }
}

Fix issues in achievement ID generation


package com.blocksolid.okrello.display;

import java.util.regex.Matcher;

/**
 * Created by Dan Buckland on 02/12/2015.
 */
public class Scores {
    public String extractScoreFromString(String string) {
        return "";
    }
}

package com.blocksolid.okrello.display;

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

/**
 * Created by Dan Buckland on 02/12/2015.
 */
public class Scores {
    public String extractScoreFromString(String string) {
        Pattern pattern = Pattern.compile("\\[(\\d{1}\\.\\d{1})\\]");
        Matcher m = pattern.matcher(string);
        if (m.find()) {
            return m.group(1);
        } else {
            return "";
        }
    }
}

Use basic regex matcher to capture and return a string in the format "d.d"


package zero.zd.zquestionnaire;

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

import java.io.File;

public class MainActivity extends AppCompatActivity {

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

        // create a folder
        File folder = new File(Environment.getExternalStorageDirectory().getPath() + "/ZQuestionnaire/");
        if (!folder.exists()) folder.mkdirs();
    }

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

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

}

package zero.zd.zquestionnaire;

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

import java.io.File;

public class MainActivity extends AppCompatActivity {

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

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

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

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

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

}

Add Logs on Filed Creation of Folders


package net.minecraftforge.common;

import net.minecraft.src.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;

public class ForgeInternalHandler
{
    @ForgeSubscribe(priority = EventPriority.HIGHEST)
    public void onEntityJoinWorld(EntityJoinWorldEvent event)
    {
        Entity entity = event.entity;
        if (entity instanceof EntityItem)
        {
            ItemStack item = ((EntityItem)entity).item;
            if (item.getItem().hasCustomEntity(item))
            {
                Entity newEntity = item.getItem().createEntity(event.world, entity, item);
                if (newEntity != null)
                {
                    entity.setDead();
                    event.setCanceled(true);
                    event.world.spawnEntityInWorld(entity);
                }
            }
        }
    }
}

package net.minecraftforge.common;

import net.minecraft.src.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;

public class ForgeInternalHandler
{
    @ForgeSubscribe(priority = EventPriority.HIGHEST)
    public void onEntityJoinWorld(EntityJoinWorldEvent event)
    {
        Entity entity = event.entity;
        if (entity instanceof EntityItem)
        {
            ItemStack item = ((EntityItem)entity).item;
            if (item.getItem().hasCustomEntity(item))
            {
                Entity newEntity = item.getItem().createEntity(event.world, entity, item);
                if (newEntity != null)
                {
                    entity.setDead();
                    event.setCanceled(true);
                    event.world.spawnEntityInWorld(newEntity);
                }
            }
        }
    }
}

Fix recursion issue with new special item entity code.


package rod;

@SuppressWarnings("serial")
public class UnrecognizableObservationException extends Exception {

    public UnrecognizableObservationException(Observation observation) {
        super("Observation of ckass " + observation.getClass() + " is not recognizable by analyzer");
    }

}

package rod;

@SuppressWarnings("serial")
public class UnrecognizableObservationException extends Exception {

    public UnrecognizableObservationException(Observation observation) {
        super("Observation of class " + observation.getClass() + " is not recognizable by analyzer");
    }

}

Fix typo in exception message


/**
 * Copyright (c) Codice Foundation
 *
 * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
 * General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or 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
 * Lesser General Public License for more details. A copy of the GNU Lesser General Public License
 * is distributed along with this program and can be found at
 * <http://www.gnu.org/licenses/lgpl.html>.
 *
 **/
package org.codice.nitf.filereader;

public enum NitfSecurityClassification
{
    UNKNOWN (""),
    UNCLASSIFIED ("U"),
    RESTRICTED ("R"),
    CONFIDENTIAL ("C"),
    SECRET ("S"),
    TOP_SECRET ("T");

    private final String textEquivalent;
    NitfSecurityClassification(String abbreviation) {
        this.textEquivalent = abbreviation;
    }
    static public NitfSecurityClassification getEnumValue(String textEquivalent) {
        for (NitfSecurityClassification classification : values()) {
            if (textEquivalent.equals(classification.textEquivalent)) {
                return classification;
            }
        }
        return UNKNOWN;
    }
};

/**
 * Copyright (c) Codice Foundation
 *
 * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
 * General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or 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
 * Lesser General Public License for more details. A copy of the GNU Lesser General Public License
 * is distributed along with this program and can be found at
 * <http://www.gnu.org/licenses/lgpl.html>.
 *
 **/
package org.codice.nitf.filereader;

public enum NitfSecurityClassification
{
    UNKNOWN (""),
    UNCLASSIFIED ("U"),
    RESTRICTED ("R"),
    CONFIDENTIAL ("C"),
    SECRET ("S"),
    TOP_SECRET ("T");

    private final String textEquivalent;
    NitfSecurityClassification(String abbreviation) {
        this.textEquivalent = abbreviation;
    }
    static public NitfSecurityClassification getEnumValue(String textEquivalent) {
        for (NitfSecurityClassification classification : values()) {
            if (textEquivalent.equals(classification.textEquivalent)) {
                return classification;
            }
        }
        return UNKNOWN;
    }
    public String getTextEquivalent() {
        return textEquivalent;
    }
};

Add an accessor for the SecurityClassification enum.


/*
 * 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.cassandra.distributed.test;

import org.junit.Test;

import org.apache.cassandra.distributed.Cluster;

import static org.junit.Assert.assertEquals;

public class NodeToolTest extends DistributedTestBase
{
    @Test
    public void test() throws Throwable
    {
        try (Cluster cluster = init(Cluster.create(1)))
        {
            assertEquals(0, cluster.get(1).nodetool("help"));
            assertEquals(1, cluster.get(1).nodetool("not_a_legal_command"));
        }
    }
}

/*
 * 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.cassandra.distributed.test;

import org.junit.Test;

import org.apache.cassandra.distributed.Cluster;

import static org.junit.Assert.assertEquals;

public class NodeToolTest extends DistributedTestBase
{
    @Test
    public void test() throws Throwable
    {
        try (Cluster cluster = init(Cluster.create(1)))
        {
            assertEquals(0, cluster.get(1).nodetool("help"));
            assertEquals(0, cluster.get(1).nodetool("flush"));
            assertEquals(1, cluster.get(1).nodetool("not_a_legal_command"));
        }
    }
}

Add a test for a "real" nodetool command, not only "help"


package org.cbioportal.web.parameter;

import java.io.Serializable;
import java.util.List;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

public class PageSettingsIdentifier implements Serializable {

    @NotNull
    private SessionPage page;
    @Size(min = 1, max = PagingConstants.MAX_PAGE_SIZE)
    List<String> origin;

    public SessionPage getPage() {
        return page;
    }

    public void setPage(SessionPage page) {
        this.page = page;
    }

    public List<String> getOrigin() {
        return origin;
    }

    public void setOrigin(List<String> origin) {
        this.origin = origin;
    }

}

package org.cbioportal.web.parameter;

import java.io.Serializable;
import java.util.Set;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

public class PageSettingsIdentifier implements Serializable {

    @NotNull
    private SessionPage page;
    @Size(min = 1, max = PagingConstants.MAX_PAGE_SIZE)
    // type of it should be similar to PageSettingsData -> origin
    Set<String> origin;

    public SessionPage getPage() {
        return page;
    }

    public void setPage(SessionPage page) {
        this.page = page;
    }

    public Set<String> getOrigin() {
        return origin;
    }

    public void setOrigin(Set<String> origin) {
        this.origin = origin;
    }

}

Fix error in fetching user settings for mutiple studies


/**
 * Copyright 2015 LinkedIn Corp. 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.
 */
package wherehows.models.view;

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

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class DatasetExportPolicy {
  private boolean containsUserGeneratedContent;

  private boolean containsUserActionGeneratedContent;

  private boolean containsUserDerivedContent;
}

/**
 * Copyright 2015 LinkedIn Corp. 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.
 */
package wherehows.models.view;

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

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class DatasetExportPolicy {
  private boolean containsUserGeneratedContent;

  private boolean containsUserActionGeneratedContent;

  private boolean containsUserDerivedContent;

  private String modifiedBy;

  private Long modifiedTime;
}

Add actor and modified time to export policy class


package com.ryanharter.auto.value.parcel;

import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;

public final class TypeSimplifier {

  private TypeSimplifier() {
  }

  static boolean isClassOfType(Types typeUtils, TypeMirror type, TypeMirror cls) {
    return type != null && typeUtils.isAssignable(cls, type);
  }

  static TypeMirror typeFromClass(Types types, Elements elements, Class<?> cls) {
    if (cls == void.class) {
      return types.getNoType(TypeKind.VOID);
    } else if (cls.isPrimitive()) {
      String primitiveName = cls.getName().toUpperCase();
      TypeKind primitiveKind = TypeKind.valueOf(primitiveName);
      return types.getPrimitiveType(primitiveKind);
    } else if (cls.isArray()) {
      TypeMirror componentType = typeFromClass(types, elements, cls.getComponentType());
      return types.getArrayType(componentType);
    } else {
      TypeElement element = elements.getTypeElement(cls.getCanonicalName());
      if (element == null) {
        throw new IllegalArgumentException("Unknown type: " + cls.getCanonicalName());
      }
      return element.asType();
    }
  }

}

package com.ryanharter.auto.value.parcel;

import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Types;

final class TypeSimplifier {

  private TypeSimplifier() {
  }

  static boolean isClassOfType(Types typeUtils, TypeMirror type, TypeMirror cls) {
    return type != null && typeUtils.isAssignable(cls, type);
  }
}

Remove unused code. Reduce util class visibility.


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

package net.openhft.chronicle.wire;

/**
 * Created by peter on 16/03/16.
 */
public abstract class AbstractMarshallable implements Marshallable {
    @Override
    public boolean equals(Object o) {
        return Marshallable.$equals(this, o);
    }

    @Override
    public int hashCode() {
        assert false;
        return Marshallable.$hashCode(this);
    }

    @Override
    public String toString() {
        return Marshallable.$toString(this);
    }
}

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

package net.openhft.chronicle.wire;

/**
 * Created by peter on 16/03/16.
 */
public abstract class AbstractMarshallable implements Marshallable {
    @Override
    public boolean equals(Object o) {
        return Marshallable.$equals(this, o);
    }

    @Override
    public int hashCode() {
        return Marshallable.$hashCode(this);
    }

    @Override
    public String toString() {
        return Marshallable.$toString(this);
    }
}

Add a custom hashCode and equals for performance.


package com.tmitim.twittercli.commands;

import com.github.rvesse.airline.annotations.Command;
import com.github.rvesse.airline.annotations.Option;
import com.tmitim.twittercli.TimeLiner;
import com.tmitim.twittercli.pojos.TimeLine;

import twitter4j.TwitterFactory;

/**
 * Get timeline
 */
@Command(name = "timeline", description = "Get your timeline")
public class TimeLineCommand implements Runnable {

	@Option(name = { "-u", "--user" }, description = "get the timeline for a specific username")
	private String username;

	@Option(name = { "-a", "--all" }, description = "get all tweets (defaults is only new tweets)")
	private boolean allStatuses;

	@Option(name = { "-c", "--clear" }, description = "clear last checked time")
	private boolean clearLast;

	@Override
	public void run() {

		TimeLiner tl = new TimeLiner(
				new TimeLine(TwitterFactory.getSingleton()).setAllStatuses(allStatuses).setUsername(username));

		tl.pullStatuses();

		if (username == null) {
			tl.updateLastCheck();
		}

		if (clearLast) {
			tl.clearLastCheck();
		}

		tl.printStatuses();
	}
}

package com.tmitim.twittercli.commands;

import com.github.rvesse.airline.annotations.Command;
import com.github.rvesse.airline.annotations.Option;
import com.tmitim.twittercli.TimeLiner;
import com.tmitim.twittercli.pojos.TimeLine;

import twitter4j.TwitterFactory;

/**
 * Get timeline
 */
@Command(name = "timeline", description = "Get your timeline")
public class TimeLineCommand implements Runnable {

	@Option(name = { "-u", "--user" }, description = "get the timeline for a specific username")
	private String username;

	@Option(name = { "-a", "--all" }, description = "get all tweets (defaults is only new tweets)")
	private boolean allStatuses;

	@Option(name = { "-c", "--clear" }, description = "clear last checked time before pulling timeline")
	private boolean clearLast;

	@Override
	public void run() {

		TimeLiner tl = new TimeLiner(
				new TimeLine(TwitterFactory.getSingleton()).setAllStatuses(allStatuses).setUsername(username));

		if (clearLast) {
			tl.clearLastCheck();
		}

		tl.pullStatuses();

		if (username == null) {
			tl.updateLastCheck();
		}

		tl.printStatuses();
	}
}

Move timeline check before t pull


package com.pr0gramm.app.ui.fragments;

import com.google.common.collect.Lists;
import com.pr0gramm.app.ActivityComponent;
import com.pr0gramm.app.api.pr0gramm.response.Message;
import com.pr0gramm.app.feed.ContentType;
import com.pr0gramm.app.services.UserService;

import java.util.EnumSet;
import java.util.List;

import javax.inject.Inject;

/**
 */
public class WrittenCommentFragment extends MessageInboxFragment {
    @Inject
    UserService userService;

    @Override
    protected LoaderHelper<List<Message>> newLoaderHelper() {
        return LoaderHelper.of(() -> {
            String name = userService.getName().get();
            return getInboxService()
                    .getUserComments(name, EnumSet.allOf(ContentType.class))
                    .map(userComments -> {
                        //noinspection CodeBlock2Expr
                        return Lists.transform(userComments.getComments(),
                                comment -> Message.of(userComments.getUser(), comment));
                    });
        });
    }

    @Override
    protected void injectComponent(ActivityComponent activityComponent) {
        activityComponent.inject(this);
    }
}

package com.pr0gramm.app.ui.fragments;

import com.google.common.collect.Lists;
import com.pr0gramm.app.ActivityComponent;
import com.pr0gramm.app.api.pr0gramm.response.Message;
import com.pr0gramm.app.feed.ContentType;
import com.pr0gramm.app.services.UserService;

import java.util.EnumSet;
import java.util.List;

import javax.inject.Inject;

import rx.Observable;

/**
 */
public class WrittenCommentFragment extends MessageInboxFragment {
    @Inject
    UserService userService;

    @Override
    protected LoaderHelper<List<Message>> newLoaderHelper() {
        return LoaderHelper.of(() -> {
            if (!userService.getName().isPresent())
                return Observable.empty();

            String name = userService.getName().get();
            return getInboxService()
                    .getUserComments(name, EnumSet.allOf(ContentType.class))
                    .map(userComments -> {
                        //noinspection CodeBlock2Expr
                        return Lists.transform(userComments.getComments(),
                                comment -> Message.of(userComments.getUser(), comment));
                    });
        });
    }

    @Override
    protected void injectComponent(ActivityComponent activityComponent) {
        activityComponent.inject(this);
    }
}

Fix error when user is logged out.


package org.pdxfinder.accessionidtatamodel;

/**
 * Created by csaba on 03/07/2017.
 */
public class AccessionData {

    private String symbol;
    private String hgncId;
    private String ensemblId;

    public AccessionData(String symbol, String hgncId, String ensemblId) {
        this.symbol = symbol;
        this.hgncId = hgncId;
        this.ensemblId = ensemblId;
    }

    public String getSymbol() {
        return symbol;
    }

    public String getHgncId() {
        return hgncId;
    }

    public String getEnsemblId() {
        return ensemblId;
    }
}

package org.pdxfinder.accessionidtatamodel;

import java.util.HashSet;
import java.util.Set;

/**
 * Created by csaba on 03/07/2017.
 */
public class AccessionData {

    private String symbol;
    private String hgncId;
    private String entrezId;
    private String ensemblId;
    private Set<String> synonyms;
    private Set<String> prevSymbols;

    public AccessionData(String symbol, String hgncId, String entrezId, String ensemblId) {
        this.symbol = symbol;
        this.hgncId = hgncId;
        this.entrezId = entrezId;
        this.ensemblId = ensemblId;
        this.synonyms = new HashSet<>();
        this.prevSymbols = new HashSet<>();

    }

    public String getSymbol() {
        return symbol;
    }

    public void setSymbol(String symbol) {
        this.symbol = symbol;
    }

    public String getHgncId() {
        return hgncId;
    }

    public void setHgncId(String hgncId) {
        this.hgncId = hgncId;
    }

    public String getEntrezId() {
        return entrezId;
    }

    public void setEntrezId(String entrezId) {
        this.entrezId = entrezId;
    }

    public String getEnsemblId() {
        return ensemblId;
    }

    public void setEnsemblId(String ensemblId) {
        this.ensemblId = ensemblId;
    }

    public Set<String> getSynonyms() {
        return synonyms;
    }

    public Set<String> getPrevSymbols() {
        return prevSymbols;
    }

    public void addPrevSymbol(String symbol){
        this.prevSymbols.add(symbol);
    }

    public void addSynonym(String synonym){
        this.synonyms.add(synonym);
    }
}

Add placeholder for synonyms and prevSymbols


package com.koustuvsinha.benchmarker.utils;

import com.koustuvsinha.benchmarker.models.DbFactoryModel;

import java.util.ArrayList;

/**
 * Created by koustuv on 24/5/15.
 */
public class Constants {

    public static ArrayList<DbFactoryModel> DB_LIST = new ArrayList<DbFactoryModel>() {{
        add(new DbFactoryModel("Realm","v0.83.3","Realm",true));
        add(new DbFactoryModel("ORM Lite Android","v4.48","ORM Lite",true));
        add(new DbFactoryModel("Sugar ORM","v1.4","Satya Narayan",true));
        add(new DbFactoryModel("Green DAO","v1.3","Green DAO",true));
        add(new DbFactoryModel("Active Android","v3.0","Michael Pardo",true));
    }};
}

package com.koustuvsinha.benchmarker.utils;

import com.koustuvsinha.benchmarker.models.DbFactoryModel;

import java.util.ArrayList;

/**
 * Created by koustuv on 24/5/15.
 */
public class Constants {

    public static ArrayList<DbFactoryModel> DB_LIST = new ArrayList<DbFactoryModel>() {{
        add(new DbFactoryModel("Realm","v0.83.3","Realm",true));
        add(new DbFactoryModel("ORM Lite Android","v4.48","ORM Lite",true));
        add(new DbFactoryModel("Sugar ORM","v1.4","Satya Narayan",true));
        add(new DbFactoryModel("Green DAO","v1.3","Green DAO",true));
        add(new DbFactoryModel("Active Android","v3.0","Michael Pardo",true));
        add(new DbFactoryModel("Android SQLite","v1.0","Android",true));
    }};

    public static int DB_TYPE_REALM = 1;
    public static int DB_TYPE_ORMLITE = 2;
    public static int DB_TYPE_SUGARORM = 3;
    public static int DB_TYPE_GREENDAO = 4;
    public static int DB_TYPE_ACTIVEANDROID = 5;
    public static int DB_TYPE_DEFAULT = 6;

}

Update constants as per db list


package org.pacey.dropwizardpebble;

import com.mitchellbosecke.pebble.PebbleEngine;
import com.mitchellbosecke.pebble.error.PebbleException;
import io.dropwizard.Configuration;
import io.dropwizard.lifecycle.setup.LifecycleEnvironment;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.Locale;

public class PebbleViewRenderer<T extends Configuration> implements ViewRenderer<T> {

	private final PebbleEngineConfigurable<T> pebbleEngineConfigurable;
	private final TemplateResolver templateResolver;
	private PebbleEngine pebbleEngine;

	public PebbleViewRenderer(PebbleEngineConfigurable<T> pebbleEngineConfigurable, TemplateResolver templateResolver) {
		this.pebbleEngineConfigurable = pebbleEngineConfigurable;
		this.templateResolver = templateResolver;
	}

	public void configure(LifecycleEnvironment lifecycleEnvironment, T configuration) {
		final PebbleEngine.Builder builder = new PebbleEngine.Builder();
		this.pebbleEngine = pebbleEngineConfigurable.configure(lifecycleEnvironment, configuration, builder);
	}

	public void render(PebbleView pebbleView, Locale locale, OutputStream output) throws IOException, PebbleException {
		try (final OutputStreamWriter outputStreamWriter = new OutputStreamWriter(output)) {
			pebbleEngine.getTemplate(templateResolver.resolve(pebbleView)).evaluate(outputStreamWriter, pebbleView.getContext(), locale);
		}
	}
}

package org.pacey.dropwizardpebble;

import com.mitchellbosecke.pebble.PebbleEngine;
import com.mitchellbosecke.pebble.error.PebbleException;
import io.dropwizard.Configuration;
import io.dropwizard.lifecycle.setup.LifecycleEnvironment;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.util.Locale;

public class PebbleViewRenderer<T extends Configuration> implements ViewRenderer<T> {

	private final PebbleEngineConfigurable<T> pebbleEngineConfigurable;
	private final TemplateResolver templateResolver;
	private PebbleEngine pebbleEngine;

	public PebbleViewRenderer(PebbleEngineConfigurable<T> pebbleEngineConfigurable, TemplateResolver templateResolver) {
		this.pebbleEngineConfigurable = pebbleEngineConfigurable;
		this.templateResolver = templateResolver;
	}

	public void configure(LifecycleEnvironment lifecycleEnvironment, T configuration) {
		final PebbleEngine.Builder builder = new PebbleEngine.Builder();
		this.pebbleEngine = pebbleEngineConfigurable.configure(lifecycleEnvironment, configuration, builder);
	}

	public void render(PebbleView pebbleView, Locale locale, OutputStream output) throws IOException, PebbleException {
		try (final OutputStreamWriter outputStreamWriter = new OutputStreamWriter(output, Charset.forName("UTF-8"))) {
			pebbleEngine.getTemplate(templateResolver.resolve(pebbleView)).evaluate(outputStreamWriter, pebbleView.getContext(), locale);
		}
	}
}

Fix the Charset to UTF-8


package seedu.task.alerts;

import java.util.Optional;

import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Alert.AlertType;

public class ChangeDirectoryCommandAlert extends Alert{

    public static final String CHANGE_DIRECTORY_COMMAND_TITLE = "Change task directory";
    public static final String CHANGE_DIRECTORY_COMMAND_HEADER_TEXT = "Task directory has been changed successfully, Never Forget must now restart.\nPlease launch the application again";

    public ChangeDirectoryCommandAlert(AlertType alertType) {
        super(alertType);
    }

    public static boolean changeDirectoryCommand(){

        try {
            Alert alert = new Alert(AlertType.WARNING);
            alert.setTitle(CHANGE_DIRECTORY_COMMAND_TITLE);
            alert.setHeaderText(CHANGE_DIRECTORY_COMMAND_HEADER_TEXT);
            Optional<ButtonType> result = alert.showAndWait();
            if (!alert.isShowing()) {
                return true;
            }
            else {
                return false;
            }

        } catch (ExceptionInInitializerError | IllegalStateException e) {
            return false;
        }

    }

}

package seedu.task.alerts;

import java.util.Optional;

import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Alert.AlertType;

public class ChangeDirectoryCommandAlert extends Alert{

    public static final String CHANGE_DIRECTORY_COMMAND_TITLE = "Change task directory";
    public static final String CHANGE_DIRECTORY_COMMAND_HEADER_TEXT = "Task directory has been changed successfully, Never Forget must now restart.\nPlease launch the application again";

    public ChangeDirectoryCommandAlert(AlertType alertType) {
        super(alertType);
    }

    public static boolean changeDirectoryCommand(){

        try {
            Alert alert = new Alert(AlertType.WARNING);
            alert.setTitle(CHANGE_DIRECTORY_COMMAND_TITLE);
            alert.setHeaderText(CHANGE_DIRECTORY_COMMAND_HEADER_TEXT);
            alert.showAndWait();
            if (!alert.isShowing()) {
                return true;
            }
            else {
                return false;
            }

        } catch (ExceptionInInitializerError | IllegalStateException e) {
            return false;
        }

    }

}

Change action after ChangeDirectoryCommand to be executed regardless of any user action to the command