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

package org.opensaml.xml.encryption;

import java.security.KeyException;

import org.opensaml.xml.security.KeyInfoResolver;

/**
 * Resolves encrypted keys based on EncryptedData information or other external factors.
 */
public interface EncryptedKeyInfoResolver extends KeyInfoResolver {

    /**
     * Returns an encrypted key based on a particular EncryptedData context.
     *
     * @param encryptedData the EncryptedData context in which to look for EncryptedKey
     * @return the resolved EncryptedKey element
     * @throws KeyException thrown if there is a problem resolving a key
     */
    public EncryptedKey resolveKey(EncryptedData encryptedData) throws KeyException;

}

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

package org.opensaml.xml.encryption;

import java.security.KeyException;
import java.security.PublicKey;

import org.opensaml.xml.security.KeyInfoResolver;

/**
 * Resolves encrypted keys based on EncryptedData information or other external factors.
 */
public interface EncryptedKeyInfoResolver extends KeyInfoResolver<PublicKey> {

    /**
     * Returns an encrypted key based on a particular EncryptedData context.
     *
     * @param encryptedData the EncryptedData context in which to look for EncryptedKey
     * @return the resolved EncryptedKey element
     * @throws KeyException thrown if there is a problem resolving a key
     */
    public EncryptedKey resolveKey(EncryptedData encryptedData) throws KeyException;

}

Set key type for resolver

Set key type for resolver

git-svn-id: 46308aa6df3a13aea5930e6665b35c8b83c3a711@276 9fbd0cf9-a10c-0410-82c1-be8c084f3200


/*
 * Licensed to the University of California, Berkeley 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 tachyon.security;

import java.security.Principal;

public class User implements Principal {
  private String mName;

  // TODO: add more attributes and methods for supporting Kerberos

  public User(String mName) {
    this.mName = mName;
  }

  @Override
  public String getName() {
    return mName;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    } else if (o == null || getClass() != o.getClass()) {
      return false;
    } else {
      return mName.equals(((User) o).mName);
    }
  }

  @Override
  public int hashCode() {
    return mName.hashCode();
  }

  @Override
  public String toString() {
    return mName;
  }
}

/*
 * Licensed to the University of California, Berkeley 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 tachyon.security;

import java.security.Principal;

public class User implements Principal {
  private String mName;

  // TODO: add more attributes and methods for supporting Kerberos

  public User(String name) {
    mName = name;
  }

  @Override
  public String getName() {
    return mName;
  }

  @Override
  public boolean equals(Object o) {
    if (o == null || getClass() != o.getClass()) {
      return false;
    } else {
      return mName.equals(((User) o).mName);
    }
  }

  @Override
  public int hashCode() {
    return mName.hashCode();
  }

  @Override
  public String toString() {
    return mName;
  }
}

Add user model - address comments

TACHYON-600: Add user model - address comments


package com.push.pushapplication;

import java.net.URI;
import java.net.URISyntaxException;

import org.jboss.aerogear.android.unifiedpush.PushConfig;
import org.jboss.aerogear.android.unifiedpush.PushRegistrar;
import org.jboss.aerogear.android.unifiedpush.Registrations;

import android.app.Application;

public class PushApplication extends Application {

    private final String VARIANT_ID       = "{{ variant.variantID }}";
    private final String SECRET           = "{{ variant.secret }}";
    private final String GCM_SENDER_ID    = "{{ variant.projectNumber }}";
    private final String UNIFIED_PUSH_URL = "{{ contextPath }}";

    private PushRegistrar registration;

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

        Registrations registrations = new Registrations();

        try {
            PushConfig config = new PushConfig(new URI(UNIFIED_PUSH_URL), GCM_SENDER_ID);
            config.setVariantID(VARIANT_ID);
            config.setSecret(SECRET);
            config.setAlias(MY_ALIAS);

            registration = registrations.push("unifiedpush", config);

            registration.register(getApplicationContext(), new Callback() {
                private static final long serialVersionUID = 1L;

                @Override
                public void onSuccess(Void ignore) {
                     Toast.makeText(MainActivity.this, "Registration Succeeded!",
                             Toast.LENGTH_LONG).show();
               }

               @Override
               public void onFailure(Exception exception) {
                     Log.e("MainActivity", exception.getMessage(), exception);
               }
            });

        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
    }
}

package com.push.pushapplication;

import android.util.Log;
import android.app.Application;

import org.jboss.aerogear.android.core.Callback;
import org.jboss.aerogear.android.unifiedpush.PushRegistrar;
import org.jboss.aerogear.android.unifiedpush.RegistrarManager;
import org.jboss.aerogear.android.unifiedpush.gcm.AeroGearGCMPushConfiguration;

public class PushApplication extends Application {

    private final String VARIANT_ID       = "{{ variant.variantID }}";
    private final String SECRET           = "{{ variant.secret }}";
    private final String GCM_SENDER_ID    = "{{ variant.projectNumber }}";
    private final String UNIFIED_PUSH_URL = "{{ contextPath }}";

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

        RegistrarManager.config("register", AeroGearGCMPushConfiguration.class)
                    .setPushServerURI(URI.create(UNIFIED_PUSH_URL))
                    .setSenderIds(GCM_SENDER_ID)
                    .setVariantID(VARIANT_ID)
                    .setSecret(SECRET)
                    .asRegistrar();

        PushRegistrar registrar = RegistrarManager.getRegistrar("register");
        registrar.register(getApplicationContext(), new Callback<Void>() {
            @Override
            public void onSuccess(Void data) {
                Log.i(TAG, "Registration Succeeded!");
            }

            @Override
            public void onFailure(Exception e) {
                Log.e(TAG, exception.getMessage(), exception);
            }
        });

    }
}

Update Android registration code snippet


import static org.junit.Assert.*;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class TetrisTest
{
    @Test
    public void shouldReturnTwo()
    {
        //assertEquals(Tetris.returnTwo(), 2);
    }
}

import static org.junit.Assert.*;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class TetrisTest
{

}

Add test for the main

Add test for the main


package org.percepta.mgrankvi;

import java.io.Serializable;

/**
 * Position of component containing top and left position in relation to parent.
 *
 * @author Mikael Grankvist - Vaadin }>
 */
public class Position implements Serializable {

    private Integer topValue = 0;
    private Integer leftValue = 0;

    public Position() {
    }

    public Position(Integer topValue, Integer leftValue) {
        this.topValue = topValue;
        this.leftValue = leftValue;
    }

    public Integer getTopValue() {
        return topValue;
    }

    public void setTopValue(Integer topValue) {
        this.topValue = topValue;
    }

    public Integer getLeftValue() {
        return leftValue;
    }

    public void setLeftValue(Integer leftValue) {
        this.leftValue = leftValue;
    }

    public Integer[] toArray() {
        return new Integer[]{topValue, leftValue};
    }
}

package org.percepta.mgrankvi;

import java.io.Serializable;

/**
 * Position of component containing top and left position in relation to parent.
 *
 * @author Mikael Grankvist - Vaadin }>
 */
public class Position implements Serializable {

    private Integer topValue = 0;
    private Integer leftValue = 0;

    public Position() {
    }

    public Position(Integer leftValue, Integer topValue) {
        this.topValue = topValue;
        this.leftValue = leftValue;
    }

    public Integer getTopValue() {
        return topValue;
    }

    public void setTopValue(Integer topValue) {
        this.topValue = topValue;
    }

    public Integer getLeftValue() {
        return leftValue;
    }

    public void setLeftValue(Integer leftValue) {
        this.leftValue = leftValue;
    }

    public Integer[] toArray() {
        return new Integer[]{leftValue, topValue};
    }
}

Fix position to be (left, top) as we use it that way and not as written.


/*
 * 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.
 */
@Version("1.0")
@Export(optional = "provide:=true")
package org.apache.jackrabbit.oak.json;

import aQute.bnd.annotation.Version;
import aQute.bnd.annotation.Export;

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

import aQute.bnd.annotation.Version;
import aQute.bnd.annotation.Export;

OAK-3749: Implement tooling for tracing a node through the revision history
Bump package export version

git-svn-id: 67138be12999c61558c3dd34328380c8e4523e73@1718630 13f79535-47bb-0310-9956-ffa450edef68


package com.iluwatar.callback;

/**
 *
 * Callback pattern is more native for functional languages where functions are treated as
 * first-class citizens. Prior to Java 8 callbacks can be simulated using simple (alike command)
 * interfaces.
 *
 */
public class App {

  /**
   * Program entry point
   */
  public static void main(String[] args) {
    Task task = new SimpleTask();
    Callback callback = new Callback() {
      @Override
      public void call() {
        System.out.println("I'm done now.");
      }
    };
    task.executeWith(callback);
  }
}

package com.iluwatar.callback;

/**
 *
 * Callback pattern is more native for functional languages where functions are treated as
 * first-class citizens. Prior to Java 8 callbacks can be simulated using simple (alike command)
 * interfaces.
 *
 */
public class App {

  /**
   * Program entry point
   */
  public static void main(String[] args) {
    Task task = new SimpleTask();
    Callback callback = () -> System.out.println("I'm done now.");
    task.executeWith(callback);
  }
}

Change callback to lambda expression

[callback] Change callback to lambda expression


package com.wombatnation.privateer;

import static org.junit.Assert.assertEquals;

import org.junit.Ignore;
import org.junit.Test;

public class PrimitivesTest {

	private int intMethod(int a) {
		return a;
	}

//	@Test
	@Ignore
	public void testIntArg() throws Exception {
		Privateer p = new Privateer();

		int a = 1;
		Object result = p.callMethod(this, "intMethod", a);
		Integer i = (Integer) result;
		assertEquals(i.intValue(), a);
	}
}

package com.wombatnation.privateer;

import static org.junit.Assert.assertEquals;

import org.junit.Ignore;
import org.junit.Test;

public class PrimitivesTest {

	private int intMethod(int a) {
		return a;
	}

	@Test
	// Maven demands at least one runnable test
	public void makeMavenHappy() {

	}

//	@Test
	@Ignore
	public void testIntArg() throws Exception {
		Privateer p = new Privateer();

		int a = 1;
		Object result = p.callMethod(this, "intMethod", a);
		Integer i = (Integer) result;
		assertEquals(i.intValue(), a);
	}
}

Make annoying Maven happy by adding runnable test to in progress unit test file


package com.github.nylle.javafixture;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Context {
    private final Configuration configuration;
    private final Map<Integer, Object> cache = new ConcurrentHashMap<>();

    public Context(Configuration configuration) {

        if (configuration == null) {
            throw new IllegalArgumentException("configuration: null");
        }

        this.configuration = configuration;
    }

    public Configuration getConfiguration() {
        return configuration;
    }

    public boolean isCached(SpecimenType type) {
        return cache.containsKey(type.hashCode());
    }

    public <T> T cached(SpecimenType type, T instance) {
        cache.putIfAbsent(type.hashCode(), instance);
        return (T) cache.get(type.hashCode());
    }

    public <T> T cached(SpecimenType type) {
        return (T) cache.get(type.hashCode());
    }
}

package com.github.nylle.javafixture;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Context {
    private final Configuration configuration;
    private final Map<Integer, Object> cache;

    public Context(Configuration configuration) {

        if (configuration == null) {
            throw new IllegalArgumentException("configuration: null");
        }

        this.configuration = configuration;
        this.cache = new ConcurrentHashMap<>();
    }

    public Context(Configuration configuration, Map<Integer, Object> predefinedInstances) {

        if (configuration == null) {
            throw new IllegalArgumentException("configuration: null");
        }

        this.configuration = configuration;
        this.cache = new ConcurrentHashMap<>(predefinedInstances);
    }

    public Configuration getConfiguration() {
        return configuration;
    }

    public boolean isCached(SpecimenType type) {
        return cache.containsKey(type.hashCode());
    }

    public <T> T cached(SpecimenType type, T instance) {
        cache.putIfAbsent(type.hashCode(), instance);
        return (T) cache.get(type.hashCode());
    }

    public <T> T cached(SpecimenType type) {
        return (T) cache.get(type.hashCode());
    }

    public <T> T preDefined(SpecimenType type, T instance) {
        return cache.containsKey(type.hashCode()) ? (T) cache.get(type.hashCode()) : instance;
    }

}

Add read-only cache to context

JAVAFIXTURE-52: Add read-only cache to context

This will alow to predefine instances per type.


/*
 * Copyright 2016 FabricMC
 *
 * 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.fabricmc.base;

import net.fabricmc.api.Side;
import net.minecraft.client.Minecraft;
import net.minecraft.sortme.EntityPlayerAbstract;

public class ClientSidedHandler implements ISidedHandler {

	@Override
	public Side getSide() {
		return Side.CLIENT;
	}

	@Override
	public EntityPlayerAbstract getClientPlayer() {
		return Minecraft.getInstance().player;
	}

	@Override
	public void runOnMainThread(Runnable runnable) {
		Minecraft.getInstance().scheduleOnMainThread(runnable);
	}

}

/*
 * Copyright 2016 FabricMC
 *
 * 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.fabricmc.base;

import net.fabricmc.api.Side;
import net.minecraft.client.Minecraft;
import net.minecraft.sortme.EntityPlayerAbstract;

public class ClientSidedHandler implements ISidedHandler {

	@Override
	public Side getSide() {
		return Side.CLIENT;
	}

	@Override
	public EntityPlayerAbstract getClientPlayer() {
		return Minecraft.getInstance().player;
	}

	@Override
	public void runOnMainThread(Runnable runnable) {
		if (Minecraft.getInstance().isMainThread()) {
			runnable.run();
		} else {
			Minecraft.getInstance().scheduleOnMainThread(runnable);
		}
	}

}

Check main thread before scheduling

Check main thread before scheduling


package net.thechunk.playpen.utils;

import net.thechunk.playpen.protocol.Protocol;
import org.apache.commons.codec.binary.Hex;

import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class AuthUtils {

    public static String createHash(String key, String message) {
        return createHash(key, message.getBytes(StandardCharsets.UTF_8));
    }

    public static String createHash(String key, byte[] message) {
        MessageDigest digest;

        try {
            digest = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            throw new AssertionError(e);
        }

        String mpk = new String(message) + key;
        digest.update(mpk.getBytes());

        return Hex.encodeHexString(digest.digest());
    }

    public static boolean validateHash(String hash, String key, String message) {
        return validateHash(hash, key, message.getBytes(StandardCharsets.UTF_8));
    }

    public static boolean validateHash(String hash, String key, byte[] message) {
        return hash.equals(createHash(key, message));
    }

    public static boolean validateHash(Protocol.AuthenticatedMessage payload, String key) {
        return validateHash(payload.getHash(), key, payload.getPayload().toByteArray());
    }

    private AuthUtils() {}
}

package net.thechunk.playpen.utils;

import net.thechunk.playpen.protocol.Protocol;
import org.apache.commons.codec.binary.Hex;

import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class AuthUtils {

    public static String createHash(String key, String message) {
        return createHash(key, message.getBytes(StandardCharsets.UTF_8));
    }

    public static String createHash(String key, byte[] message) {
        MessageDigest digest;

        try {
            digest = MessageDigest.getInstance("SHA-1");
        } catch (NoSuchAlgorithmException e) {
            throw new AssertionError(e);
        }

        String mpk = new String(message) + key;
        digest.update(mpk.getBytes());

        return Hex.encodeHexString(digest.digest());
    }

    public static boolean validateHash(String hash, String key, String message) {
        return validateHash(hash, key, message.getBytes(StandardCharsets.UTF_8));
    }

    public static boolean validateHash(String hash, String key, byte[] message) {
        return hash.equals(createHash(key, message));
    }

    public static boolean validateHash(Protocol.AuthenticatedMessage payload, String key) {
        return validateHash(payload.getHash(), key, payload.getPayload().toByteArray());
    }

    private AuthUtils() {}
}

Revert "hashes are apparently not working, going to test md5 again"

This reverts commit f6667a6a1c85a316caa1691b75f4aa412aa66072.


/*
 * 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.commons.pool2;

/**
 * A base class for common functionality.
 *
 * @since 2.4.3
 */
public abstract class BaseObject {

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append(getClass().getSimpleName());
        builder.append(" [");
        toStringAppendFields(builder);
        builder.append("]");
        return builder.toString();
    }

    protected void toStringAppendFields(StringBuilder builder) {
        // do nothing by default, needed for b/w compatibility.
    }

}

Set svn:eol-style = native on Java files. No functional change.

Noted when running checks on the copy of Apache Commons Pool in Apache Tomcat.

git-svn-id: a66ef3f0e6c00b14098e182847b4bd646263fa09@1725959 13f79535-47bb-0310-9956-ffa450edef68


package com.github.aureliano.edocs.app.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class AppFrame extends JFrame {

	private static final long serialVersionUID = 7618501026967569839L;

	public AppFrame() {
		this.buildGui();
	}

	private void buildGui() {
		super.setTitle("e-Docs");
		super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		JPanel panel = new JPanel(new BorderLayout());
		panel.setOpaque(true);
		super.setContentPane(panel);
	}

	public void showFrame() {
		super.pack();
		super.setVisible(true);
		super.setSize(new Dimension(500, 500));
	}
}

package com.github.aureliano.edocs.app.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;

import com.github.aureliano.edocs.app.gui.menu.MenuBar;

public class AppFrame extends JFrame {

	private static final long serialVersionUID = 7618501026967569839L;

	public AppFrame() {
		this.buildGui();
	}

	private void buildGui() {
		super.setTitle("e-Docs");
		super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		JPanel panel = new JPanel(new BorderLayout());
		panel.setOpaque(true);
		super.setContentPane(panel);

		super.setJMenuBar(new MenuBar());
	}

	public void showFrame() {
		super.pack();
		super.setVisible(true);
		super.setSize(new Dimension(500, 500));
	}
}

Set a menu bar to the frame.

Set a menu bar to the frame.


package com.jstanier;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Reader;
import java.util.List;

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

import com.googlecode.jcsv.CSVStrategy;
import com.googlecode.jcsv.reader.CSVReader;
import com.googlecode.jcsv.reader.internal.CSVReaderBuilder;

@Component
public class InputParser {

    @Autowired
    private InputReader inputReader;

    public List<TweetToSchedule> parseInput(String pathToCsvFile) {
        return parseCsvFile(pathToCsvFile);
    }

    private List<TweetToSchedule> parseCsvFile(String pathToCsvFile) {
        List<TweetToSchedule> csvData = null;
        try {
            Reader reader = inputReader.getInputReader(pathToCsvFile);
            CSVReader<TweetToSchedule> csvParser = createCSVReader(reader);
            csvData = csvParser.readAll();
        } catch (FileNotFoundException e) {
            exitWithError("File not found at " + pathToCsvFile);
        } catch (IOException e) {
            exitWithError("IO exception when reading " + pathToCsvFile);
        }
        return csvData;
    }

    private CSVReader<TweetToSchedule> createCSVReader(Reader reader) {
        return (CSVReader<TweetToSchedule>) new CSVReaderBuilder(reader)
                .strategy(CSVStrategy.UK_DEFAULT)
                .entryParser(new TweetToScheduleEntryParser()).build();
    }

    private void exitWithError(String error) {
        System.err.println(error);
        System.exit(1);
    }
}

package com.jstanier;

import java.io.IOException;
import java.io.Reader;
import java.util.List;

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

import com.googlecode.jcsv.CSVStrategy;
import com.googlecode.jcsv.reader.CSVReader;
import com.googlecode.jcsv.reader.internal.CSVReaderBuilder;

@Component
public class InputParser {

    @Autowired
    private InputReader inputReader;

    public List<TweetToSchedule> parseInput(String pathToCsvFile) {
        return parseCsvFile(pathToCsvFile);
    }

    private List<TweetToSchedule> parseCsvFile(String pathToCsvFile) {
        List<TweetToSchedule> csvData = null;
        Reader reader = inputReader.getInputReader(pathToCsvFile);
        CSVReader<TweetToSchedule> csvParser = createCSVReader(reader);
        try {
            csvData = csvParser.readAll();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return csvData;
    }

    private CSVReader<TweetToSchedule> createCSVReader(Reader reader) {
        return (CSVReader<TweetToSchedule>) new CSVReaderBuilder(reader)
                .strategy(CSVStrategy.UK_DEFAULT)
                .entryParser(new TweetToScheduleEntryParser()).build();
    }
}

Throw RuntimeException instead of System.exit


package sc.iview.ui;

import graphics.scenery.Node;

import javax.swing.*;

public class ContextPopUp extends JPopupMenu {

    JMenuItem anItem;
    public ContextPopUp(Node n) {
        anItem = new JMenuItem("I'm a " + n.getNodeType());
        add(anItem);
    }

}

package sc.iview.ui;

import graphics.scenery.Node;

import javax.swing.*;

public class ContextPopUp extends JPopupMenu {

    public ContextPopUp(Node n) {
        add( new JMenuItem("Name: " + n.getName()) );
        add( new JMenuItem("Type: " + n.getNodeType()) );
    }

}

Make context menu look a little more reasonable


package com.mcjty.rftools.blocks.teleporter;

import net.minecraft.entity.Entity;
import net.minecraft.world.Teleporter;
import net.minecraft.world.WorldServer;

public class RfToolsTeleporter extends Teleporter {
    private final WorldServer worldServerInstance;

    private double x;
    private double y;
    private double z;

    public RfToolsTeleporter(WorldServer world, double x, double y, double z) {
        super(world);
        this.worldServerInstance = world;
        this.x = x;
        this.y = y;
        this.z = z;

    }

    @Override
    public void placeInPortal(Entity pEntity, double p2, double p3, double p4, float p5) {
        this.worldServerInstance.getBlock((int) this.x, (int) this.y, (int) this.z);   //dummy load to maybe gen chunk

        pEntity.setPosition(this.x, this.y, this.z);
//        pEntity.setVelocity();
    }

}

package com.mcjty.rftools.blocks.teleporter;

import net.minecraft.entity.Entity;
import net.minecraft.world.Teleporter;
import net.minecraft.world.WorldServer;

public class RfToolsTeleporter extends Teleporter {
    private final WorldServer worldServerInstance;

    private double x;
    private double y;
    private double z;

    public RfToolsTeleporter(WorldServer world, double x, double y, double z) {
        super(world);
        this.worldServerInstance = world;
        this.x = x;
        this.y = y;
        this.z = z;

    }

    @Override
    public void placeInPortal(Entity pEntity, double p2, double p3, double p4, float p5) {
        this.worldServerInstance.getBlock((int) this.x, (int) this.y, (int) this.z);   //dummy load to maybe gen chunk

        pEntity.setPosition(this.x, this.y, this.z);
        pEntity.motionX = 0.0f;
        pEntity.motionY = 0.0f;
        pEntity.motionZ = 0.0f;
    }

}

Reset movement speed after going through a teleporter


package ru.yandex.qatools.allure.storages;

import ru.yandex.qatools.allure.model.Step;

import java.util.LinkedList;

/**
 * @author Dmitry Baev charlie@yandex-team.ru
 *         Date: 13.12.13
 */
public class StepStorage extends ThreadLocal<LinkedList<Step>> {
    @Override
    protected LinkedList<Step> initialValue() {
        LinkedList<Step> queue = new LinkedList<>();
        queue.add(new Step());
        return queue;
    }

    public Step getLast() {
        return get().getLast();
    }

    public void put(Step step) {
        get().add(step);
    }

    public Step pollLast() {
        return get().pollLast();
    }
}

package ru.yandex.qatools.allure.storages;

import ru.yandex.qatools.allure.model.Step;

import java.util.Deque;
import java.util.LinkedList;

/**
 * @author Dmitry Baev charlie@yandex-team.ru
 *         Date: 13.12.13
 */
public class StepStorage extends ThreadLocal<Deque<Step>> {
    @Override
    protected Deque<Step> initialValue() {
        Deque<Step> queue = new LinkedList<>();
        queue.add(new Step());
        return queue;
    }

    public Step getLast() {
        return get().getLast();
    }

    public void put(Step step) {
        get().add(step);
    }

    public Step pollLast() {
        return get().pollLast();
    }
}

Use interface instead of class in generic


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

package app.abhijit.iter;

import android.os.Bundle;
import android.preference.PreferenceFragment;

import app.abhijit.iter.R;

public class SettingsFragment extends PreferenceFragment {

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.preferences);
    }
}

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

package app.abhijit.iter;

import android.os.Bundle;
import android.preference.PreferenceFragment;

public class SettingsFragment extends PreferenceFragment {

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.preferences);
    }
}

Remove unused imports in settings fragment


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

package com.google.template.soy.jbcsrc.restricted;

/** Holds flags controlling compiler behavior. */
public final class Flags {
  /**
   * Controls extra debug checks in the compiler that are generally redundant with bytecode
   * verification. Currently only enabled in tests.
   */
  public static final boolean DEBUG = true; // Boolean.getBoolean("soy_jbcsrc_debug_mode");

  private Flags() {}
}

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

package com.google.template.soy.jbcsrc.restricted;

/** Holds flags controlling compiler behavior. */
public final class Flags {
  /**
   * Controls extra debug checks in the compiler that are generally redundant with bytecode
   * verification. Currently only enabled in tests.
   */
  public static final boolean DEBUG = Boolean.getBoolean("soy_jbcsrc_debug_mode");

  private Flags() {}
}

Disable the jbcsrc debug flag, this was accidentally left on in a debugging session.

GITHUB_BREAKING_CHANGES=none

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


package com.voxelwind.server.network.mcpe.packets;

import com.voxelwind.server.network.NetworkPackage;
import io.netty.buffer.ByteBuf;
import lombok.Data;

@Data
public class McpeResourcePackClientResponse implements NetworkPackage {
    private byte responceStatus;
    private short resourcePackIdVersions;

    @Override
    public void decode(ByteBuf buffer) {
        responceStatus = buffer.readByte();
        resourcePackIdVersions = buffer.readShort();
    }

    @Override
    public void encode(ByteBuf buffer) {

    }
}

package com.voxelwind.server.network.mcpe.packets;

import com.voxelwind.server.network.NetworkPackage;
import io.netty.buffer.ByteBuf;
import lombok.Data;

@Data
public class McpeResourcePackClientResponse implements NetworkPackage {
    private byte responseStatus;
    private short resourcePackIdVersions;

    @Override
    public void decode(ByteBuf buffer) {
        responseStatus = buffer.readByte();
        resourcePackIdVersions = buffer.readShort();
    }

    @Override
    public void encode(ByteBuf buffer) {

    }
}

Fix typo in field name (responce->response)


package org.ale.app;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class TwitterLinkCreatorTest {

	@Test
	public void shouldProcessSingleTwitterName() {
		String result = TwitterLinkCreator.process("@foobar");
		assertEquals("@foobar", result);
	}

	@Test
	public void shouldProcessSeveralTwitterNames() {
		String result = TwitterLinkCreator.process("@foo, @bar");
		assertEquals("@foo, @bar", result);
	}

	@Test
	public void shouldProcessNameWithUnderscore() {
		String result = TwitterLinkCreator.process("@foo_bar");
		assertEquals("@foo_bar", result);
	}
}

package org.ale.app;

import static org.junit.Assert.assertEquals;

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

public class TwitterLinkCreatorTest {

    private String twitterAddress;

    @Before
    public void setup(){
        twitterAddress = "@foobar", result);
	}

	@Test
	public void shouldProcessSeveralTwitterNames() {
		String result = TwitterLinkCreator.process("@foo, @bar");

        assertEquals(twitterAddress +"foo\">@foo, @bar", result);
	}

	@Test
	public void shouldProcessNameWithUnderscore() {
		String result = TwitterLinkCreator.process("@foo_bar");

        assertEquals(twitterAddress +"foo_bar\">@foo_bar", result);
	}
}

Refactor tests: Extracted the twitter address to a field


package de.prob2.ui.states;

import java.util.HashSet;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.sun.javafx.collections.ObservableSetWrapper;

import de.prob.model.representation.AbstractElement;
import javafx.collections.ObservableSet;

@Singleton
public class ClassBlacklist {
	private final ObservableSet<Class<? extends AbstractElement>> blacklist;
	private final ObservableSet<Class<? extends AbstractElement>> knownClasses;

	@Inject
	private ClassBlacklist() {
		super();
		this.blacklist = new ObservableSetWrapper<>(new HashSet<>());
		this.knownClasses = new ObservableSetWrapper<>(new HashSet<>());
	}

	public ObservableSet<Class<? extends AbstractElement>> getBlacklist() {
		return this.blacklist;
	}

	public ObservableSet<Class<? extends AbstractElement>> getKnownClasses() {
		return this.knownClasses;
	}
}

package de.prob2.ui.states;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import de.prob.model.representation.AbstractElement;
import javafx.collections.FXCollections;
import javafx.collections.ObservableSet;

@Singleton
public final class ClassBlacklist {
	private final ObservableSet<Class<? extends AbstractElement>> blacklist;
	private final ObservableSet<Class<? extends AbstractElement>> knownClasses;

	@Inject
	@SuppressWarnings("unchecked")
	private ClassBlacklist() {
		super();
		this.blacklist = FXCollections.observableSet();
		this.knownClasses = FXCollections.observableSet();
	}

	public ObservableSet<Class<? extends AbstractElement>> getBlacklist() {
		return this.blacklist;
	}

	public ObservableSet<Class<? extends AbstractElement>> getKnownClasses() {
		return this.knownClasses;
	}
}

Replace use of com.sun ObservableSetWrapper with FXCollections


package scoutmgr.server.rest;

import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath( "/api" )
public class JaxRsActivator
  extends Application
{
  @Override
  public Set<Class<?>> getClasses()
  {
    final Set<Class<?>> classes = new HashSet<>();
    classes.addAll( super.getClasses() );
    classes.add( ScoutmgrSessionRestService.class );
    classes.add( ScoutmgrReplicantPollRestService.class );
    classes.add( ScoutmgrBadSessionExceptionMapper.class );
    return classes;
  }
}

package scoutmgr.server.rest;

import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath( "/api" )
public class JaxRsActivator
  extends Application
{
  @Override
  public Set<Class<?>> getClasses()
  {
    final Set<Class<?>> classes = new HashSet<>();
    classes.addAll( super.getClasses() );
    classes.add( ScoutmgrSessionRestService.class );
    classes.add( ScoutmgrReplicantPollRestService.class );
    return classes;
  }
}

Remove mapper. Unsure why we are keeping this class at all.


package com.pengrad.telegrambot;

import com.google.gson.Gson;
import com.pengrad.telegrambot.impl.FileApi;
import com.pengrad.telegrambot.impl.TelegramBotClient;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;

/**
 * stas
 * 8/4/15.
 */
public class TelegramBotAdapter {

    public static final String API_URL = "https://api.telegram.org/bot";

    public static TelegramBot build(String botToken) {
        FileApi fileApi = new FileApi(botToken);
        TelegramBotClient api = new TelegramBotClient(client(null), gson(), apiUrl(botToken));
        return new TelegramBot(api, fileApi);
    }

    public static TelegramBot buildDebug(String botToken) {
        FileApi fileApi = new FileApi(botToken);
        TelegramBotClient api = new TelegramBotClient(client(httpLoggingInterceptor()), gson(), apiUrl(botToken));
        return new TelegramBot(api, fileApi);
    }

    private static OkHttpClient client(Interceptor interceptor) {
        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        if (interceptor != null) builder.addInterceptor(interceptor);
        return builder.build();
    }

    private static Interceptor httpLoggingInterceptor() {
        return new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY);
    }

    private static Gson gson() {
        return new Gson();
    }

    private static String apiUrl(String botToken) {
        return API_URL + botToken + "/";
    }
}

package com.pengrad.telegrambot;

import com.google.gson.Gson;
import com.pengrad.telegrambot.impl.FileApi;
import com.pengrad.telegrambot.impl.TelegramBotClient;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;

/**
 * stas
 * 8/4/15.
 */
public class TelegramBotAdapter {

    public static final String API_URL = "https://api.telegram.org/bot";

    public static TelegramBot build(String botToken) {
        return buildCustom(botToken, client(null));
    }

    public static TelegramBot buildDebug(String botToken) {
        return buildCustom(botToken, client(httpLoggingInterceptor()));
    }

    public static TelegramBot buildCustom(String botToken, OkHttpClient okHttpClient) {
        TelegramBotClient client = new TelegramBotClient(okHttpClient, gson(), apiUrl(botToken));
        FileApi fileApi = new FileApi(botToken);
        return new TelegramBot(client, fileApi);
    }

    private static OkHttpClient client(Interceptor interceptor) {
        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        if (interceptor != null) builder.addInterceptor(interceptor);
        return builder.build();
    }

    private static Interceptor httpLoggingInterceptor() {
        return new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY);
    }

    private static Gson gson() {
        return new Gson();
    }

    private static String apiUrl(String botToken) {
        return API_URL + botToken + "/";
    }
}

Add support for custom OkHttpClient when creating bot


/*
 * Copyright (c) 2000-2016 TeamDev Ltd. All rights reserved.
 * Use is subject to Apache 2.0 license terms.
 */

package com.teamdev.jxmaps.examples;

import javax.swing.*;

public interface ControlPanel {
    JComponent getControlPanel();

    void configureControlPanel();

    int getPreferredHeight();
}

Remove excessive empty line after copyright header


package examples.dustin.commandline.picocli;

import static java.lang.System.out;

import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

/**
 * Demonstrate Java-based command-line processing with picocli.
 */
@Command(
   name="Main",
   description="@|bold Demonstrating picocli @|",
   headerHeading="@|bold,underline Demonstration Usage|@:%n%n")
public class Main
{
   @Option(names={"-v", "--verbose"}, description="Verbose output?")
   private boolean verbose;

   @Option(names={"-f", "--file"}, description="Path and name of file", required=true)
   private String fileName;

   @Option(names={"-h", "--help"}, description="Display help/usage.", help=true)
   boolean help;

   public static void main(final String[] arguments)
   {
      final Main main = CommandLine.populateCommand(new Main(), arguments);
      if (main.help)
      {
         CommandLine.usage(main, out, CommandLine.Help.Ansi.AUTO);
      }
      else
      {
         out.println("The provided file path and name is " + main.fileName + " and verbosity is set to " + main.verbose);
      }
   }
}

package examples.dustin.commandline.picocli;

import static java.lang.System.out;

import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

/**
 * Demonstrate Java-based command-line processing with picocli.
 */
@Command(
   name="Main",
   description="@|bold Demonstrating picocli |@",
   headerHeading="@|bold,underline Demonstration Usage|@:%n%n")
public class Main
{
   @Option(names={"-v", "--verbose"}, description="Verbose output?")
   private boolean verbose;

   @Option(names={"-f", "--file"}, description="Path and name of file", required=true)
   private String fileName;

   @Option(names={"-h", "--help"}, description="Display help/usage.", help=true)
   boolean help;

   public static void main(final String[] arguments)
   {
      final Main main = CommandLine.populateCommand(new Main(), arguments);
      if (main.help)
      {
         CommandLine.usage(main, out, CommandLine.Help.Ansi.AUTO);
      }
      else
      {
         out.println("The provided file path and name is " + main.fileName + " and verbosity is set to " + main.verbose);
      }
   }
}

Fix descriptions color styling termination

Color styling terminates with |@ instead of @|


package openmods.core;

import java.util.Map;

import net.minecraft.launchwrapper.Launch;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.SortingIndex;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;

//must be lower than all dependent ones
@SortingIndex(16)
@TransformerExclusions({ "openmods.asm.", "openmods.include.", "openmods.core.", "openmods.injector.", "openmods.Log" })
public class OpenModsCorePlugin implements IFMLLoadingPlugin {

	public static final String CORE_MARKER = "OpenModsCoreLoaded";

	public OpenModsCorePlugin() {
		Launch.blackboard.put(CORE_MARKER, "$LIB-VERSION$");
	}

	@Override
	public String[] getASMTransformerClass() {
		return new String[] { "openmods.core.OpenModsClassTransformer" };
	}

	@Override
	public String getModContainerClass() {
		return "openmods.core.OpenModsCore";
	}

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

	@Override
	public void injectData(Map<String, Object> data) {
		Bootstrap.injectData(data);
	}

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

}

package openmods.core;

import java.util.Map;

import net.minecraft.launchwrapper.Launch;
import openmods.Log;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.SortingIndex;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;

//must be lower than all dependent ones
@SortingIndex(16)
@TransformerExclusions({ "openmods.asm.", "openmods.include.", "openmods.core.", "openmods.injector.", "openmods.Log" })
public class OpenModsCorePlugin implements IFMLLoadingPlugin {

	public static final String CORE_MARKER = "OpenModsCoreLoaded";

	public OpenModsCorePlugin() {
		Log.debug("<OpenModsLib %s>\\o", "$LIB-VERSION$");
		Launch.blackboard.put(CORE_MARKER, "$LIB-VERSION$");
	}

	@Override
	public String[] getASMTransformerClass() {
		return new String[] { "openmods.core.OpenModsClassTransformer" };
	}

	@Override
	public String getModContainerClass() {
		return "openmods.core.OpenModsCore";
	}

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

	@Override
	public void injectData(Map<String, Object> data) {
		Bootstrap.injectData(data);
	}

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

}

Debug log in core plugin

Debug log in core plugin


package org.jboss.msc.bench;

import java.util.concurrent.CountDownLatch;
import org.jboss.msc.registry.ServiceDefinition;
import org.jboss.msc.registry.ServiceRegistrationBatchBuilder;
import org.jboss.msc.registry.ServiceRegistry;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceContainer;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.TimingServiceListener;

public class NoDepBench {

    public static void main(String[] args) throws Exception {
        final int totalServiceDefinitions = Integer.parseInt(args[0]);

        ServiceRegistrationBatchBuilder batch = ServiceRegistry.Factory.create(ServiceContainer.Factory.create()).batchBuilder();

        final CountDownLatch latch = new CountDownLatch(1);
        final TimingServiceListener listener = new TimingServiceListener(new TimingServiceListener.FinishListener() {
            public void done(final TimingServiceListener timingServiceListener) {
                latch.countDown();
            }
        });
        for (int i = 0; i < totalServiceDefinitions; i++) {
            batch.add(ServiceDefinition.build(ServiceName.of("test" + i), Service.NULL_VALUE).addListener(listener).create());
        }
        batch.install();
        listener.finishBatch();
        latch.await();
        System.out.println(totalServiceDefinitions + " : "  + listener.getElapsedTime() + "ms");
    }
}

package org.jboss.msc.bench;

import java.util.concurrent.CountDownLatch;
import org.jboss.msc.registry.ServiceDefinition;
import org.jboss.msc.registry.ServiceRegistrationBatchBuilder;
import org.jboss.msc.registry.ServiceRegistry;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceContainer;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.TimingServiceListener;

public class NoDepBench {

    public static void main(String[] args) throws Exception {
        final int totalServiceDefinitions = Integer.parseInt(args[0]);

        ServiceRegistrationBatchBuilder batch = ServiceRegistry.Factory.create(ServiceContainer.Factory.create()).batchBuilder();

        final CountDownLatch latch = new CountDownLatch(1);
        final TimingServiceListener listener = new TimingServiceListener(new TimingServiceListener.FinishListener() {
            public void done(final TimingServiceListener timingServiceListener) {
                latch.countDown();
            }
        });
        for (int i = 0; i < totalServiceDefinitions; i++) {
            batch.add(ServiceDefinition.build(ServiceName.of("test" + i), Service.NULL_VALUE).addListener(listener).create());
        }
        batch.install();
        listener.finishBatch();
        latch.await();
        System.out.println(totalServiceDefinitions + " : "  + listener.getElapsedTime() / 1000.0);
    }
}

Use fractional seconds to compare

Use fractional seconds to compare


package com.faforever.api.data.domain;

public enum Validity {
  // Order is crucial
  VALID,
  TOO_MANY_DESYNCS,
  WRONG_VICTORY_CONDITION,
  NO_FOG_OF_WAR,
  CHEATS_ENABLED,
  PREBUILT_ENABLED,
  NORUSH_ENABLED,
  BAD_UNIT_RESTRICTIONS,
  BAD_MAP,
  TOO_SHORT,
  BAD_MOD,
  COOP_NOT_RANKED,
  MUTUAL_DRAW,
  SINGLE_PLAYER,
  FFA_NOT_RANKED,
  UNEVEN_TEAMS_NOT_RANKED,
  UNKNOWN_RESULT,
  TEAMS_UNLOCKED,
  MULTIPLE_TEAMS,
  HAS_AI,
  CIVILIANS_REVEALED,
  WRONG_DIFFICULTY,
  EXPANSION_DISABLED,
  SPAWN_NOT_FIXED,
  OTHER_UNRANK
}

package com.faforever.api.data.domain;

public enum Validity {
  // Order is crucial
  VALID,
  TOO_MANY_DESYNCS,
  WRONG_VICTORY_CONDITION,
  NO_FOG_OF_WAR,
  CHEATS_ENABLED,
  PREBUILT_ENABLED,
  NORUSH_ENABLED,
  BAD_UNIT_RESTRICTIONS,
  BAD_MAP,
  TOO_SHORT,
  BAD_MOD,
  COOP_NOT_RANKED,
  MUTUAL_DRAW,
  SINGLE_PLAYER,
  FFA_NOT_RANKED,
  UNEVEN_TEAMS_NOT_RANKED,
  UNKNOWN_RESULT,
  TEAMS_UNLOCKED,
  MULTIPLE_TEAMS,
  HAS_AI,
  CIVILIANS_REVEALED,
  WRONG_DIFFICULTY,
  EXPANSION_DISABLED,
  SPAWN_NOT_FIXED,
  OTHER_UNRANK,
  UNRANKED_BY_HOST
}

Add new validity state for games unranked by host


/*
 * Copyright 2006-2014 innopost.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0.txt
 *
 * or in the "license" file accompanying this file. This file 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.popbill.api.taxinvoice;

/**
 * Enum for MgtKeyType.
 *
 * @author KimSeonjun
 * @version 1.0.0
 */
public enum MgtKeyType {
	/**
	 * 매출
	 */
	SELL,
	/**
	 * 매입
	 */
	BUY,
	/**
	 * 수탁
	 */
	TRUST
}

/*
 * Copyright 2006-2014 innopost.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0.txt
 *
 * or in the "license" file accompanying this file. This file 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.popbill.api.taxinvoice;

/**
 * Enum for MgtKeyType.
 *
 * @author KimSeonjun
 * @version 1.0.0
 */
public enum MgtKeyType {
	/**
	 * 매출
	 */
	SELL,
	/**
	 * 매입
	 */
	BUY,
	/**
	 * 수탁
	 */
	TRUSTEE
}

Fix Typo bug. TRUST -> TRUSTEE

Fix Typo bug. TRUST -> TRUSTEE


package com.example.android.miwok;

public class Word {

    private String mMiwokWord;
    private String mEnglishWord;
    private int mImageResourceId;
    private int mRawResourceId;

    // Constructor setter method
    // @params strings miwokWord and englishWord
    // Sets private strings mMiwokWord and mEnglishWord
    public Word(String miwokWord, String englishWord, int rawResourceId) {
        mMiwokWord = miwokWord;
        mEnglishWord = englishWord;
        mRawResourceId = rawResourceId;
    } // Close method Word()

    public Word(String miwokWord, String englishWord, int imageResourceId, int rawResourceId) {
        mMiwokWord = miwokWord;
        mEnglishWord = englishWord;
        mImageResourceId = imageResourceId;
        mRawResourceId = rawResourceId;
    } // Close method Word()

    // Getter method to retrieve private string mMiwokWord
    public String getmMiwokWord() {
        return mMiwokWord;
    }

    // Getter method to retrieve private string mEnglishWord
    public String getmEnglishWord() {
        return mEnglishWord;
    }

    // Getter method to retrieve res ID for icon image resource;
    public int getmImageResourceId() { return mImageResourceId; }

    // Getter method to retrieve res ID for mp3 resource;
    public int getmRawResourceId() { return mRawResourceId; }

} // Close class Word

package com.example.android.miwok;

public class Word {

    private String mMiwokWord;
    private String mEnglishWord;
    private int mImageResourceId;
    private int mRawResourceId;

    // Constructor setter method
    // @params strings miwokWord and englishWord, int rawResourceId
    // Sets private strings mMiwokWord and mEnglishWord
    public Word(String miwokWord, String englishWord, int rawResourceId) {
        mMiwokWord = miwokWord;
        mEnglishWord = englishWord;
        mRawResourceId = rawResourceId;
    } // Close method Word()

    // Constructor setter method, overloaded
    // Extra @param imageResourceId
    public Word(String miwokWord, String englishWord, int imageResourceId, int rawResourceId) {
        mMiwokWord = miwokWord;
        mEnglishWord = englishWord;
        mImageResourceId = imageResourceId;
        mRawResourceId = rawResourceId;
    } // Close method Word()

    // Getter method to retrieve private string mMiwokWord
    public String getmMiwokWord() {
        return mMiwokWord;
    }

    // Getter method to retrieve private string mEnglishWord
    public String getmEnglishWord() {
        return mEnglishWord;
    }

    // Getter method to retrieve res ID for icon image resource;
    public int getmImageResourceId() { return mImageResourceId; }

    // Getter method to retrieve res ID for mp3 resource;
    public int getmRawResourceId() { return mRawResourceId; }

} // Close class Word

Clarify comments about overloaded constructor


package top.quantic.sentry.config;

import com.google.common.cache.CacheBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.guava.GuavaCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
@EnableCaching
@AutoConfigureAfter(value = {MetricsConfiguration.class})
@AutoConfigureBefore(value = {WebConfigurer.class, DatabaseConfiguration.class})
public class CacheConfiguration {

    private final Logger log = LoggerFactory.getLogger(CacheConfiguration.class);

    @Bean
    public CacheManager cacheManager() {
        log.debug("Creating Guava cache manager");
        GuavaCacheManager guavaCacheManager = new GuavaCacheManager();
        guavaCacheManager.setCacheBuilder(CacheBuilder.newBuilder().expireAfterAccess(3, TimeUnit.HOURS));
        return guavaCacheManager;
    }
}

package top.quantic.sentry.config;

import com.google.common.cache.CacheBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.guava.GuavaCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
@EnableCaching
@AutoConfigureAfter(value = {MetricsConfiguration.class})
@AutoConfigureBefore(value = {WebConfigurer.class, DatabaseConfiguration.class})
public class CacheConfiguration {

    private final Logger log = LoggerFactory.getLogger(CacheConfiguration.class);

    @Bean
    public CacheManager cacheManager() {
        log.debug("Creating Guava cache manager");
        GuavaCacheManager guavaCacheManager = new GuavaCacheManager();
        guavaCacheManager.setCacheBuilder(CacheBuilder.newBuilder().expireAfterAccess(30, TimeUnit.MINUTES));
        return guavaCacheManager;
    }
}

Reduce cache expiration time to 30 minutes


// Copyright (C) 2003-2009 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse.fixtures;

import util.FileUtil;

import java.io.File;

public class FileSection {
  private static File fileSection;

  public FileSection(String type) throws Exception {
    if ("setup".equals(type.toLowerCase())) {
      new File(FitnesseFixtureContext.baseDir).mkdir();
      File dir = new File(FitnesseFixtureContext.baseDir);
      dir.mkdir();
      fileSection = new File(dir, "files");
      fileSection.mkdir();
    } else {
      FileUtil.deleteFileSystemDirectory(FitnesseFixtureContext.baseDir);
      fileSection = null;
    }
  }

  public static File getFileSection() {
    return fileSection;
  }

}

// Copyright (C) 2003-2009 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse.fixtures;

import util.FileUtil;

import java.io.File;

public class FileSection {
  private static File fileSection;

  public FileSection(String type) throws Exception {
    if ("setup".equals(type.toLowerCase())) {
      File dir = new File(FitnesseFixtureContext.context.getRootPagePath());
      dir.mkdir();
      fileSection = new File(dir, "files");
      fileSection.mkdir();
    } else {
      FileUtil.deleteFileSystemDirectory(FitnesseFixtureContext.context.getRootPagePath());
      fileSection = null;
    }
  }

  public static File getFileSection() {
    return fileSection;
  }

}

Use correct directory for file section AT.


/*
 *  Copyright (c) Facebook, Inc. and its affiliates.
 *
 *  This source code is licensed under the MIT license found in the LICENSE
 *  file in the root directory of this source tree.
 *
 */
package com.facebook.yoga;

import com.facebook.soloader.SoLoader;

public class YogaJNI {

  // Known constants. 1-3 used in previous experiments. Do not reuse.
  public static int JNI_FAST_CALLS = 4;

  // set before loading any other Yoga code
  public static boolean useFastCall = false;

  private static native void jni_bindNativeMethods(boolean useFastCall);

  static boolean init() {
    if (SoLoader.loadLibrary("yoga")) {
      jni_bindNativeMethods(useFastCall);
      return true;
    }

    return false;
  }
}

/*
 *  Copyright (c) Facebook, Inc. and its affiliates.
 *
 *  This source code is licensed under the MIT license found in the LICENSE
 *  file in the root directory of this source tree.
 *
 */
package com.facebook.yoga;

import com.facebook.soloader.SoLoader;

public class YogaJNI {
  private static boolean isInitialized = false;

  // Known constants. 1-3 used in previous experiments. Do not reuse.
  public static int JNI_FAST_CALLS = 4;

  // set before loading any other Yoga code
  public static boolean useFastCall = false;

  private static native void jni_bindNativeMethods(boolean useFastCall);

  static synchronized boolean init() {
    if (!isInitialized) {
      isInitialized = true;
      SoLoader.loadLibrary("yoga");
      jni_bindNativeMethods(useFastCall);
      return true;
    }
    return false;
  }
}

Add Yoga JNI bindings to libcoldstart

Add Yoga JNI bindings to libcoldstart

Summary:
Yoga's JNI bindings are usually loaded during class loading, and can stall the UI thread.

Here, we try to mitigate the problem by adding the bindings to libcoldstart.

Reviewed By: michalgr

Differential Revision: D12956818

fbshipit-source-id: 9dda5cb6d26c2bae64606bc2d7c98ab8f7c05a30


package net.qbar.common.card;

import java.util.Map;

import com.google.common.collect.Maps;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

public class PunchedCardDataManager
{
    private static PunchedCardDataManager instance;

    public static PunchedCardDataManager getInstance()
    {
        if (instance == null)
            instance = new PunchedCardDataManager();
        return instance;
    }

    private Map<Short, PunchedCardData> datas;

    private PunchedCardDataManager()
    {
        datas = Maps.newHashMap();
    }

    public PunchedCardData registerDataType(int id, IPunchedCard data)
    {
        if (this.datas.containsKey(id))
            throw new IllegalArgumentException("id already used");
        PunchedCardData card = new PunchedCardData(id, data);

        this.datas.put(card.getId(), card);
        return card;
    }

    public PunchedCardData getCardData(ItemStack card)
    {
        NBTTagCompound tag = card.getTagCompound();
        if (!tag.hasKey("PunchedCardDataId"))
            throw new IllegalArgumentException("Invalid ItemStack");
        short id = tag.getShort("PunchedCardDataId");
        if (!this.datas.containsKey(id))
            throw new IllegalArgumentException("No data found");

        return this.datas.get(id);
    }
}

package net.qbar.common.card;

import java.util.Map;

import com.google.common.collect.Maps;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

public class PunchedCardDataManager
{
    private static volatile PunchedCardDataManager instance;

    public static PunchedCardDataManager getInstance()
    {
        if (instance == null)
        {
            synchronized (PunchedCardDataManager.class)
            {
                if (instance == null)
                {
                    instance = new PunchedCardDataManager();
                }
            }
        }
        return instance;
    }

    private Map<Short, PunchedCardData> datas;

    private PunchedCardDataManager()
    {
        datas = Maps.newHashMap();
    }

    public PunchedCardData registerDataType(int id, IPunchedCard data)
    {
        if (this.datas.containsKey(id))
            throw new IllegalArgumentException("id already used");
        PunchedCardData card = new PunchedCardData(id, data);

        this.datas.put(card.getId(), card);
        return card;
    }

    public PunchedCardData getCardData(ItemStack card)
    {
        NBTTagCompound tag = card.getTagCompound();
        if (!tag.hasKey("PunchedCardDataId"))
            throw new IllegalArgumentException("Invalid ItemStack");
        short id = tag.getShort("PunchedCardDataId");
        if (!this.datas.containsKey(id))
            throw new IllegalArgumentException("No data found");

        return this.datas.get(id);
    }
}

Use synchronized block for getInstance

Use synchronized block for getInstance


package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_4_5_6_7_8_9r1_9r2_10_11_12;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleTimeUpdate;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class TimeUpdate extends MiddleTimeUpdate {

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData(ProtocolVersion version) {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_UPDATE_TIME_ID, version);
		serializer.writeLong(worldAge);
		serializer.writeLong(timeOfDay);
		return RecyclableSingletonList.create(serializer);
	}

}

package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_4_5_6_7_8_9r1_9r2_10_11_12;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleTimeUpdate;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class TimeUpdate extends MiddleTimeUpdate {

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData(ProtocolVersion version) {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_UPDATE_TIME_ID, version);
		if (version.isBeforeOrEq(ProtocolVersion.MINECRAFT_1_4_7)) {
			timeOfDay = Math.abs(timeOfDay);
		}
		serializer.writeLong(worldAge);
		serializer.writeLong(timeOfDay);
		return RecyclableSingletonList.create(serializer);
	}

}

Use abs time in <= 1.4.7 to emulate daynight cycle disable


package net.wequick.example.small.appavailable_if_stub;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.util.Log;

/**
 * Created by galen on 2016/11/4.
 */
public class MyService extends Service {

    private static final String TAG = "MyService";

    @Override
    public void onCreate() {
        super.onCreate();
        Log.i(TAG, "onCreate");
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.i(TAG, "onDestroy");
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}

package net.wequick.example.small.appavailable_if_stub;

import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.support.annotation.Nullable;
import android.widget.Toast;

/**
 * Created by galen on 2016/11/4.
 */
public class MyService extends Service {

    private Handler mUI;

    @Override
    public void onCreate() {
        super.onCreate();
        mUI = new Handler(Looper.myLooper());
        mUI.post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(getApplicationContext(), "MyService is on!", Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        mUI.post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(getApplicationContext(), "MyService is off!", Toast.LENGTH_SHORT).show();
                mUI = null;
            }
        });
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}

Add toast on server start and stop for sample


package org.nwapw.abacus.tree;

/**
 * Enum to represent the type of the token that has been matched
 * by the lexer.
 */
public enum TokenType {

    INTERNAL_FUNCTION_END(-1),
    ANY(0), WHITESPACE(1), COMMA(2), OP(3), TREE_VALUE_OP(3),
    NUM(4), VARIABLE(5), FUNCTION(6), TREE_VALUE_FUNCTION(6), OPEN_PARENTH(7), CLOSE_PARENTH(8);

    /**
     * The priority by which this token gets sorted.
     */
    public final int priority;

    /**
     * Creates a new token type with the given priority.
     *
     * @param priority the priority of this token type.
     */
    TokenType(int priority) {
        this.priority = priority;
    }

}

package org.nwapw.abacus.tree;

/**
 * Enum to represent the type of the token that has been matched
 * by the lexer.
 */
public enum TokenType {

    INTERNAL_FUNCTION_END(-1),
    ANY(0), WHITESPACE(1), COMMA(2), VARIABLE(3), OP(4), TREE_VALUE_OP(4),
    NUM(5), FUNCTION(6), TREE_VALUE_FUNCTION(6), OPEN_PARENTH(7), CLOSE_PARENTH(7);

    /**
     * The priority by which this token gets sorted.
     */
    public final int priority;

    /**
     * Creates a new token type with the given priority.
     *
     * @param priority the priority of this token type.
     */
    TokenType(int priority) {
        this.priority = priority;
    }

}

Fix token precedence for variable names / operators.


package sorts.options;

import sorts.results.Column;

import com.google.common.base.Preconditions;

public class Index {

  protected final Column column;
  protected final Order order;

  public Index(Column column) {
    this(column, Order.ASCENDING);
  }

  public Index(Column column, Order order) {
    Preconditions.checkNotNull(column);
    Preconditions.checkNotNull(order);

    this.column = column;
    this.order = order;
  }

  public static Index define(String columnName) {
    return define(Column.create(columnName));
  }

  public static Index define(Column column) {
    return new Index(column);
  }

  public static Index define(Column column, Order order) {
    return new Index(column, order);
  }

  public Column column() {
    return this.column;
  }

  public Order order() {
    return this.order;
  }

  @Override
  public boolean equals(Object o) {
    if (o instanceof Index) {
      Index other = (Index) o;

      if (this.column.equals(other.column) && this.order.equals(other.order)) {
        return true;
      }
    }

    return false;
  }

  @Override
  public int hashCode() {
    return this.column.hashCode() ^ this.order.hashCode();
  }

  @Override
  public String toString() {
    return this.column + ", " + this.order;
  }

}

package sorts.options;

import sorts.results.Column;

import com.google.common.base.Preconditions;

public class Index {

  protected final Column column;
  protected final Order order;

  public Index(Column column) {
    this(column, Order.ASCENDING);
  }

  public Index(Column column, Order order) {
    Preconditions.checkNotNull(column);
    Preconditions.checkNotNull(order);

    this.column = column;
    this.order = order;
  }

  public static Index define(String columnName) {
    return define(Column.create(columnName));
  }

  public static Index define(Column column) {
    return new Index(column);
  }

  public static Index define(String columnName, Order order) {
	return define(Column.create(columnName), order);
  }

  public static Index define(Column column, Order order) {
    return new Index(column, order);
  }

  public Column column() {
    return this.column;
  }

  public Order order() {
    return this.order;
  }

  @Override
  public boolean equals(Object o) {
    if (o instanceof Index) {
      Index other = (Index) o;

      if (this.column.equals(other.column) && this.order.equals(other.order)) {
        return true;
      }
    }

    return false;
  }

  @Override
  public int hashCode() {
    return this.column.hashCode() ^ this.order.hashCode();
  }

  @Override
  public String toString() {
    return this.column + ", " + this.order;
  }

}

Add in a missing convenience method

Add in a missing convenience method


package com.annimon.hotarufx.visual;

import com.annimon.hotarufx.lib.NumberValue;
import com.annimon.hotarufx.lib.StringValue;
import com.annimon.hotarufx.lib.Types;
import com.annimon.hotarufx.lib.Value;
import java.util.function.Function;
import javafx.scene.paint.Color;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
@Getter
public enum PropertyType {

    NUMBER(toNumber(), o -> NumberValue.of((Number) o)),
    PAINT(v -> Color.valueOf(v.asString()), o -> new StringValue(o.toString()));

    private final Function<Value, Object> fromHFX;
    private final Function<Object, Value> toHFX;

    private static Function<Value, Object> toNumber() {
        return value -> {
            if (value.type() == Types.NUMBER) {
                return ((NumberValue) value).raw();
            }
            return value.asNumber();
        };
    }
}

package com.annimon.hotarufx.visual;

import com.annimon.hotarufx.lib.NumberValue;
import com.annimon.hotarufx.lib.StringValue;
import com.annimon.hotarufx.lib.Types;
import com.annimon.hotarufx.lib.Value;
import java.util.function.Function;
import javafx.scene.paint.Color;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
public enum PropertyType {

    NUMBER(toNumber(), o -> NumberValue.of((Number) o)),
    PAINT(v -> Color.valueOf(v.asString()), o -> new StringValue(o.toString()));

    private final Function<Value, Object> fromHFX;
    private final Function<Object, Value> toHFX;

    @SuppressWarnings("unchecked")
    public <T> Function<Value, T> getFromHFX() {
        return (Function<Value, T>) fromHFX;
    }

    @SuppressWarnings("unchecked")
    public <T> Function<T, Value> getToHFX() {
        return (Function<T, Value>) toHFX;
    }

    private static Function<Value, Object> toNumber() {
        return value -> {
            if (value.type() == Types.NUMBER) {
                return ((NumberValue) value).raw();
            }
            return value.asNumber();
        };
    }
}

Add generic type to converters signature


package com.github.triplesolitaire;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;

/**
 * Dialog to show when a user pauses the game
 */
public class GamePauseDialogFragment extends DialogFragment {
    @Override
    public Dialog onCreateDialog(final Bundle savedInstanceState) {
        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(R.string.app_name).setIcon(R.drawable.icon).setMessage(R.string.game_paused)
                .setNegativeButton(getText(R.string.resume), null);
        return builder.create();
    }
}

package com.github.triplesolitaire;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Build;
import android.os.Bundle;

/**
 * Dialog to show when a user pauses the game
 */
public class GamePauseDialogFragment extends DialogFragment {
    @Override
    public Dialog onCreateDialog(final Bundle savedInstanceState) {
        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            builder.setIcon(R.drawable.icon);
        }
        builder.setTitle(R.string.app_name).setMessage(R.string.game_paused)
                .setNegativeButton(getText(R.string.resume), null);
        return builder.create();
    }
}

Remove icon from Pause dialog on Android 5.0+ devices


/*
 * Copyright 2014 Codenvy, S.A.
 *
 * 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.codenvy.ide.ext.datasource.client.explorer;

import com.google.gwt.i18n.client.LocalizableResource.DefaultLocale;
import com.google.gwt.i18n.client.Messages;

/**
 * Constant interface for the datasource explorer.
 *
 * @author "Mickaël Leduque"
 */
@DefaultLocale("en")
public interface DatasourceExplorerConstants extends Messages {

    /** The tooltip for the refresh button. */
    @DefaultMessage("Refresh and explore")
    String exploreButtonTooltip();

    /** The string used in the part (top). */
    @DefaultMessage("Datasource Explorer")
    String datasourceExplorerPartTitle();

    /** The string used in the side tab. */
    @DefaultMessage("Datasource")
    String datasourceExplorerTabTitle();
}

/*
 * Copyright 2014 Codenvy, S.A.
 *
 * 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.codenvy.ide.ext.datasource.client.explorer;

import com.google.gwt.i18n.client.Constants;
import com.google.gwt.i18n.client.LocalizableResource.DefaultLocale;

/**
 * Constant interface for the datasource explorer.
 *
 * @author "Mickaël Leduque"
 */
@DefaultLocale("en")
public interface DatasourceExplorerConstants extends Constants {

    /** The tooltip for the refresh button. */
    @DefaultStringValue("Refresh and explore")
    String exploreButtonTooltip();

    /** The string used in the part (top). */
    @DefaultStringValue("Datasource Explorer")
    String datasourceExplorerPartTitle();

    /** The string used in the side tab. */
    @DefaultStringValue("Datasource")
    String datasourceExplorerTabTitle();

    @DefaultStringArrayValue({"Simplest - Tables and views",
            "Standard - adds materialized views, aliases, syn.",
            "System - add system tables/views",
            "All existing table types"})
    String[] tableCategories();
}

Add constants for table category selection


package com.jfixby.tools.bleed.gemserk;

import com.jfixby.cmns.api.filesystem.File;
import com.jfixby.tools.bleed.api.TextureBleedSpecs;

public class GemserkProcessorSpecsImpl implements TextureBleedSpecs {

	private File folder;

	@Override
	public File getInputFolder() {
		return folder;
	}

	@Override
	public void setInputFolder(File input_folder) {
		folder = input_folder;
	}

}

package com.jfixby.tools.bleed.gemserk;

import com.jfixby.cmns.api.filesystem.File;
import com.jfixby.tools.bleed.api.TextureBleedSpecs;

public class GemserkProcessorSpecsImpl implements TextureBleedSpecs {

	private File folder;

	@Override
	public File getInputFolder() {
		return folder;
	}

	@Override
	public void setInputFolder(File input_folder) {
		folder = input_folder;
	}

	@Override
	public boolean getDebugMode() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void setDebugMode(boolean flag) {
		// TODO Auto-generated method stub

	}

	@Override
	public int getMaxScans() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void setMaxScans(int maxScans) {
		// TODO Auto-generated method stub

	}

}

Add some parameters: debugFlag and maxScans.


package org.azavea.otm.data;

import org.json.JSONArray;

public abstract class ModelContainer<T> {
	protected JSONArray data;

	public void setData(JSONArray array) {
		this.data = array;
	}

	public JSONArray getData() {
		return data;
	}

	public abstract T[] getAll();
}

package org.azavea.otm.data;

import java.util.LinkedHashMap;

import org.json.JSONArray;

public abstract class ModelContainer<T> {
	protected JSONArray data;

	public void setData(JSONArray array) {
		this.data = array;
	}

	public JSONArray getData() {
		return data;
	}

	public abstract LinkedHashMap<Integer,T> getAll();
}

Change T[] to Hash for modelContainer

Change T[] to Hash for modelContainer

Using a LinkedHashMap we can do lookup by key/id and also keep the list
in the default ordering from which it comes through the API


package org.jboss.loom.actions;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * Sorts a list of actions so that dependencies go first, and depending actions go after.
 *
 * @Jira  MIGR-104
 * @author Ondrej Zizka, ozizka at redhat.com
 */
public class ActionDependencySorter {

    public static <T extends IMigrationAction> List<T> sort( List<T> actions ){

        List<T> ret = new ArrayList(actions);
        Collections.sort( ret, new DepComparator() );
        return ret;
    }

    static class DepComparator implements Comparator<IMigrationAction> {
        @Override
        public int compare( IMigrationAction o1, IMigrationAction o2 ) {
            try {
                int a = o1.dependsOn( o2 );
                if( a != -1 )  return -a;

                int b = o2.dependsOn( o1 );
                if( b != -1 )  return -b;

                return Integer.compare( o1.hashCode(), o2.hashCode() ); // For deterministic behavior.
            }
            catch( AbstractStatefulAction.CircularDependencyException ex ){
                throw new RuntimeException( ex );
            }
        }
    }

}// class

package org.jboss.loom.actions;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * Sorts a list of actions so that dependencies go first, and depending actions go after.
 *
 * @Jira  MIGR-104
 * @author Ondrej Zizka, ozizka at redhat.com
 */
public class ActionDependencySorter {

    public static <T extends IMigrationAction> List<T> sort( List<T> actions ){

        List<T> ret = new ArrayList(actions);
        Collections.sort( ret, new DepComparator() );
        return ret;
    }

    static class DepComparator implements Comparator<IMigrationAction> {
        @Override
        public int compare( IMigrationAction o1, IMigrationAction o2 ) {
            try {
                int a = o1.dependsOn( o2 );
                if( a != -1 )  return -a;

                int b = o2.dependsOn( o1 );
                if( b != -1 )  return -b;

                //return Integer.compare( o1.hashCode(), o2.hashCode() ); // For deterministic behavior.
                return 0; // All right that was not a good idea - it breaks those from Migrators which don't set dependency yet...
            }
            catch( AbstractStatefulAction.CircularDependencyException ex ){
                throw new RuntimeException( ex );
            }
        }
    }

}// class

Remove sorting by hashCode() - All right that was not a good idea - it breaks those from Migrators which don't set dependency yet...


package br.com.alura.agenda.modelo;

import java.io.Serializable;

/**
 * Created by alura on 12/08/15.
 */
public class Aluno implements Serializable {
    private Long id;
    private String nome;
    private String endereco;
    private String telefone;
    private String site;
    private Double nota;
    private String caminhoFoto;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getEndereco() {
        return endereco;
    }

    public void setEndereco(String endereco) {
        this.endereco = endereco;
    }

    public String getTelefone() {
        return telefone;
    }

    public void setTelefone(String telefone) {
        this.telefone = telefone;
    }

    public String getSite() {
        return site;
    }

    public void setSite(String site) {
        this.site = site;
    }

    public Double getNota() {
        return nota;
    }

    public void setNota(Double nota) {
        this.nota = nota;
    }

    public String getCaminhoFoto() {
        return caminhoFoto;
    }

    public void setCaminhoFoto(String caminhoFoto) {
        this.caminhoFoto = caminhoFoto;
    }

    @Override
    public String toString() {
        return getId() + " - " + getNome();
    }
}

package br.com.alura.agenda.modelo;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;

public class Aluno implements Serializable {

    @JsonProperty("idCliente")
    private Long id;
    private String nome;
    private String endereco;
    private String telefone;
    private String site;
    private Double nota;
    private String caminhoFoto;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getEndereco() {
        return endereco;
    }

    public void setEndereco(String endereco) {
        this.endereco = endereco;
    }

    public String getTelefone() {
        return telefone;
    }

    public void setTelefone(String telefone) {
        this.telefone = telefone;
    }

    public String getSite() {
        return site;
    }

    public void setSite(String site) {
        this.site = site;
    }

    public Double getNota() {
        return nota;
    }

    public void setNota(Double nota) {
        this.nota = nota;
    }

    public String getCaminhoFoto() {
        return caminhoFoto;
    }

    public void setCaminhoFoto(String caminhoFoto) {
        this.caminhoFoto = caminhoFoto;
    }

    @Override
    public String toString() {
        return getId() + " - " + getNome();
    }
}

Add UUID on user update

Add UUID on user update


package ganymedes01.etfuturum.blocks;

import ganymedes01.etfuturum.EtFuturum;
import ganymedes01.etfuturum.IConfigurable;
import ganymedes01.etfuturum.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

public class CoarseDirt extends Block implements IConfigurable {

	public CoarseDirt() {
		super(Material.ground);
		setHardness(0.5F);
		setStepSound(soundTypeGravel);
		setBlockTextureName("coarse_dirt");
		setBlockName(Utils.getUnlocalisedName("coarse_dirt"));
		setCreativeTab(EtFuturum.enableCoarseDirt ? EtFuturum.creativeTab : null);
	}

	@Override
	public boolean isEnabled() {
		return EtFuturum.enableCoarseDirt;
	}
}

package ganymedes01.etfuturum.blocks;

import ganymedes01.etfuturum.EtFuturum;
import ganymedes01.etfuturum.IConfigurable;
import ganymedes01.etfuturum.core.utils.Utils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;

public class CoarseDirt extends Block implements IConfigurable {

	public CoarseDirt() {
		super(Material.ground);
		setHardness(0.5F);
		setStepSound(soundTypeGravel);
		setBlockTextureName("coarse_dirt");
		setBlockName(Utils.getUnlocalisedName("coarse_dirt"));
		setCreativeTab(EtFuturum.enableCoarseDirt ? EtFuturum.creativeTab : null);
	}

	@Override
	public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plant) {
		return Blocks.dirt.canSustainPlant(world, x, y, z, direction, plant);
	}

	@Override
	public boolean isEnabled() {
		return EtFuturum.enableCoarseDirt;
	}
}

Fix Coarse Dirt not letting plants be placed on top of itself


package com.bookcrossing.mobile.modules;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

/** (c) 2016 Andrey Mukamolow aka fobo66 <fobo66@protonmail.com>
 * Created by fobo66 on 15.11.2016.
 */

@Module
public class ApiModule {

    @Provides
    @Singleton
    public FirebaseDatabase provideDatabase() {
        return FirebaseDatabase.getInstance();
    }

    @Provides
    @Singleton
    public FirebaseStorage provideStorage() {
        return FirebaseStorage.getInstance();
    }

    @Provides
    @Singleton
    public FirebaseAuth provideAuth() {
        return FirebaseAuth.getInstance();
    }

}

package com.bookcrossing.mobile.modules;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;

import dagger.Module;
import dagger.Provides;

/** (c) 2016 Andrey Mukamolow aka fobo66 <fobo66@protonmail.com>
 * Created by fobo66 on 15.11.2016.
 */

@Module
public class ApiModule {

    @Provides
    public FirebaseDatabase provideDatabase() {
        return FirebaseDatabase.getInstance();
    }

    @Provides
    public FirebaseStorage provideStorage() {
        return FirebaseStorage.getInstance();
    }

    @Provides
    public FirebaseAuth provideAuth() {
        return FirebaseAuth.getInstance();
    }

}

Remove @Singletone annotation from API for better performance


package com.amee.platform.science;

import org.joda.time.DateTime;

import java.util.Date;

public abstract class BaseDate extends java.util.Date {

    protected String dateStr;

    public BaseDate(long time) {
        setTime(time);
        setDefaultDateStr();
    }

    public BaseDate(String dateStr) {
        super();
        if (dateStr != null) {
            setTime(parseStr(dateStr));
            this.dateStr = dateStr;
        } else {
            setTime(defaultDate());
            setDefaultDateStr();
        }
    }

    protected abstract long parseStr(String dateStr);

    protected abstract void setDefaultDateStr();

    protected abstract long defaultDate();

    public String toString() {
        return dateStr;
    }

    public DateTime toDateTime() {
        return new DateTime(this.getTime());
    }
}

package com.amee.platform.science;

import org.joda.time.DateTime;

import java.util.Date;

public abstract class BaseDate extends java.util.Date {

    protected String dateStr;

    public BaseDate(long time) {
        setTime(time);
        setDefaultDateStr();
    }

    public BaseDate(String dateStr) {
        super();
        if (dateStr != null) {
            setTime(parseStr(dateStr));
            this.dateStr = dateStr;
        } else {
            setTime(defaultDate());
            setDefaultDateStr();
        }
    }

    protected abstract long parseStr(String dateStr);

    protected abstract void setDefaultDateStr();

    protected abstract long defaultDate();

    public String toString() {
        return dateStr;
    }

    public DateTime toDateTime() {
        return new DateTime(this.getTime());
    }

    public Date toDate() {
        return new DateTime(this.getTime()).toDate();
    }
}

Revert "Removed unused method. PL-1321."

This reverts commit a43684f4c0f4753d6906ca6f7e1cf9409bc24488.


/**
 * Copyright © 2011-2012 EMBL - European Bioinformatics Institute
 *
 * 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 uk.ac.ebi.phenotype.dao;

/**
 *
 * Phenotyping project data access manager interface.
 *
 * @author Gautier Koscielny (EMBL-EBI) <koscieln@ebi.ac.uk>
 * @since February 2012
 */

import java.util.List;

import uk.ac.ebi.phenotype.pojo.Project;

public interface ProjectDAO {

	/**
	 * Get all projects in the system
	 * @return all projects
	 */
	public List<Project> getAllProjects();

	/**
	 * Find an project by its number.
	 * @param name the project name
	 * @return the project
	 */
	public Project getProjectByName(String name);
}

/**
 * Copyright © 2011-2013 EMBL - European Bioinformatics Institute
 *
 * 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 uk.ac.ebi.phenotype.dao;

/**
 *
 * Phenotyping project data access manager interface.
 *
 * @author Gautier Koscielny (EMBL-EBI) <koscieln@ebi.ac.uk>
 * @since February 2012
 */

import java.util.List;

import uk.ac.ebi.phenotype.pojo.Project;

public interface ProjectDAO {

	/**
	 * Get all projects in the system
	 * @return all projects
	 */
	public List<Project> getAllProjects();

	/**
	 * Find an project by its number.
	 * @param name the project name
	 * @return the project
	 */
	public Project getProjectByName(String name);
}

Change copyright in Apache 2 license to 2013