package edu.isi.karma.rdf;

import java.io.File;

import com.uwyn.jhighlight.tools.FileUtils;

import edu.isi.karma.er.helper.TripleStoreUtil;
import edu.isi.karma.webserver.KarmaException;

public class LoadRDFToTripleStore {

	public static void main(String args[]) throws KarmaException {
		TripleStoreUtil util = new TripleStoreUtil();
		if (args.length < 3)
			return;
		File file = new File(args[0]);
		String context = args[1];
		String tripleStoreUrl = args[2];
		if (file.isDirectory()) {
			File[] files = file.listFiles();
			for (File f : files) {
				System.out.println(FileUtils.getExtension(f.getName()));
				if (FileUtils.getExtension(f.getName()) != null && FileUtils.getExtension(f.getName()).compareTo("ttl") == 0)
					util.saveToStore(f.getAbsolutePath(), tripleStoreUrl, context, false, null);
			}
		}
		else {
			if (FileUtils.getExtension(file.getName()) != null && FileUtils.getExtension(file.getName()).compareTo("ttl") == 0)
				util.saveToStore(file.getAbsolutePath(), tripleStoreUrl, context, false, null);
		}
	}
}

package edu.isi.karma.rdf;

import java.io.File;

import com.uwyn.jhighlight.tools.FileUtils;

import edu.isi.karma.er.helper.TripleStoreUtil;
import edu.isi.karma.webserver.KarmaException;

public class LoadRDFToTripleStore {

	public static void main(String args[]) {
		TripleStoreUtil util = new TripleStoreUtil();
		if (args.length < 3)
			return;
		File file = new File(args[0]);
		String context = args[1];
		String tripleStoreUrl = args[2];
		if (file.isDirectory()) {
			File[] files = file.listFiles();
			for (File f : files) {
				System.out.println(FileUtils.getExtension(f.getName()));
				if (FileUtils.getExtension(f.getName()) != null && FileUtils.getExtension(f.getName()).compareTo("ttl") == 0)
					try {
						util.saveToStore(f.getAbsolutePath(), tripleStoreUrl, context, false, null);
					} catch (KarmaException e) {
						System.err.println(e.getMessage());
					}
			}
		}
		else {
			if (FileUtils.getExtension(file.getName()) != null && FileUtils.getExtension(file.getName()).compareTo("ttl") == 0)
				try {
					util.saveToStore(file.getAbsolutePath(), tripleStoreUrl, context, false, null);
				} catch (KarmaException e) {
					System.err.println(e.getMessage());
				}
		}
	}
}

Save to store skip failed files

Save to store skip failed files


/*******************************************************************************
 * Copyright (c) 2010-2015, Benedek Izso, Gabor Szarnyas, Istvan Rath and Daniel Varro
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Benedek Izso - initial API and implementation
 *   Gabor Szarnyas - initial API and implementation
 *******************************************************************************/
package hu.bme.mit.trainbenchmark.benchmark.neo4j.comparators;

import hu.bme.mit.trainbenchmark.constants.ModelConstants;
import org.neo4j.graphdb.Node;

import java.util.Comparator;

public class NodeComparator implements Comparator<Node> {

	@Override
	public int compare(final Node node1, final Node node2) {
		final long id1 = (Long) node1.getProperty(ModelConstants.ID);
		final long id2 = (Long) node2.getProperty(ModelConstants.ID);
		return Long.compare(id1, id2);
	}

}

/*******************************************************************************
 * Copyright (c) 2010-2015, Benedek Izso, Gabor Szarnyas, Istvan Rath and Daniel Varro
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Benedek Izso - initial API and implementation
 *   Gabor Szarnyas - initial API and implementation
 *******************************************************************************/
package hu.bme.mit.trainbenchmark.benchmark.neo4j.comparators;

import hu.bme.mit.trainbenchmark.constants.ModelConstants;
import org.neo4j.graphdb.Node;

import java.util.Comparator;

public class NodeComparator implements Comparator<Node> {

	@Override
	public int compare(final Node node1, final Node node2) {
		final long id1 = getLongId(node1);
		final long id2 = getLongId(node2);
		return Long.compare(id1, id2);
	}

	private long getLongId(Node node) {
		Object o = node.getProperty(ModelConstants.ID);
		if (o instanceof Long) {
			return (Long) o;
		}
		if (o instanceof Integer) {
			return Long.valueOf((Integer) o);
		}
		throw new IllegalStateException("ID should be int or long");
	}

}

Work around the usual long/int issues

Work around the usual long/int issues


package org.jsonq;

/**
 * Singleton class for JSON/q functionality
 */
public class JSONQ {

	/**
	 * Execute a JSON/q command
	 *
	 * @param obj the JSON object representing a JSON/q command
	 *
	 * @return a future for sampling results
	 */
	public static Object exec( JSONObject obj ) {
		return null;
	}
}

package org.jsonq;

/**
 * Singleton class for JSON/q functionality
 */
public class JSONQ {

	/**
	 * Constructor
	 */
	private JSONQ() { }

	/**
	 * Execute a JSON/q command
	 *
	 * @param obj the JSON object representing a JSON/q command
	 *
	 * @return a future for sampling results
	 */
	public static Object exec( JSONObject obj ) {
		return null;
	}
}

Add private ctor to prevent instantiation


package org.apache.poi.poifs.crypt;

import org.apache.poi.poifs.crypt.dsig.SignatureInfo;

import static junit.framework.Assert.assertNotNull;

public class TestSignatureInfo {
    public void testConstruct()  {
        // simple test which just verifies that we can load the class and all dependend classes
        SignatureInfo info = new SignatureInfo();
        assertNotNull(info);
    }
}

package org.apache.poi.poifs.crypt;

import org.apache.poi.poifs.crypt.dsig.SignatureInfo;

import static junit.framework.Assert.assertNotNull;

public class TestSignatureInfo {
    public void testConstruct()  {
        // simple test which just verifies that we can load the class and all dependent classes
        // NOTE: this will currently crash because of missing classes
        SignatureInfo info = new SignatureInfo();
        assertNotNull(info);
    }
}

Update comment on item that crashes on purpose currently


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.saabre.setup.helper;

/**
 *
 * @author Lifaen
 */
public class NameHelper {

    public static String lower(String str)
    {
            return str.substring(0,1).toLowerCase() + str.substring(1);
    }

    public static String upper(String str)
    {
            return str.substring(0,1).toUpperCase() + str.substring(1);
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.saabre.setup.helper;

import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 *
 * @author Lifaen
 */
public class NameHelper {

    public static String lower(String str)
    {
        return str.substring(0,1).toLowerCase() + str.substring(1);
    }

    public static String upper(String str)
    {
        return str.substring(0,1).toUpperCase() + str.substring(1);
    }

    public static String getFileDate()
    {
        Calendar calendar = Calendar.getInstance();
        return new SimpleDateFormat("yyyy-MM-dd.HH-mm-ss").format(calendar.getTime());
    }
}

Add an helper for file naming by date

Add an helper for file naming by date


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.domesdaybook.matcher.singlebyte;

import net.domesdaybook.matcher.sequence.SequenceMatcher;

/**
 *
 * @author matt
 */
public abstract class AbstractSingleByteSequence implements SingleByteMatcher {

 /**
     * @inheritDoc
     *
     * Returns this for position 0, null otherwise.
     */
    @Override
    public SingleByteMatcher getByteMatcherForPosition(final int position) {
        return position == 0 ? this : null;
    }

    /**
     * {@inheritDoc}
     *
     * Always returns 1.
     */
    @Override
    public int length() {
        return 1;
    }

    /**
     * {@inheritDoc}
     *
     * Always returns this.
     */
    @Override
    public SequenceMatcher reverse() {
        return this;
    }

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.domesdaybook.matcher.singlebyte;

import net.domesdaybook.matcher.sequence.SequenceMatcher;

/**
 *
 * @author matt
 */
public abstract class AbstractSingleByteSequence implements SingleByteMatcher {

 /**
     * @inheritDoc
     *
     * Returns this for position 0, or throws an IndexOutOfBoundsException.
     */
    @Override
    public SingleByteMatcher getByteMatcherForPosition(final int position) {
        if (position == 0) {
            return this;
        }
        throw new IndexOutOfBoundsException("SingleByteMatchers only have a matcher at position 0.");
    }

    /**
     * {@inheritDoc}
     *
     * Always returns 1.
     */
    @Override
    public int length() {
        return 1;
    }

    /**
     * {@inheritDoc}
     *
     * Always returns this.
     */
    @Override
    public SequenceMatcher reverse() {
        return this;
    }

}

Make single byte matchers throw an indexoutofboundsexception if an attempt is made to get a singlebytematcher other than in position zero.


package org.jetbrains.tutorials.tree.structure;

import com.intellij.ide.projectView.*;
import com.intellij.ide.projectView.impl.nodes.PsiFileNode;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.fileTypes.PlainTextFileType;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.*;

import java.util.*;

/**
 * @author Anna Bulenkova
 */
public class TextOnlyTreeStructureProvider implements TreeStructureProvider {
  @NotNull
  @Override
  public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent,
                                             @NotNull Collection<AbstractTreeNode> children,
                                             ViewSettings settings) {
    ArrayList<AbstractTreeNode> nodes = new ArrayList<AbstractTreeNode>();
    for (AbstractTreeNode child : children) {
      if (child instanceof PsiFileNode) {
        VirtualFile file = ((PsiFileNode) child).getVirtualFile();
        if (file != null && !file.isDirectory() && !(file.getFileType() instanceof PlainTextFileType)) {
          continue;
        }
      }
      nodes.add(child);
    }
    return nodes;
  }

  @Nullable
  @Override
  public Object getData(Collection<AbstractTreeNode> collection, String s) {
    return null;
  }
}

package org.jetbrains.tutorials.tree.structure;

import com.intellij.ide.projectView.*;
import com.intellij.ide.projectView.impl.nodes.PsiFileNode;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.fileTypes.PlainTextFileType;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.*;

import java.util.*;

/**
 * @author Anna Bulenkova
 */
public class TextOnlyTreeStructureProvider implements TreeStructureProvider {
  @NotNull
  @Override
  public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent,
                                             @NotNull Collection<AbstractTreeNode> children,
                                             ViewSettings settings) {
    ArrayList<AbstractTreeNode> nodes = new ArrayList<AbstractTreeNode>();
    for (AbstractTreeNode child : children) {
      if (child instanceof PsiFileNode) {
        VirtualFile file = ((PsiFileNode) child).getVirtualFile();
        if (file != null && !file.isDirectory() && !(file.getFileType() instanceof PlainTextFileType)) {
          continue;
        }
      }
      nodes.add(child);
    }
    return nodes;
  }

  @Nullable
  @Override
  public Object getData(@NotNull Collection<AbstractTreeNode> selected, @NotNull String dataId) {
    return null;
  }
}

Fix parameter names and annotations in tree structure provider sample


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

import java.io.File;

/**
 * This handler is notified when an Http response is received.
 * @author Pixmob
 */
public class HttpResponseHandler {
    /**
     * Create an {@link HttpResponseHandler} instance for writing the response
     * to a file.
     */
    public static HttpResponseHandler toFile(File file) {
        return new WriteToFileHandler(file);
    }

    /**
     * The request failed to connect or read data in time.
     */
    public void onTimeout() throws HttpClientException {
    }

    /**
     * The request was successfully sent and a response is available.
     */
    public void onResponse(HttpResponse response) throws HttpClientException {
    }
}

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

import java.io.File;

/**
 * This handler is notified when an Http response is received.
 * @author Pixmob
 */
public class HttpResponseHandler {
    /**
     * Create an {@link HttpResponseHandler} instance for writing the response
     * to a file.
     */
    public static HttpResponseHandler toFile(File file) {
        return new WriteToFileHandler(file);
    }

    /**
     * The request failed to connect or read data in time.
     */
    public void onTimeout() throws HttpClientException {
        throw new HttpClientException("Timeout");
    }

    /**
     * The request was successfully sent and a response is available.
     */
    public void onResponse(HttpResponse response) throws HttpClientException {
    }
}

Throw an exception when the request times out


package org.postgresql.test.xa;

import java.sql.Connection;

import junit.framework.TestSuite;

import org.postgresql.test.TestUtil;

public class XATestSuite extends TestSuite {
    public static TestSuite suite() throws Exception {
        Class.forName("org.postgresql.Driver");
        TestSuite suite = new TestSuite();
        Connection connection = TestUtil.openDB();

        try
        {
            if (TestUtil.haveMinimumServerVersion(connection, "8.1"))
            {
                suite.addTestSuite(XADataSourceTest.class);
            }
        }
        finally
        {
            connection.close();
        }
        return suite;
    }
}

package org.postgresql.test.xa;

import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;

import junit.framework.TestSuite;

import org.postgresql.test.TestUtil;

public class XATestSuite extends TestSuite {
    public static TestSuite suite() throws Exception {
        Class.forName("org.postgresql.Driver");
        TestSuite suite = new TestSuite();
        Connection connection = TestUtil.openDB();

        try
        {
            if (TestUtil.haveMinimumServerVersion(connection, "8.1"))
            {
                Statement stmt = connection.createStatement();
                ResultSet rs = stmt.executeQuery("SHOW max_prepared_transactions");
                rs.next();
                int mpt = rs.getInt(1);
                if (mpt > 0) {
                    suite.addTestSuite(XADataSourceTest.class);
                } else {
                    System.out.println("Skipping XA tests because max_prepared_transactions = 0.");
                }
                rs.close();
                stmt.close();
            }
        }
        finally
        {
            connection.close();
        }
        return suite;
    }
}

Disable the XA tests if the server doesn't allow any prepared transactions, which is the default starting with the 8.4 release.


public class HelloWorld
{
  public static void
    main (String[] args)
  {
    System.out.println ("Hello, GitHub.");
    System.out.println ("Goodbye, GitHub!");
  } // main(String[])
}

public class HelloWorld
{
  public static void
    main (String[] args)
  {
    System.out.println ("Hello again, GitHub.");
    System.out.println ("Goodbye, GitHub!");
  } // main(String[])
}

Change to be pulled by local rep.

Change to be pulled by local rep.


package io.cloudslang.worker.management.services;

import org.springframework.stereotype.Service;

/**
 * Created by kravtsov on 07/12/2015
 */

@Service
public class WorkerVersionServiceImpl implements WorkerVersionService {
    @Override
    public String getWorkerVersion() {
        return "";
    }
}

package io.cloudslang.worker.management.services;

/**
 * Created by kravtsov on 07/12/2015
 */

public class WorkerVersionServiceImpl implements WorkerVersionService {
    @Override
    public String getWorkerVersion() {
        return "";
    }
}

Remove @Service - was added by mistake

Remove @Service - was added by mistake


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

import com.b2international.snowowl.core.authorization.BranchAccessControl;
import com.b2international.snowowl.identity.domain.Permission;

/**
 * @since 6.5
 */
public interface SnomedComponentCreateRequest extends SnomedComponentRequest<String>, BranchAccessControl {

	String getModuleId();

	Boolean isActive();

	@Override
	default String getOperation() {
		return Permission.BROWSE;
	}

}

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

import com.b2international.snowowl.core.authorization.BranchAccessControl;
import com.b2international.snowowl.identity.domain.Permission;

/**
 * @since 6.5
 */
public interface SnomedComponentCreateRequest extends SnomedComponentRequest<String>, BranchAccessControl {

	String getModuleId();

	Boolean isActive();

	@Override
	default String getOperation() {
		return Permission.EDIT;
	}

}

[snomed] Fix permission level of SNOMED component create requests


package io.subutai.core.hubmanager.impl.environment.state.destroy;

import io.subutai.common.peer.EnvironmentId;
import io.subutai.core.hubmanager.impl.environment.state.Context;
import io.subutai.core.hubmanager.impl.environment.state.StateHandler;
import io.subutai.hub.share.dto.environment.EnvironmentPeerDto;

public class DeletePeerStateHandler extends StateHandler
{
    public DeletePeerStateHandler( Context ctx )
    {
        super( ctx, "Deleting peer" );
    }

    @Override
    protected Object doHandle( EnvironmentPeerDto peerDto ) throws Exception
    {
        logStart();

        EnvironmentId envId = new EnvironmentId( peerDto.getEnvironmentInfo().getId() );

        ctx.localPeer.cleanupEnvironment( envId );

        ctx.envUserHelper.handleEnvironmentOwnerDeletion( peerDto );

        logEnd();

        return null;
    }

    /**
     * Instead of environment owner token, a peer token is needed to remove a Hub user.
     */
    @Override
    protected String getToken( EnvironmentPeerDto peerDto )
    {
        return peerDto.getPeerToken();
    }

    @Override
    protected void post( EnvironmentPeerDto peerDto, Object body )
    {
        ctx.restClient.delete( path( "/rest/v1/environments/%s/peers/%s", peerDto ) );
    }
}

package io.subutai.core.hubmanager.impl.environment.state.destroy;

import java.security.PrivilegedAction;

import javax.security.auth.Subject;

import io.subutai.common.peer.EnvironmentId;
import io.subutai.core.hubmanager.impl.environment.state.Context;
import io.subutai.core.hubmanager.impl.environment.state.StateHandler;
import io.subutai.core.identity.api.model.Session;
import io.subutai.hub.share.dto.environment.EnvironmentPeerDto;

public class DeletePeerStateHandler extends StateHandler
{
    public DeletePeerStateHandler( Context ctx )
    {
        super( ctx, "Deleting peer" );
    }

    @Override
    protected Object doHandle( final EnvironmentPeerDto peerDto ) throws Exception
    {
        logStart();

        EnvironmentId envId = new EnvironmentId( peerDto.getEnvironmentInfo().getId() );

        ctx.localPeer.cleanupEnvironment( envId );

        Session session = ctx.identityManager.login( "token", peerDto.getPeerToken() );

        Subject.doAs( session.getSubject(), new PrivilegedAction<Void>()
        {
            @Override
            public Void run()
            {
                ctx.envUserHelper.handleEnvironmentOwnerDeletion( peerDto );
                return null;
            }
        } );

        logEnd();

        return null;
    }

    @Override
    protected void post( EnvironmentPeerDto peerDto, Object body )
    {
        ctx.restClient.delete( path( "/rest/v1/environments/%s/peers/%s", peerDto ) );
    }
}

Refactor delete env owner, change session to peer owner


/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.web.bundle;

import org.apache.commons.lang.StringUtils;

/**
 * The type of a bundle, either CSS or Javascript.
 */
public enum BundleType {

  /**
   * The Javascript type.
   */
  JS("js"),
  /**
   * The CSS type.
   */
  CSS("css");

  /**
   * The file suffix.
   */
  private final String _suffix;

  /**
   * Creates an instance.
   *
   * @param suffix  the file suffix, not null
   */
  BundleType(String suffix) {
    _suffix = suffix;
  }

  //-------------------------------------------------------------------------
  /**
   * Gets the file suffix used by the type of file.
   *
   * @return the file suffix, not null
   */
  public String getSuffix() {
    return _suffix;
  }

  /**
   * Lookup the type using the file suffix.
   *
   * @param fileName  the file name including the suffix, null returns null
   * @return the bundle type, null if unable to determine
   */
  public static BundleType getType(String fileName) {
    if (StringUtils.isNotBlank(fileName)) {
      if (fileName.endsWith("." + JS.getSuffix())) {
        return JS;
      } else if (fileName.endsWith("." + CSS.getSuffix())) {
        return CSS;
      }
    }
    return null;
  }

}

/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.web.bundle;

import org.apache.commons.lang.StringUtils;

/**
 * The type of a bundle or fragment, either CSS, SCSS or Javascript.
 */
public enum BundleType {

  /**
   * The Javascript type.
   */
  JS("js"),
  /**
   * The CSS type.
   */
  CSS("css"),
  /**
   * The SCSS type
   */
  SCSS("scss");

  /**
   * The file suffix.
   */
  private final String _suffix;

  /**
   * Creates an instance.
   *
   * @param suffix  the file suffix, not null
   */
  BundleType(String suffix) {
    _suffix = suffix;
  }

  //-------------------------------------------------------------------------
  /**
   * Gets the file suffix used by the type of file.
   *
   * @return the file suffix, not null
   */
  public String getSuffix() {
    return _suffix;
  }

  /**
   * Lookup the type using the file suffix.
   *
   * @param fileName  the file name including the suffix, null returns null
   * @return the bundle type, null if unable to determine
   */
  public static BundleType getType(final String fileName) {
    if (StringUtils.isNotBlank(fileName)) {
      if (fileName.toLowerCase().endsWith("." + JS.getSuffix())) {
        return JS;
      } else if (fileName.toLowerCase().endsWith("." + CSS.getSuffix())) {
        return CSS;
      } else if (fileName.toLowerCase().endsWith("." + SCSS.getSuffix())) {
        return SCSS;
      }
    }
    return null;
  }

}

Add scss type to Bundle type

[PLAT-3408] Add scss type to Bundle type


package com.poberwong.launcher;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

/**
 * Created by poberwong on 16/6/30.
 */
public class IntentLauncherPackage implements ReactPackage{
    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        return Arrays.<NativeModule>asList(new IntentLauncherModule(reactContext)); // 返回一个NativeModule范型的数组就ok
    }

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

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

package com.poberwong.launcher;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

/**
 * Created by poberwong on 16/6/30.
 */
public class IntentLauncherPackage implements ReactPackage{
    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        return Arrays.<NativeModule>asList(new IntentLauncherModule(reactContext)); // 返回一个NativeModule范型的数组就ok
    }

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

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

Fix compilation error in RN 0.47.0

Fix compilation error in RN 0.47.0


/*
 * 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 com.pinterest.secor.reader;

import com.pinterest.secor.common.SecorConfig;
import com.pinterest.secor.common.TopicPartition;
import com.pinterest.secor.message.Message;

import java.net.UnknownHostException;

public interface KafkaMessageIterator {
    boolean hasNext();
    Message next();
    void init(SecorConfig config) throws UnknownHostException;
    void commit(TopicPartition topicPartition, long offset);
}

/*
 * 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 com.pinterest.secor.reader;

import com.pinterest.secor.common.SecorConfig;
import com.pinterest.secor.common.TopicPartition;
import com.pinterest.secor.message.Message;

import java.net.UnknownHostException;

public interface KafkaMessageIterator {
    boolean hasNext();
    Message next();
    void init(SecorConfig config) throws UnknownHostException;
    void commit(TopicPartition topicPartition, long offset);

    long getKafkaCommitedOffsetCount(TopicPartition topicPartition);
}

Remove writing to Zookeeper when kafka is selected as offset storage and dual.commit is false.


package io.kubernetes.client.informer.cache;

import com.google.common.base.Strings;
import java.util.List;

/** Lister interface is used to list cached items from a running informer. */
public class Lister<ApiType> {

  private String namespace;

  private String indexName;

  private Indexer<ApiType> indexer;

  public Lister(Indexer<ApiType> indexer) {
    this(indexer, null, Cache.NAMESPACE_INDEX);
  }

  public Lister(Indexer<ApiType> indexer, String namespace) {
    this(indexer, namespace, Cache.NAMESPACE_INDEX);
  }

  public Lister(Indexer<ApiType> indexer, String namespace, String indexName) {
    this.indexer = indexer;
    this.namespace = namespace;
    this.indexName = indexName;
  }

  public List<ApiType> list() {
    if (Strings.isNullOrEmpty(namespace)) {
      return indexer.list();
    } else {
      return indexer.byIndex(this.indexName, namespace);
    }
  }

  public ApiType get(String name) {
    String key = name;
    if (Strings.isNullOrEmpty(namespace)) {
      key = namespace + "/" + name;
    }
    return indexer.getByKey(key);
  }

  public Lister<ApiType> namespace(String namespace) {
    return new Lister<ApiType>(this.indexer, namespace, Cache.NAMESPACE_INDEX);
  }
}

package io.kubernetes.client.informer.cache;

import com.google.common.base.Strings;
import java.util.List;

/** Lister interface is used to list cached items from a running informer. */
public class Lister<ApiType> {

  private String namespace;

  private String indexName;

  private Indexer<ApiType> indexer;

  public Lister(Indexer<ApiType> indexer) {
    this(indexer, null, Cache.NAMESPACE_INDEX);
  }

  public Lister(Indexer<ApiType> indexer, String namespace) {
    this(indexer, namespace, Cache.NAMESPACE_INDEX);
  }

  public Lister(Indexer<ApiType> indexer, String namespace, String indexName) {
    this.indexer = indexer;
    this.namespace = namespace;
    this.indexName = indexName;
  }

  public List<ApiType> list() {
    if (Strings.isNullOrEmpty(namespace)) {
      return indexer.list();
    } else {
      return indexer.byIndex(this.indexName, namespace);
    }
  }

  public ApiType get(String name) {
    String key = name;
    if (!Strings.isNullOrEmpty(namespace)) {
      key = namespace + "/" + name;
    }
    return indexer.getByKey(key);
  }

  public Lister<ApiType> namespace(String namespace) {
    return new Lister<ApiType>(this.indexer, namespace, Cache.NAMESPACE_INDEX);
  }
}

Fix a problem that lister cannot get resource correctly


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

import io.vertx.core.Vertx;

import java.util.concurrent.Executor;

/**
 * Vert.x execution context.
 *
 * @author Jordan Halterman
 */
public class VertxEventLoopExecutor implements Executor {
  private final Vertx vertx;

  public VertxEventLoopExecutor(Vertx vertx) {
    this.vertx = vertx;
  }

  @Override
  public void execute(Runnable command) {
    vertx.runOnContext(v -> command.run());
  }

}

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

import io.vertx.core.Context;
import io.vertx.core.Vertx;

import java.util.concurrent.Executor;

/**
 * Vert.x execution context.
 *
 * @author Jordan Halterman
 */
public class VertxEventLoopExecutor implements Executor {
  private final Context context;

  public VertxEventLoopExecutor(Vertx vertx) {
    this.context = vertx.getOrCreateContext();
  }

  @Override
  public void execute(Runnable command) {
    context.runOnContext(v -> command.run());
  }

}

Refactor Vert.x 3 event loop context to store context upon construction in order to prevent issues with calling runOnContext from a non-context thread.


package com.faforever.api.dto;

import com.faforever.api.elide.ElideEntity;
import com.github.jasminb.jsonapi.annotations.Id;
import com.github.jasminb.jsonapi.annotations.Relationship;
import com.github.jasminb.jsonapi.annotations.Type;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jetbrains.annotations.Nullable;

import java.time.OffsetDateTime;

@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@Builder
@Type(GamePlayerStats.TYPE)
public class GamePlayerStats implements ElideEntity {
  public static final String TYPE = "gamePlayerStats";

  @Id
  @EqualsAndHashCode.Include
  private String id;
  private boolean ai;
  private Faction faction;
  private byte color;
  private byte team;
  private byte startSpot;
  private Float beforeMean;
  private Float beforeDeviation;
  private Float afterMean;
  private Float afterDeviation;
  private byte score;
  @Nullable
  private OffsetDateTime scoreTime;

  @Relationship("game")
  private Game game;

  @Relationship("player")
  private Player player;
}

package com.faforever.api.dto;

import com.faforever.api.elide.ElideEntity;
import com.github.jasminb.jsonapi.annotations.Id;
import com.github.jasminb.jsonapi.annotations.Relationship;
import com.github.jasminb.jsonapi.annotations.Type;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jetbrains.annotations.Nullable;

import java.time.OffsetDateTime;

@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@Builder
@Type(GamePlayerStats.TYPE)
public class GamePlayerStats implements ElideEntity {
  public static final String TYPE = "game";

  @Id
  @EqualsAndHashCode.Include
  private String id;
  private boolean ai;
  private Faction faction;
  private byte color;
  private byte team;
  private byte startSpot;
  private Float beforeMean;
  private Float beforeDeviation;
  private Float afterMean;
  private Float afterDeviation;
  private byte score;
  @Nullable
  private OffsetDateTime scoreTime;

  @Relationship("game")
  private Game game;

  @Relationship("player")
  private Player player;
}

Revert "Fix wrong type mapping for game player stats"

This reverts commit b0132110


package org.jboss.wsf.test;

/**
 *
 * @author Rostislav Svoboda
 */
public class CryptoCheckMain
{

    public static void main(String[] args) throws Exception
    {
        System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
        System.out.println("JCE unlimited strength cryptography:   " + ((javax.crypto.Cipher.getMaxAllowedKeyLength("RC5") < 256)?"NOT ":"") + "INSTALLED" );
        System.out.println("Bouncy Castle JCE Provider:            " + ((java.security.Security.getProvider("BC") == null)?"NOT ":"") + "INSTALLED" );
        System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    }

}

package org.jboss.wsf.test;

import java.security.Provider;

/**
 *
 * @author Rostislav Svoboda
 */
public class CryptoCheckMain
{

    public static void main(String[] args) throws Exception
    {
        System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
        System.out.println("JCE unlimited strength cryptography:   " + ((javax.crypto.Cipher.getMaxAllowedKeyLength("RC5") < 256)?"NOT ":"") + "INSTALLED" );
        Provider p = java.security.Security.getProvider("BC");
        if (p != null) {
           System.out.println("Bouncy Castle JCE Provider:            INSTALLED (ver: " + p.getVersion() + ", " +
              p.getClass().getProtectionDomain().getCodeSource().getLocation() + ")" );
        } else {
           System.out.println("Bouncy Castle JCE Provider:            NOT INSTALLED" );
        }
        System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    }

}

Print BC version and jar location

Print BC version and jar location


package no.ntnu.okse.protocol.amqp091;

import no.ntnu.okse.core.messaging.Message;
import no.ntnu.okse.core.messaging.MessageService;
import no.ntnu.okse.core.subscription.Publisher;
import org.ow2.joram.mom.amqp.AMQPMessageListener;
import org.ow2.joram.mom.amqp.messages.*;

public class AMQP091MessageListener implements AMQPMessageListener {

    private final AMQP091ProtocolServer amqpProtocolServer;

    public AMQP091MessageListener(AMQP091ProtocolServer amqp091ProtocolServer) {
        this.amqpProtocolServer = amqp091ProtocolServer;
    }

    @Override
    public void onConnect(ConnectMessage connectMessage) {

    }

    @Override
    public void onDisconnect(DisconnectMessage disConnectMessage) {

    }

    @Override
    public void onMessageReceived(MessageReceived messageReceived) {
        String message = new String(messageReceived.getBody());
        String topic = messageReceived.getTopic();
        String host = messageReceived.getHost();
        int port = messageReceived.getPort();

        String protocolServerType = amqpProtocolServer.getProtocolServerType();
        Publisher pub = new Publisher(topic, host, port, protocolServerType);

        MessageService.getInstance().distributeMessage(new Message(message, topic, pub, protocolServerType));
    }

    @Override
    public void onSubscribe(SubscribeMessage subscribeMessage) {

    }

    @Override
    public void onUnsubscribe(UnsubscribeMessage unsubscribeMessage) {

    }
}

package no.ntnu.okse.protocol.amqp091;

import no.ntnu.okse.core.messaging.Message;
import no.ntnu.okse.core.messaging.MessageService;
import no.ntnu.okse.core.subscription.Publisher;
import org.ow2.joram.mom.amqp.AMQPMessageListener;
import org.ow2.joram.mom.amqp.messages.*;

public class AMQP091MessageListener implements AMQPMessageListener {

    private final AMQP091ProtocolServer amqpProtocolServer;

    public AMQP091MessageListener(AMQP091ProtocolServer amqp091ProtocolServer) {
        this.amqpProtocolServer = amqp091ProtocolServer;
    }

    @Override
    public void onConnect(ConnectMessage connectMessage) {

    }

    @Override
    public void onDisconnect(DisconnectMessage disConnectMessage) {

    }

    @Override
    public void onMessageReceived(MessageReceived messageReceived) {
        String message = new String(messageReceived.getBody());
        String topic = messageReceived.getExchange();
        String host = messageReceived.getHost();
        int port = messageReceived.getPort();

        String protocolServerType = amqpProtocolServer.getProtocolServerType();
        Publisher pub = new Publisher(topic, host, port, protocolServerType);

        MessageService.getInstance().distributeMessage(new Message(message, topic, pub, protocolServerType));
    }

    @Override
    public void onSubscribe(SubscribeMessage subscribeMessage) {

    }

    @Override
    public void onUnsubscribe(UnsubscribeMessage unsubscribeMessage) {

    }
}

Use exchange instead of topic from joram


/*
 * Copyright 2019 Google LLC
 *
 * 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 com.google.android.gnd.repository.local;

/**
 * Optional new or deleted state shared by Features and Records.
 */
public enum EntityState implements IntEnum {
  UNKNOWN(0),
  DEFAULT(1),
  NEW(2),
  DELETED(3);

  private final int intValue;

  EntityState(int intValue) {
    this.intValue = intValue;
  }

  public int intValue() {
    return intValue;
  }
}

/*
 * Copyright 2019 Google LLC
 *
 * 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 com.google.android.gnd.repository.local;

/**
 * Mutually exclusive entity states shared by Features and Records.
 */
public enum EntityState implements IntEnum {
  DELETED(-1),
  UNKNOWN(0),
  DEFAULT(1);

  private final int intValue;

  EntityState(int intValue) {
    this.intValue = intValue;
  }

  public int intValue() {
    return intValue;
  }
}

Remove "NEW" state from entities

Remove "NEW" state from entities


/**
 * Copyright (c) 2012-2013 André Bargull
 * Alle Rechte vorbehalten / All Rights Reserved.  Use is subject to license terms.
 *
 * <https://github.com/anba/es6draft>
 */
package com.github.anba.es6draft.runtime.types;

/**
 *
 */
public enum IntegrityLevel {
    NonExtensible, Sealed, Frozen
}

/**
 * Copyright (c) 2012-2013 André Bargull
 * Alle Rechte vorbehalten / All Rights Reserved.  Use is subject to license terms.
 *
 * <https://github.com/anba/es6draft>
 */
package com.github.anba.es6draft.runtime.types;

/**
 *
 */
public enum IntegrityLevel {
    Sealed, Frozen
}

Remove unused 'NonExtensible' entry from enum


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

import org.metafacture.metamorph.api.MorphErrorHandler;

/**
 * Default error handler used by {@link Metamorph}. It simply throw a
 * {@link MetamorphException}.
 *
 * @author Markus Michael Geipel
 */
public final class DefaultErrorHandler implements MorphErrorHandler {

    @Override
    public void error(final Exception exception) {
        throw new MetamorphException(
                "Error while exectuing the Metamorph transformation pipeline: " +
                        exception.getMessage(), exception);
    }

}

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

import org.metafacture.metamorph.api.MorphErrorHandler;

/**
 * Default error handler used by {@link Metamorph}. It simply throw a
 * {@link MetamorphException}.
 *
 * @author Markus Michael Geipel
 */
public final class DefaultErrorHandler implements MorphErrorHandler {

    @Override
    public void error(final Exception exception) {
        throw new MetamorphException(
                "Error while executing the Metamorph transformation pipeline: " +
                        exception.getMessage(), exception);
    }

}

Fix typo in error message

Fix typo in error message


// Copyright (c) 2010, www.andrew-eells.com. All rights reserved.

package com.andrew_eells.persistence.service;

import com.andrew_eells.persistence.infrastructure.query.QuerySpecification;

import java.util.List;

/**
 * Standardised database repository access.
 */
public interface PersistenceService<PersistentStrategy>
{
    /**
     * Persist new object.
     *
     * @param object New object.
     */
    void create(final PersistentStrategy object);

    /**
     * Read unique result object.
     *
     * @param querySpecification Query specification.
     * @return Unique result or null if none exists.
     */
    PersistentStrategy readUnique(final QuerySpecification querySpecification);

    /**
     * Read collection of result objects.
     *
     * @param querySpecification Query specification.
     * @return Collection of results or empty collection if none exists.
     */
    List<PersistentStrategy> readList(final QuerySpecification querySpecification);

    /**
     * Update existing object.
     *
     * @param object Object to be updated.
     * @return Updated object.
     */
    void update(final PersistentStrategy object);

    /**
     * Delete existing object.
     *
     * @param object Object to be deleted.
     */
    void delete(final PersistentStrategy object);
}

// Copyright (c) 2010, www.andrew-eells.com. All rights reserved.

package com.andrew_eells.persistence.service;

import com.andrew_eells.persistence.infrastructure.query.QuerySpecification;

import java.util.List;

/**
 * Standardised database repository access.
 */
public interface PersistenceService<PersistentStrategy>
{
    /**
     * Persist new object.
     *
     * @param object New object.
     */
    void create(final PersistentStrategy object);

    /**
     * Read unique result object.
     *
     * @param querySpecification Query specification.
     * @return Unique result or null if none exists.
     */
    PersistentStrategy readUnique(final QuerySpecification querySpecification);

    /**
     * Read collection of result objects.
     *
     * @param querySpecification Query specification.
     * @return Collection of results or empty collection if none exists.
     */
    List<PersistentStrategy> readList(final QuerySpecification querySpecification);

    /**
     * Update existing object.
     *
     * @param object Object to be updated.
     */
    void update(final PersistentStrategy object);

    /**
     * Delete existing object.
     *
     * @param object Object to be deleted.
     */
    void delete(final PersistentStrategy object);
}

Clean up of style and checksum warnings.


package io.quarkus.runtime.graal;

import java.io.ObjectStreamClass;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

@TargetClass(java.io.ObjectStreamClass.class)
@SuppressWarnings({ "unused" })
final class Target_java_io_ObjectStreamClass {

    @Substitute
    private static ObjectStreamClass lookup(Class<?> cl, boolean all) {
        throw new UnsupportedOperationException("Serialization of class definitions not supported");
    }

    private Target_java_io_ObjectStreamClass(final Class<?> cl) {
        throw new UnsupportedOperationException("Serialization of class definitions not supported");
    }

    private Target_java_io_ObjectStreamClass() {
        throw new UnsupportedOperationException("Not supported");
    }

}

package io.quarkus.runtime.graal;

import java.io.ObjectStreamClass;
import java.util.function.BooleanSupplier;

import org.graalvm.home.Version;

import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

import io.quarkus.runtime.graal.Target_java_io_ObjectStreamClass.GraalVM20OrEarlier;

@TargetClass(value = java.io.ObjectStreamClass.class, onlyWith = GraalVM20OrEarlier.class)
@SuppressWarnings({ "unused" })
final class Target_java_io_ObjectStreamClass {

    @Substitute
    private static ObjectStreamClass lookup(Class<?> cl, boolean all) {
        throw new UnsupportedOperationException("Serialization of class definitions not supported");
    }

    private Target_java_io_ObjectStreamClass(final Class<?> cl) {
        throw new UnsupportedOperationException("Serialization of class definitions not supported");
    }

    private Target_java_io_ObjectStreamClass() {
        throw new UnsupportedOperationException("Not supported");
    }

    static class GraalVM20OrEarlier implements BooleanSupplier {

        @Override
        public boolean getAsBoolean() {
            return Version.getCurrent().compareTo(21) < 0;
        }
    }
}

Enable Java serialization for GraalVM 21+


package com.hamishrickerby.http_server.responses;

import com.hamishrickerby.http_server.FormStore;
import com.hamishrickerby.http_server.Method;
import com.hamishrickerby.http_server.Request;

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

/**
 * Created by rickerbh on 12/09/2016.
 */
public class FormResponse extends Response {
    FormStore store;

    public FormResponse(Request request, FormStore store) {
        super(request);
        this.store = store;

        saveDataIfNeeded();
    }

    private void saveDataIfNeeded() {
        if (!updatingMethods().contains(request.getMethod())) {
            return;
        }
        for (String key : request.dataKeys()) {
            store.write(key, request.readData(key));
        }
    }

    private List<String> updatingMethods() {
        String[] methods = {Method.POST.name(), Method.PUT.name()};
        return Arrays.asList(methods);
    }

    public static Boolean respondsTo(Request request) {
        return request.getPath().equalsIgnoreCase("/form");
    }

    @Override
    protected byte[] body() {
        switch (request.getMethod()) {
            default:
                return new byte[0];
        }
    }
}

package com.hamishrickerby.http_server.responses;

import com.hamishrickerby.http_server.FormStore;
import com.hamishrickerby.http_server.Method;
import com.hamishrickerby.http_server.Request;

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

/**
 * Created by rickerbh on 12/09/2016.
 */
public class FormResponse extends Response {
    FormStore store;

    public FormResponse(Request request, FormStore store) {
        super(request);
        this.store = store;

        saveDataIfNeeded();
    }

    private void saveDataIfNeeded() {
        if (!updatingMethods().contains(request.getMethod().name())) {
            return;
        }
        for (String key : request.dataKeys()) {
            store.write(key, request.readData(key));
        }
    }

    private List<String> updatingMethods() {
        String[] methods = {Method.POST.name(), Method.PUT.name()};
        return Arrays.asList(methods);
    }

    public static Boolean respondsTo(Request request) {
        return request.getPath().equalsIgnoreCase("/form");
    }

    @Override
    protected byte[] body() {
        switch (request.getMethod()) {
            default:
                return new byte[0];
        }
    }
}

Resolve issue where method comparison wasn’t working


package ee.tuleva.onboarding.auth.session;

import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

@Component
@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
public class GenericSessionStore implements Serializable {

  @Serial private static final long serialVersionUID = -648103071415508424L;

  private final Map<String, Object> sessionAttributes = new HashMap<>();

  public <T extends Serializable> void save(T sessionAttribute) {
    sessionAttributes.put(sessionAttribute.getClass().getName(), sessionAttribute);
  }

  public <T extends Serializable> Optional<T> get(Class clazz) {
    @SuppressWarnings("unchecked")
    T sessionAttribute = (T) sessionAttributes.get(clazz.getName());

    if (sessionAttribute == null) {
      return Optional.empty();
    }

    return Optional.of(sessionAttribute);
  }
}

package ee.tuleva.onboarding.auth.session;

import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.SessionScope;

@Component
@SessionScope
public class GenericSessionStore implements Serializable {

  @Serial private static final long serialVersionUID = -648103071415508424L;

  private final Map<String, Object> sessionAttributes = new HashMap<>();

  public <T extends Serializable> void save(T sessionAttribute) {
    sessionAttributes.put(sessionAttribute.getClass().getName(), sessionAttribute);
  }

  public <T extends Serializable> Optional<T> get(Class clazz) {
    @SuppressWarnings("unchecked")
    T sessionAttribute = (T) sessionAttributes.get(clazz.getName());

    if (sessionAttribute == null) {
      return Optional.empty();
    }

    return Optional.of(sessionAttribute);
  }
}

Revert "Revert "Use composed annotation for readability""

This reverts commit c82beaa8e9380ec257a4bb296f981cde865ff6d1.


import java.io.File;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.FileReader;
import java.util.ArrayList;

public class Engineering {
	public static void main(String[] args) {
		if (args.length < 1) {
			System.err.println("A file must be supplied.");
			System.exit(1);
			return;
		}
		File file = new File(args[0]);
		ArrayList<Student> records;
		try {
			records = readRecords(file);
		} catch (IOException ex) {
			System.err.println("Error reading file: " + file);
			System.exit(1);
			return;
		}
	}

	private static ArrayList<Student> readRecords(File file)
	        throws IOException {
		ArrayList<Student> records = new ArrayList<Student>();
		try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
			for (String line = reader.readLine(); // Forget first line.
			     (line = reader.readLine()) != null;) {
				records.add(new Student(line));
			}
		}
		return records;
	}
}

import java.io.File;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.FileReader;
import java.util.ArrayList;

public class Engineering {
	public static void main(String[] args) {
		if (args.length < 1) {
			System.err.println("A file must be supplied.");
			System.exit(1);
			return;
		}
		File file = new File(args[0]);
		ArrayList<Student> records;
		try {
			records = readRecords(file);
		} catch (IOException ex) {
			System.err.println("Error reading file: " + file);
			System.exit(1);
			return;
		}

		interactiveLoop(records);
}

	private static ArrayList<Student> readRecords(File file)
	        throws IOException {
		ArrayList<Student> records = new ArrayList<Student>();
		try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
			for (String line = reader.readLine(); // Forget first line.
			     (line = reader.readLine()) != null;) {
				if (!line.isEmpty()) {
					records.add(new Student(line));
				}
			}
		}
		return records;
	}

	private static void interactiveLoop(ArrayList<Student> records) {
		BufferedReader stdin = new BufferedReader(new FileInputStream(
		                       System.in));
		for (String line; (line = stdin.readLine()) != null;) {
			System.out.println(line);
		}

	}
}

Add interactiveLoop() shell for testing

Add interactiveLoop() shell for testing


/*
 * 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

git-svn-id: 7c053b8fbd1fb5868f764c6f9536fc6a9bbe7da9@804702 13f79535-47bb-0310-9956-ffa450edef68


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

import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;

/**
 * ViewHolder for a {@link CutoutViewIndicator}.
 *
 * Can be used like a {@link android.widget.ProgressBar}, only more straightforward.
 *

 * Call {@link OffSetters#offsetImageBy(ImageView, int, float)} to offset an image over a static background.
 *
 * @author Philip Cohn-Cort (Fuzz)
 */
public abstract class IndicatorViewHolder<Root extends View> implements LayeredView {
    @NonNull
    protected final Root itemView;

    public IndicatorViewHolder(@NonNull Root itemView) {
        this.itemView = itemView;
    }

    @Override
    @NonNull
    public Root getItemView() {
        return itemView;
    }
}

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

import android.graphics.Matrix;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;

/**
 * ViewHolder for a {@link CutoutViewIndicator}.
 *
 * Can be used like a {@link android.widget.ProgressBar}, only more straightforward.
 *

 * Call {@link OffSetters#offsetImageBy(ImageView, int, float, Matrix)} to offset an image over a static background.
 *
 * @author Philip Cohn-Cort (Fuzz)
 */
public abstract class IndicatorViewHolder<Root extends View> implements LayeredView {
    @NonNull
    protected final Root itemView;

    public IndicatorViewHolder(@NonNull Root itemView) {
        this.itemView = itemView;
    }

    @Override
    @NonNull
    public Root getItemView() {
        return itemView;
    }
}

Fix an invalid javadoc reference

Fix an invalid javadoc reference


package ${config['appid']};

import org.appcelerator.titanium.TiApplication;

public final class ${config['classname']}Application extends TiApplication {

	@Override
	public void onCreate() {
		super.onCreate();

		appInfo = new ${config['classname']}AppInfo(this);
		stylesheet = new ApplicationStylesheet();

		onAfterCreate();
	}

	@Override
	public final Integer getDrawableID(String key) { return RA.getDrawable(key); }

	@Override
	public final Integer getStringID(String key) { return RA.getString(key); }

	@Override
	public final Integer getAttrID(String key) { return RA.getAttr(key); }

}

package ${config['appid']};

import org.appcelerator.titanium.TiApplication;

public final class ${config['classname']}Application extends TiApplication {

	@Override
	public void onCreate() {
		super.onCreate();

		appInfo = new ${config['classname']}AppInfo(this);
		stylesheet = new ApplicationStylesheet();

		onAfterCreate();
	}

	@Override
	public final Integer getDrawableID(String key) { return RA.getDrawable(key); }

	@Override
	public final Integer getAttrID(String key) { return RA.getAttr(key); }

}

Remove getStringID, because RA.getString doesn't appear to always exist. We need a better way to do this (link in the RA to titanium SDK code.) Pondering...


package fr.treeptik.cloudunit.hooks;

/**
 * Created by nicolas on 19/04/2016.
 */
public enum HookAction {

    APPLICATION_POST_START("Application post start", "/cloudunit/appconf/hooks/application-post-start.sh"),
    APPLICATION_POST_STOP("Application post stop", "/cloudunit/appconf/hooks/application-post-stop.sh"),
    APPLICATION_PRE_START("Application pre start", "/cloudunit/appconf/hooks/application-pre-start.sh"),
    APPLICATION_PRE_STOP("Application pre stop", "/cloudunit/appconf/hooks/application-pre-stop.sh");

    private final String label;
    private final String command;

    HookAction(String label, String command) {
        this.label = label;
        this.command = command;
    }

    public String getLabel() {
        return label;
    }

    public String[] getCommand() {
        String[] commandBash = new String[2];
        commandBash[0] = "bash";
        commandBash[1] = command;
        return commandBash;
    }
}

package fr.treeptik.cloudunit.hooks;

/**
 * Created by nicolas on 19/04/2016.
 */
public enum HookAction {

    APPLICATION_POST_START("Application post start", "/cloudunit/appconf/hooks/application-post-start.sh"),
    APPLICATION_POST_STOP("Application post stop", "/cloudunit/appconf/hooks/application-post-stop.sh"),
    APPLICATION_PRE_START("Application pre start", "/cloudunit/appconf/hooks/application-pre-start.sh"),
    APPLICATION_PRE_STOP("Application pre stop", "/cloudunit/appconf/hooks/application-pre-stop.sh"),
    SNAPSHOT_PRE_ACTION("Before Snapshot", "/cloudunit/appconf/hooks/snapshot-pre-action.sh"),
    SNAPSHOT_POST_ACTION("After Snapshot", "/cloudunit/appconf/hooks/snapshot-post-action.sh"),
    CLONE_PRE_ACTION("Before restoring an application", "/cloudunit/appconf/hooks/clone-pre-action.sh"),
    CLONE_POST_ACTION("After restoring an application", "/cloudunit/appconf/hooks/clone-post-action.sh");

    private final String label;
    private final String command;

    HookAction(String label, String command) {
        this.label = label;
        this.command = command;
    }

    public String getLabel() {
        return label;
    }

    public String[] getCommand() {
        String[] commandBash = new String[2];
        commandBash[0] = "bash";
        commandBash[1] = command;
        return commandBash;
    }
}

Add new Hooks. Not yet called into code

Add new Hooks. Not yet called into code


package com.woopra.java.sdk;

import java.util.HashMap;

public class WoopraVisitor {

	public static String EMAIL = "email";
	public static String UNIQUE_ID = "uniqueId";

	protected HashMap<String, Object> properties = new HashMap<String, Object>();
	private String ipAddress = "";
	private String cookieValue = "";
	private String userAgent = "";

	public WoopraVisitor(String identifier, String value) {
		if (identifier.equals(WoopraVisitor.EMAIL)) {
			properties.put(WoopraVisitor.EMAIL, value);
			this.cookieValue = String.valueOf(Math.abs(value.hashCode()));
		} else if (identifier.equals(WoopraVisitor.UNIQUE_ID)) {
			this.cookieValue = value;
		}
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}

	public void setUserAgent(String userAgent) {
		this.userAgent = userAgent;
	}

	public void setProperty(String key, Object value) {
		this.properties.put(key, value);
	}

	public String toString() {
		return this.properties.toString();
	}

        public String getCookieValue() {
            return this.cookieValue;
        }

        public String getIpAddress() {
            return this.ipAddress;
        }

        public String getUserAgent() {
            return this.userAgent;
        }
}

package com.woopra.java.sdk;

import java.util.HashMap;

public class WoopraVisitor {

	public static String EMAIL = "email";
	public static String UNIQUE_ID = "uniqueId";

	protected HashMap<String, Object> properties = new HashMap<>();
	private String ipAddress = "";
	private String cookieValue = "";
	private String userAgent = "";

	public WoopraVisitor(String identifier, String value) {
		if (identifier.equals(WoopraVisitor.EMAIL)) {
			properties.put(WoopraVisitor.EMAIL, value);
			this.cookieValue = String.valueOf(Math.abs(value.hashCode()));
		} else if (identifier.equals(WoopraVisitor.UNIQUE_ID)) {
			this.cookieValue = value;
		}
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}

	public void setUserAgent(String userAgent) {
		this.userAgent = userAgent;
	}

	public void setProperty(String key, Object value) {
		this.properties.put(key, value);
	}

	public String toString() {
		return this.properties.toString();
	}

        public String getCookieValue() {
            return this.cookieValue;
        }

        public String getIpAddress() {
            return this.ipAddress;
        }

        public String getUserAgent() {
            return this.userAgent;
        }
}

Use diamond inference for hashmap

Use diamond inference for hashmap


package com.teinproductions.tein.pitrainer;

import android.widget.EditText;

public interface ActivityInterface {
    void preventSoftKeyboardFromShowingUp(EditText et, boolean show);

    void vibrate();

    void animateToolbarColor(boolean red);

    void swapFragment(Class fragmentClass);
}

Improve some layout and texts

Improve some layout and texts


package no.stelar7.api.r4j.basic.constants.types.val;

import no.stelar7.api.r4j.basic.constants.types.CodedEnum;

import java.util.Optional;
import java.util.stream.Stream;

public enum GameQueueType implements CodedEnum<GameQueueType>
{

    COMPETITIVE("competitive"),
    DEATHMATCH("deathmatch"),
    SPIKE_RUSH("spikerush"),
    UNRATED("unrated"),
    CUSTOM_GAME(""),
    TOURNAMENT_MODE("tournamentmode"),
    ;

    private final String queue;

    /**
     * Constructor for MapType
     *
     * @param code the mapId
     */
    GameQueueType(final String code)
    {
        this.queue = code;
    }

    /**
     * Gets from code.
     *
     * @param mapId the map id
     * @return the from code
     */
    public Optional<GameQueueType> getFromCode(final String mapId)
    {
        return Stream.of(GameQueueType.values()).filter(t -> t.queue.equals(mapId)).findFirst();
    }

    @Override
    public String prettyName()
    {
        switch (this)
        {
            default:
                return "This enum does not have a pretty name";
        }
    }

    /**
     * Gets id.
     *
     * @return the id
     */
    public String getId()
    {
        return this.queue;
    }

    /**
     * Used internaly in the api...
     *
     * @return the value
     */
    public String getValue()
    {
        return getId();
    }

}

package no.stelar7.api.r4j.basic.constants.types.val;

import no.stelar7.api.r4j.basic.constants.types.CodedEnum;

import java.util.Optional;
import java.util.stream.Stream;

public enum GameQueueType implements CodedEnum<GameQueueType>
{

    COMPETITIVE("competitive"),
    DEATHMATCH("deathmatch"),
    SPIKE_RUSH("spikerush"),
    UNRATED("unrated"),
    CUSTOM_GAME(""),
    TOURNAMENT_MODE("tournamentmode"),
    ONE_FOR_ALL("onefa"),
    ;

    private final String queue;

    /**
     * Constructor for MapType
     *
     * @param code the mapId
     */
    GameQueueType(final String code)
    {
        this.queue = code;
    }

    /**
     * Gets from code.
     *
     * @param mapId the map id
     * @return the from code
     */
    public Optional<GameQueueType> getFromCode(final String mapId)
    {
        return Stream.of(GameQueueType.values()).filter(t -> t.queue.equals(mapId)).findFirst();
    }

    @Override
    public String prettyName()
    {
        switch (this)
        {
            default:
                return "This enum does not have a pretty name";
        }
    }

    /**
     * Gets id.
     *
     * @return the id
     */
    public String getId()
    {
        return this.queue;
    }

    /**
     * Used internaly in the api...
     *
     * @return the value
     */
    public String getValue()
    {
        return getId();
    }

}

Add 'One For All' Queue Id (Valorant)

Add 'One For All' Queue Id (Valorant)


package org.jboss.loom.utils;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.tools.ant.DirectoryScanner;

/**
 *  Usage:
 *
 *
files = new DirScanner("** /foo/*.bar").list( baseDir );

 *
 *  @author Ondrej Zizka, ozizka at redhat.com
 */
public class DirScanner {

    private String pattern;

    public DirScanner( String pattern ) {
        if( pattern == null )
            throw new IllegalArgumentException("pattern can't be null.");
        this.pattern = pattern;
    }

    public List<File> list( File dirToScan ) throws IOException {
        if( dirToScan == null )
            throw new IllegalArgumentException("dirToScan can't be null.");

        DirectoryScanner ds = new DirectoryScanner();
        String[] includes = { this.pattern };
        //String[] excludes = {"modules\\*\\**"};
        ds.setIncludes(includes);
        //ds.setExcludes(excludes);
        ds.setBasedir( dirToScan );
        //ds.setCaseSensitive(true);
        ds.scan();

        String[] matches = ds.getIncludedFiles();
        List<File> files = new ArrayList(matches.length);
        for (int i = 0; i < matches.length; i++) {
            files.add( new File(matches[i]) );
        }
        return files;
    }

}// class

package org.jboss.loom.utils;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.tools.ant.DirectoryScanner;

/**
 *  Usage:
 *
 *
files = new DirScanner("** /foo/*.bar").list( baseDir );

 *
 *  @author Ondrej Zizka, ozizka at redhat.com
 */
public class DirScanner {

    private String pattern;

    public DirScanner( String pattern ) {
        if( pattern == null )
            throw new IllegalArgumentException("pattern can't be null.");
        this.pattern = pattern;
    }

    public List<String> list( File dirToScan ) throws IOException {
        if( dirToScan == null )
            throw new IllegalArgumentException("dirToScan can't be null.");

        DirectoryScanner ds = new DirectoryScanner();
        String[] includes = { this.pattern };
        //String[] excludes = {"modules\\*\\**"};
        ds.setIncludes(includes);
        //ds.setExcludes(excludes);
        ds.setBasedir( dirToScan );
        //ds.setCaseSensitive(true);
        ds.scan();

        String[] matches = ds.getIncludedFiles();
        return Arrays.asList( matches );
    }

    public List<File> listAsFiles( File dirToScan ) throws IOException {
        List<String> matches = this.list( dirToScan );
        List<File> files = new ArrayList(matches.size());
        for( String path : matches ) {
            files.add( new File( path ) );
        }
        return files;
    }

}// class

Split the transformation to File's.

Split the transformation to File's.


package me.pagarme;

import me.pagar.model.Address;
import me.pagar.model.Customer;
import me.pagar.model.PagarMeException;
import me.pagar.model.Phone;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.util.Collection;

public class CustomerTest extends BaseTest {

    private Customer customer;

    @Before
    public void setUp() {
        super.setUp();
        customer = new Customer();
    }

    @Test
    public void testCreateCustomer() {

        Customer customer = this.customerCreateCommon();

        try {
            customer.save();

            Address customerAddress = customer.getAddress();
            Phone customerPhone = customer.getPhone();

            this.assertCustomer(customer, customerAddress, customerPhone);

        } catch (PagarMeException ex) {
            throw new UnsupportedOperationException(ex);
        }

    }

    @Test
    public void testCustomerFind() {

        Customer customer = this.customerCreateCommon();

        try {

            customer.save();

            Integer customerId = customer.getId();
            customer.find(customerId);

            Address customerAddress = customer.getAddress();
            Phone customerPhone = customer.getPhone();

           this.assertCustomer(customer, customerAddress, customerPhone);

        } catch (PagarMeException ex) {
            throw new UnsupportedOperationException(ex);
        }
    }

    @Test
    public void testCustomerCollectionFind() {
        Customer createCustomer = this.customerCreateCommon();

        try {
            createCustomer.save();

            Collection<Customer> customerCollection = customer.findCollection(1,0);
            Assert.assertEquals(customerCollection.size(), 1);
        } catch (PagarMeException ex) {
            throw new UnsupportedOperationException(ex);
        }
    }
}

package me.pagarme;

import me.pagar.model.Address;
import me.pagar.model.Customer;
import me.pagar.model.PagarMeException;
import me.pagar.model.Phone;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.util.Collection;

public class CustomerTest extends BaseTest {

    private Customer customer;

    @Before
    public void setUp() {
        super.setUp();
        customer = new Customer();
    }

    @Test
    public void testCreateCustomer() {

        Customer customer = this.customerCreateCommon();

        try {
            customer.save();

            Address customerAddress = customer.getAddress();
            Phone customerPhone = customer.getPhone();

            this.assertCustomer(customer, customerAddress, customerPhone);

        } catch (PagarMeException ex) {
            throw new UnsupportedOperationException(ex);
        }

    }

    @Test
    public void testCustomerFind() {

        Customer customer = this.customerCreateCommon();

        try {

            customer.save();

            Integer customerId = customer.getId();
            customer.find(customerId);

            Address customerAddress = customer.getAddress();
            Phone customerPhone = customer.getPhone();

           this.assertCustomer(customer, customerAddress, customerPhone);

        } catch (PagarMeException ex) {
            throw new UnsupportedOperationException(ex);
        }
    }
}

Fix test customer collection find

Fix test customer collection find


// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC 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.openqa.selenium.remote.server.rest;

import static org.junit.Assert.*;

import org.junit.Test;
import org.openqa.selenium.remote.Response;
import org.openqa.selenium.remote.SessionId;

import java.util.Optional;

public class ResponsesTest {

  @Test
  public void shouldAddScreenshotIfPresent() {
    Response response = Responses.failure(
        new SessionId("cheese"),
        new RuntimeException("boo"),
        Optional.of("hello"));

    System.out.println("response = " + response);
  }

}

// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC 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.openqa.selenium.remote.server.rest;

import org.junit.Test;
import org.openqa.selenium.remote.Response;
import org.openqa.selenium.remote.SessionId;

import java.util.Optional;

public class ResponsesTest {

  @Test
  public void shouldAddScreenshotIfPresent() {
    Response response = Responses.failure(
        new SessionId("cheese"),
        new RuntimeException("boo"),
        Optional.of("hello"));

    System.out.println("response = " + response);
  }

}

Add a test to make sure screenshots are added to exceptions


package org.realityforge.replicant.server;

import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class ChannelLinkTest
{
  @Test
  public void basicOperation()
  {
    final ChannelLink link = new ChannelLink( new ChannelDescriptor( 22, 44 ), new ChannelDescriptor( 1, "2" ) );
    assertEquals( link.getSourceChannel().getChannelID(), 22 );
    assertEquals( link.getSourceChannel().getSubChannelID(), 44 );
    assertEquals( link.getTargetChannel().getChannelID(), 1 );
    assertEquals( link.getTargetChannel().getSubChannelID(), "2" );
  }

  @Test( expectedExceptions = IllegalArgumentException.class )
  public void badTargetDescriptor()
  {
    new ChannelLink( new ChannelDescriptor( 22, 44 ), new ChannelDescriptor( 1, null ) );
  }

  @Test( expectedExceptions = IllegalArgumentException.class )
  public void badSourceDescriptor()
  {
    new ChannelLink( new ChannelDescriptor( 22, null ), new ChannelDescriptor( 1, "2" ) );
  }
}

package org.realityforge.replicant.server;

import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class ChannelLinkTest
{
  @Test
  public void basicOperation()
  {
    final ChannelLink link = new ChannelLink( new ChannelDescriptor( 22, 44 ), new ChannelDescriptor( 1, "2" ) );
    assertEquals( link.getSourceChannel().getChannelID(), 22 );
    assertEquals( link.getSourceChannel().getSubChannelID(), 44 );
    assertEquals( link.getTargetChannel().getChannelID(), 1 );
    assertEquals( link.getTargetChannel().getSubChannelID(), "2" );
  }
}

Remove tests that no longer represent intended behaviour


package be.thibaulthelsmoortel.navigationbuilder;

/**
 * Utilities to perform navigation operations.
 *
 * @author Thibault Helsmoortel
 */
public class NavigationUtils {

    /**
     * Returns a builder for navigation creation.
     *
     * @return the builder for navigation creation
     */
    public static NavigateBuilder navigate() {
        return new NavigateBuilder();
    }
}

package be.thibaulthelsmoortel.navigationbuilder;

/**
 * Utilities to perform navigation operations.
 *
 * @author Thibault Helsmoortel
 */
public class NavigationUtils {

    /**
     * Returns a builder for navigation creation.
     *
     * @return the builder for navigation creation
     */
    public static NavigateBuilder navigate() {
        return new NavigateBuilder();
    }

    /**
     * Returns a pre-configured reload navigation.
     *
     * @return a pre-configured reload navigation
     */
    public static NavigateBuilder createReloadNavigation() {
        NavigateBuilder navigateBuilder = new NavigateBuilder();
        navigateBuilder.reload();
        return navigateBuilder;
    }
}

Add util method for creating pre-configured reload navigation


package info.u_team.u_team_core.gui.render;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.inventory.container.PlayerContainer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;

public class FluidInventoryRender {

	private static final ResourceLocation ATLAS = PlayerContainer.LOCATION_BLOCKS_TEXTURE;

}

package info.u_team.u_team_core.gui.render;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.inventory.container.PlayerContainer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;

public class FluidInventoryRender {

	private static final ResourceLocation ATLAS = PlayerContainer.LOCATION_BLOCKS_TEXTURE;

	private static TextureAtlasSprite getFluidSprite(FluidStack fluidStack) {
		return Minecraft.getInstance().getAtlasSpriteGetter(ATLAS).apply(fluidStack.getFluid().getAttributes().getStillTexture(fluidStack));
	}

}

Add method to get the fluid sprite of a fluid stack


/*
 * Copyright 2005-2010 The Kuali Foundation
 *
 * Licensed under the Educational Community 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.opensource.org/licenses/ecl1.php
 *
 * 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.kuali.kra.iacuc.personnel;

import org.kuali.kra.protocol.personnel.ProtocolPerson;

public class IacucProtocolPerson extends ProtocolPerson {

    /**
     * Comment for serialVersionUID
     */
    private static final long serialVersionUID = 6676849646094141708L;

}

/*
 * Copyright 2005-2010 The Kuali Foundation
 *
 * Licensed under the Educational Community 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.opensource.org/licenses/ecl1.php
 *
 * 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.kuali.kra.iacuc.personnel;

import org.kuali.kra.iacuc.IacucProtocol;
import org.kuali.kra.protocol.personnel.ProtocolPerson;

public class IacucProtocolPerson extends ProtocolPerson {

    private static final long serialVersionUID = 6676849646094141708L;

    public IacucProtocol getIacucProtocol() {
        return (IacucProtocol) getProtocol();
    }

}

KCIAC-332: Implement COI event type of "IACUC Protocol"


package com.balthazargronon.RCTZeroconf;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

/**
 * Created by Jeremy White on 8/1/2016.
 * Copyright © 2016 Balthazar Gronon MIT
 */
public class ZeroconfReactPackage implements ReactPackage {

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return new ArrayList<>();
    }

    @Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return new ArrayList<>();
    }

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

        modules.add(new ZeroconfModule(reactContext));

        return modules;
    }
}

package com.balthazargronon.RCTZeroconf;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

/**
 * Created by Jeremy White on 8/1/2016.
 * Copyright © 2016 Balthazar Gronon MIT
 */
public class ZeroconfReactPackage implements ReactPackage {

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return new ArrayList<>();
    }

    // Deprecated RN 0.47
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return new ArrayList<>();
    }

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

        modules.add(new ZeroconfModule(reactContext));

        return modules;
    }
}

Fix RN 0.47 breaking change

Fix RN 0.47 breaking change


package com.benny.openlauncher.widget;

import android.content.Context;
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.widget.TextView;

import com.benny.openlauncher.manager.Setup;

public class ColorPreferenceCategory extends PreferenceCategory {
    public ColorPreferenceCategory(Context context) {
        super(context);
    }

    public ColorPreferenceCategory(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ColorPreferenceCategory(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public void onBindViewHolder(PreferenceViewHolder holder) {
        super.onBindViewHolder(holder);
        TextView titleView = (TextView) holder.findViewById(android.R.id.title);
        titleView.setTextColor(Setup.appSettings().getPrimaryColor());
    }
}

package com.benny.openlauncher.widget;

import android.content.Context;
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.widget.TextView;

import com.benny.openlauncher.util.AppSettings;

public class ColorPreferenceCategory extends PreferenceCategory {
    public ColorPreferenceCategory(Context context) {
        super(context);
    }

    public ColorPreferenceCategory(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ColorPreferenceCategory(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public void onBindViewHolder(PreferenceViewHolder holder) {
        super.onBindViewHolder(holder);
        TextView titleView = (TextView) holder.findViewById(android.R.id.title);
        titleView.setTextColor(AppSettings.get().getPrimaryColor());
    }
}

Fix NullPointerException when restoring backup


package com.github.sulir.runtimesearch.runtime;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;

public class Check {
    public static final int PORT = 4321;
    public static String searchValue;

    public static void initialize() {
        try {
            throw new BreakpointError();
        } catch (BreakpointError e) { }
    }

    public static void runServer() {
        try {
            ServerSocket server = new ServerSocket(PORT, 0, InetAddress.getLoopbackAddress());

            Thread thread = new Thread(() -> {
                while (true) {
                    try {
                        Socket client = server.accept();
                        ObjectInputStream input = new ObjectInputStream(client.getInputStream());
                        searchValue = (String) input.readObject();
                        client.close();
                    } catch (IOException | ClassNotFoundException e) {
                        e.printStackTrace();
                    }
                }
            });

            thread.setDaemon(true);
            thread.start();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void perform(Object object) {
        if (searchValue == null)
            return;

        if (object instanceof String) {
            String string = (String) object;
            if (string.contains(searchValue)) {
                try {
                    searchValue = null;
                    throw new BreakpointError();
                } catch (BreakpointError e) { }
            }
        }
    }
}

package com.github.sulir.runtimesearch.runtime;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;

public class Check {
    public static final int PORT = 4321;
    public static String searchValue;

    public static void initialize() {
        try {
            throw new BreakpointError();
        } catch (BreakpointError e) {
            // exception thrown to trigger a breakpoint in the IDE
        }
    }

    public static void runServer() {
        try {
            ServerSocket server = new ServerSocket(PORT, 0, InetAddress.getLoopbackAddress());

            Thread thread = new Thread(() -> {
                while (true) {
                    try {
                        Socket client = server.accept();
                        ObjectInputStream input = new ObjectInputStream(client.getInputStream());
                        searchValue = (String) input.readObject();
                        client.close();
                    } catch (IOException | ClassNotFoundException e) {
                        e.printStackTrace();
                    }
                }
            });

            thread.setDaemon(true);
            thread.start();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void perform(Object object) {
        if (searchValue == null)
            return;

        if (object instanceof String) {
            String string = (String) object;
            if (string.contains(searchValue)) {
                try {
                    searchValue = null;
                    throw new BreakpointError();
                } catch (BreakpointError e) {
                    // exception thrown to trigger a breakpoint in the IDE
                }
            }
        }
    }
}

Fix IDE warnings in the agent

Fix IDE warnings in the agent


package uk.ac.ebi.quickgo.index.annotation;

/**
 * A class for creating stubbed annotations, representing rows of data read from
 * annotation source files.
 *
 * Created 22/04/16
 * @author Edd
 */
public class AnnotationMocker {
    public static Annotation createValidAnnotation() {
        Annotation annotation = new Annotation();

        annotation.db = "IntAct";
        annotation.dbObjectId = "EBI-10043081";
        annotation.dbReferences = "PMID:12871976";
        annotation.qualifier = "enables";
        annotation.goId = "GO:0000977";
        annotation.interactingTaxonId = "taxon:12345";
        annotation.evidenceCode = "ECO:0000353";
        annotation.with = "GO:0036376,GO:1990573";
        annotation.assignedBy = "IntAct";
        annotation.annotationExtension = "occurs_in(CL:1000428)";
        annotation.annotationProperties = "go_evidence=IEA|taxon_id=35758|db_subset=TrEMBL|db_object_symbol=moeA5|db_object_type=protein|db_object_type=protein|target_set=BHF-UCL,Exosome,KRUK|taxon_lineage=1,2,3,4";
        return annotation;
    }
}

package uk.ac.ebi.quickgo.index.annotation;

/**
 * A class for creating stubbed annotations, representing rows of data read from
 * annotation source files.
 *
 * Created 22/04/16
 * @author Edd
 */
public class AnnotationMocker {
    public static Annotation createValidAnnotation() {
        Annotation annotation = new Annotation();

        annotation.db = "IntAct";
        annotation.dbObjectId = "EBI-10043081";
        annotation.dbReferences = "PMID:12871976";
        annotation.qualifier = "enables";
        annotation.goId = "GO:0000977";
        annotation.interactingTaxonId = "taxon:12345";
        annotation.evidenceCode = "ECO:0000353";
        annotation.with = "GO:0036376,GO:1990573";
        annotation.assignedBy = "IntAct";
        annotation.annotationExtension = "occurs_in(CL:1000428)";
        annotation.annotationProperties =
                "go_evidence=IEA|taxon_id=35758|db_subset=TrEMBL|db_object_symbol=moeA5|db_object_type=protein" +
                        "|target_set=BHF-UCL,Exosome,KRUK|taxon_lineage=1,2,3,4";
        return annotation;
    }
}

Remove duplicated db_object_type=protein from the test value for annotation properties.