Remove jdkfix module (new jdk version 8_u_122 includes the SorteList bugfix)

This commit is contained in:
Manfred Karrer 2016-10-19 16:53:06 +02:00
parent 4ca8f8578a
commit f076a840f5
9 changed files with 6 additions and 499 deletions

View File

@ -92,28 +92,20 @@ Prepare Bitsquare build
### 3. Get Bitsquare source code and build a preliminary Bitsquare version
You need to get the Bitsquare dependencies first as we need to copy the BouncyCastle jar to the JRE directory as well as the jdkfix jar.
You need to get the Bitsquare dependencies first as we need to copy the BouncyCastle jar to the JRE directory.
$ git clone https://github.com/bitsquare/bitsquare.git
$ cd bitsquare
$ mvn clean package -DskipTests -Dmaven.javadoc.skip=true
### 4. Copy the jdkfix jar file
You will need to apply this bug fix manually by copying the jar file into your java installation:
$ sudo cp jdkfix/target/jdkfix-0.4.9.6.jar $JAVA_HOME/jre/lib/ext/
This step will be not be necessary once [the SortedList bug](https://bugs.openjdk.java.net/browse/JDK-8134655) is fixed in JDK 8 (scheduled for version `8u112`) and tested.
### 5. Copy the BouncyCastle provider jar file
### 4. Copy the BouncyCastle provider jar file
Copy the BountyCastle provider jar file from the local maven repository to the jre/lib/ext directory.
This prevents a "JCE cannot authenticate the provider BC" exception when starting the Bitsquare client.
$ sudo cp ~/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.53/bcprov-jdk15on-1.53.jar $JAVA_HOME/jre/lib/ext/
### 6. Edit the java.security file and add BouncyCastleProvider
###5. Edit the java.security file and add BouncyCastleProvider
Add org.bouncycastle.jce.provider.BouncyCastleProvider as last entry at: List of providers and their preference orders
E.g.:
@ -122,7 +114,7 @@ security.provider.10=org.bouncycastle.jce.provider.BouncyCastleProvider
$ sudo gedit $JAVA_HOME/jre/lib/security/java.security
... edit and save
### 7. Enable unlimited Strength for cryptographic keys (only required for Oracle JDK)
### 6. Enable unlimited Strength for cryptographic keys (only required for Oracle JDK)
If you are using Oracle JDK 8 you must **[enable strong cryptographic cyphers](https://github.com/jonathancross/jc-docs/blob/master/java-strong-crypto-test/README.md)**. If you use OpenJDK + OpenJFX you can skip this step.
@ -132,7 +124,7 @@ In Windows the new crypto files need to be copied to `Java/jdk1.8.0_xxx/jre/lib/
Build Bitsquare
-----------------
### 8. Build final Bitsquare jar
### 7. Build final Bitsquare jar
Now we have all prepared to build the correct Bitsquare jar.

View File

@ -35,9 +35,6 @@ git clone https://github.com/bitsquare/bitsquare.git
cd bitsquare
mvn clean package -DskipTests -Dmaven.javadoc.skip=true
echo "Copy the jdkfix jar file"
cp bitsquare/jdkfix/target/jdkfix-0.4.9.6.jar $JAVA_HOME/jre/lib/ext/jdkfix-0.4.9.6.jar
echo "Add BountyCastle.jar"
cd ~
cp /root/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.53/bcprov-jdk15on-1.53.jar $JAVA_HOME/jre/lib/ext/bcprov-jdk15on-1.53.jar

View File

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ This file is part of Bitsquare.
~
~ Bitsquare is free software: you can redistribute it and/or modify it
~ under the terms of the GNU Affero General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or (at
~ your option) any later version.
~
~ Bitsquare is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
~ License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>io.bitsquare</groupId>
<version>0.4.9.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jdkfix</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-XDignore.symbol.file</arg>
</compilerArgs>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.1</version>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,416 +0,0 @@
/**
* Temporary fix for SortedList bug described at: https://bugs.openjdk.java.net/browse/JDK-8134655
*
* Can be removed when OpenJDK 8u112 is released. (estimated to be GA on October 2016)
*/
/*
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javafx.collections.transformation;
import com.sun.javafx.collections.NonIterableChange.SimplePermutationChange;
import com.sun.javafx.collections.SortHelper;
import com.sun.javafx.collections.SourceAdapterChange;
import javafx.beans.NamedArg;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ObjectPropertyBase;
import javafx.collections.ListChangeListener.Change;
import javafx.collections.ObservableList;
import javafx.collections.transformation.TransformationList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
/**
* Wraps an ObservableList and sorts it's content.
* All changes in the ObservableList are propagated immediately
* to the SortedList.
* <p>
* Note: invalid SortedList (as a result of broken comparison) doesn't send any notification to listeners on becoming
* valid again.
*
* @see TransformationList
* @since JavaFX 8.0
*/
public final class SortedList<E> extends TransformationList<E, E> {
private Comparator<Element<E>> elementComparator;
private Element<E>[] sorted;
private int[] perm;
private int size;
private final SortHelper helper = new SortHelper();
private final Element<E> tempElement = new Element<>(null, -1);
/**
* Creates a new SortedList wrapped around the source list.
* The source list will be sorted using the comparator provided. If null is provided, the list
* stays unordered and is equal to the source list.
*
* @param source a list to wrap
* @param comparator a comparator to use or null for unordered List
*/
@SuppressWarnings("unchecked")
public SortedList(@NamedArg("source") ObservableList<? extends E> source, @NamedArg("comparator") Comparator<? super E> comparator) {
super(source);
sorted = (Element<E>[]) new Element[source.size() * 3 / 2 + 1];
perm = new int[sorted.length];
size = source.size();
for (int i = 0; i < size; ++i) {
sorted[i] = new Element<E>(source.get(i), i);
perm[i] = i;
}
if (comparator != null) {
setComparator(comparator);
}
}
/**
* Constructs a new unordered SortedList wrapper around the source list.
*
* @param source the source list
* @see #SortedList(javafx.collections.ObservableList, java.util.Comparator)
*/
public SortedList(@NamedArg("source") ObservableList<? extends E> source) {
this(source, (Comparator) null);
}
@Override
protected void sourceChanged(Change<? extends E> c) {
if (elementComparator != null) {
beginChange();
while (c.next()) {
if (c.wasPermutated()) {
updatePermutationIndexes(c);
} else if (c.wasUpdated()) {
update(c);
} else {
addRemove(c);
}
}
endChange();
} else {
updateUnsorted(c);
fireChange(new SourceAdapterChange<>(this, c));
}
}
;
/**
* The comparator that denotes the order of this SortedList.
* Null for unordered SortedList.
*/
private ObjectProperty<Comparator<? super E>> comparator;
public final ObjectProperty<Comparator<? super E>> comparatorProperty() {
if (comparator == null) {
comparator = new ObjectPropertyBase<Comparator<? super E>>() {
@Override
protected void invalidated() {
Comparator<? super E> current = get();
elementComparator = current != null ? new ElementComparator<>(current) : null;
doSortWithPermutationChange();
}
@Override
public Object getBean() {
return SortedList.this;
}
@Override
public String getName() {
return "comparator";
}
};
}
return comparator;
}
public final Comparator<? super E> getComparator() {
return comparator == null ? null : comparator.get();
}
public final void setComparator(Comparator<? super E> comparator) {
comparatorProperty().set(comparator);
}
/**
* Returns the element at the specified position in this list.
*
* @param index index of the element to return
* @return the element at the specified position in this list
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
@Override
public E get(int index) {
if (index >= size) {
throw new IndexOutOfBoundsException();
}
return sorted[index].e;
}
/**
* Returns the number of elements in this list.
*
* @return the number of elements in this list
*/
@Override
public int size() {
return size;
}
private void doSortWithPermutationChange() {
if (elementComparator != null) {
int[] perm = helper.sort(sorted, 0, size, elementComparator);
for (int i = 0; i < size; i++) {
this.perm[sorted[i].index] = i;
}
fireChange(new SimplePermutationChange<>(0, size, perm, this));
} else {
int[] perm = new int[size];
int[] rperm = new int[size];
for (int i = 0; i < size; ++i) {
perm[i] = rperm[i] = i;
}
boolean changed = false;
int idx = 0;
while (idx < size) {
final int otherIdx = sorted[idx].index;
if (otherIdx == idx) {
++idx;
continue;
}
Element<E> other = sorted[otherIdx];
sorted[otherIdx] = sorted[idx];
sorted[idx] = other;
this.perm[idx] = idx;
this.perm[otherIdx] = otherIdx;
perm[rperm[idx]] = otherIdx;
perm[rperm[otherIdx]] = idx;
int tp = rperm[idx];
rperm[idx] = rperm[otherIdx];
rperm[otherIdx] = tp;
changed = true;
}
if (changed) {
fireChange(new SimplePermutationChange<>(0, size, perm, this));
}
}
}
@Override
public int getSourceIndex(int index) {
return sorted[index].index;
}
private void updatePermutationIndexes(Change<? extends E> change) {
for (int i = 0; i < size; ++i) {
int p = change.getPermutation(sorted[i].index);
sorted[i].index = p;
perm[p] = i;
}
}
private void updateUnsorted(Change<? extends E> c) {
while (c.next()) {
if (c.wasPermutated()) {
Element[] sortedTmp = new Element[sorted.length];
for (int i = 0; i < size; ++i) {
if (i >= c.getFrom() && i < c.getTo()) {
int p = c.getPermutation(i);
sortedTmp[p] = sorted[i];
sortedTmp[p].index = p;
perm[i] = i;
} else {
sortedTmp[i] = sorted[i];
}
}
sorted = sortedTmp;
}
if (c.wasRemoved()) {
final int removedTo = c.getFrom() + c.getRemovedSize();
System.arraycopy(sorted, removedTo, sorted, c.getFrom(), size - removedTo);
System.arraycopy(perm, removedTo, perm, c.getFrom(), size - removedTo);
size -= c.getRemovedSize();
updateIndices(removedTo, removedTo, -c.getRemovedSize());
}
if (c.wasAdded()) {
ensureSize(size + c.getAddedSize());
updateIndices(c.getFrom(), c.getFrom(), c.getAddedSize());
System.arraycopy(sorted, c.getFrom(), sorted, c.getTo(), size - c.getFrom());
System.arraycopy(perm, c.getFrom(), perm, c.getTo(), size - c.getFrom());
size += c.getAddedSize();
for (int i = c.getFrom(); i < c.getTo(); ++i) {
sorted[i] = new Element<E>(c.getList().get(i), i);
perm[i] = i;
}
}
}
}
private static class Element<E> {
public Element(E e, int index) {
this.e = e;
this.index = index;
}
private E e;
private int index;
}
private static class ElementComparator<E> implements Comparator<Element<E>> {
private final Comparator<? super E> comparator;
public ElementComparator(Comparator<? super E> comparator) {
this.comparator = comparator;
}
@Override
@SuppressWarnings("unchecked")
public int compare(Element<E> o1, Element<E> o2) {
return comparator.compare(o1.e, o2.e);
}
}
private void ensureSize(int size) {
if (sorted.length < size) {
Element<E>[] replacement = new Element[size * 3 / 2 + 1];
System.arraycopy(sorted, 0, replacement, 0, this.size);
sorted = replacement;
int[] replacementPerm = new int[size * 3 / 2 + 1];
System.arraycopy(perm, 0, replacementPerm, 0, this.size);
perm = replacementPerm;
}
}
private void updateIndices(int from, int viewFrom, int difference) {
for (int i = 0; i < size; ++i) {
if (sorted[i].index >= from) {
sorted[i].index += difference;
}
if (perm[i] >= viewFrom) {
perm[i] += difference;
}
}
}
private int findPosition(E e) {
if (sorted.length == 0) {
return 0;
}
tempElement.e = e;
int pos = Arrays.binarySearch(sorted, 0, size, tempElement, elementComparator);
return pos;
}
private void insertToMapping(E e, int idx) {
int pos = findPosition(e);
if (pos < 0) {
pos = ~pos;
}
ensureSize(size + 1);
updateIndices(idx, pos, 1);
System.arraycopy(sorted, pos, sorted, pos + 1, size - pos);
sorted[pos] = new Element<>(e, idx);
System.arraycopy(perm, idx, perm, idx + 1, size - idx);
perm[idx] = pos;
++size;
nextAdd(pos, pos + 1);
}
private void setAllToMapping(List<? extends E> list, int to) {
ensureSize(to);
size = to;
for (int i = 0; i < to; ++i) {
sorted[i] = new Element<E>(list.get(i), i);
}
int[] perm = helper.sort(sorted, 0, size, elementComparator);
System.arraycopy(perm, 0, this.perm, 0, size);
nextAdd(0, size);
}
private void removeFromMapping(int idx, E e) {
int pos = perm[idx];
System.arraycopy(sorted, pos + 1, sorted, pos, size - pos - 1);
System.arraycopy(perm, idx + 1, perm, idx, size - idx - 1);
--size;
sorted[size] = null;
updateIndices(idx + 1, pos, -1);
nextRemove(pos, e);
}
private void removeAllFromMapping() {
List<E> removed = new ArrayList(this);
for (int i = 0; i < size; ++i) {
sorted[i] = null;
}
size = 0;
nextRemove(0, removed);
}
private void update(Change<? extends E> c) {
int[] perm = helper.sort(sorted, 0, size, elementComparator);
for (int i = 0; i < size; i++) {
this.perm[sorted[i].index] = i;
}
nextPermutation(0, size, perm);
for (int i = c.getFrom(), to = c.getTo(); i < to; ++i) {
nextUpdate(this.perm[i]);
}
}
private void addRemove(Change<? extends E> c) {
if (c.getFrom() == 0 && c.getRemovedSize() == size) {
removeAllFromMapping();
} else {
for (int i = 0, sz = c.getRemovedSize(); i < sz; ++i) {
removeFromMapping(c.getFrom(), c.getRemoved().get(i));
}
}
if (size == 0) {
setAllToMapping(c.getList(), c.getTo()); // This is basically equivalent to getAddedSubList
// as size is 0, only valid "from" is also 0
} else {
for (int i = c.getFrom(), to = c.getTo(); i < to; ++i) {
insertToMapping(c.getList().get(i), i);
}
}
}
}

View File

@ -9,12 +9,10 @@ set -e
version=0.4.9.6
jarFile="/media/sf_vm_shared_ubuntu14_32bit/Bitsquare-$version.jar"
jdkfixFile="/media/sf_vm_shared_ubuntu14_32bit/jdkfix-$version.jar"
# Note: fakeroot needs to be installed on linux
$JAVA_HOME/bin/javapackager \
-deploy \
-BjvmOptions=-Xbootclasspath/a:"jdkfix-$version.jar":"../runtime/lib/ext/jfxrt.jar" \
-Bruntime="$JAVA_HOME/jre" \
-BappVersion=$version \
-Bcategory=Internet \

View File

@ -9,12 +9,10 @@ set -e
version=0.4.9.6
jarFile="/media/sf_vm_shared_ubuntu/Bitsquare-$version.jar"
jdkfixFile="/media/sf_vm_shared_ubuntu/jdkfix-$version.jar"
# Note: fakeroot needs to be installed on linux
$JAVA_HOME/bin/javapackager \
-deploy \
-BjvmOptions=-Xbootclasspath/a:"jdkfix-$version.jar":"../runtime/lib/ext/jfxrt.jar" \
-Bruntime="$JAVA_HOME/jre" \
-BappVersion=$version \
-Bcategory=Internet \

View File

@ -17,15 +17,9 @@ cp gui/target/shaded.jar "/Users/mk/vm_shared_windows_32bit/Bitsquare-$version.j
cp seednode/target/SeedNode.jar "gui/deploy/SeedNode-$version.jar"
cp jdkfix/target/jdkfix-$version.jar "/Users/mk/vm_shared_ubuntu/jdkfix-$version.jar"
cp jdkfix/target/jdkfix-$version.jar "/Users/mk/vm_shared_windows/jdkfix-$version.jar"
cp jdkfix/target/jdkfix-$version.jar "/Users/mk/vm_shared_ubuntu14_32bit/jdkfix-$version.jar"
cp jdkfix/target/jdkfix-$version.jar "/Users/mk/vm_shared_windows_32bit/jdkfix-$version.jar"
echo "Using JAVA_HOME: $JAVA_HOME"
$JAVA_HOME/bin/javapackager \
-deploy \
-BjvmOptions=-Xbootclasspath/a:"jdkfix-$version.jar":"../PlugIns/Java.runtime/Contents/Home/jre/lib/ext/jfxrt.jar" \
-BappVersion=$version \
-Bmac.CFBundleIdentifier=io.bitsquare \
-Bmac.CFBundleName=Bitsquare \
@ -36,7 +30,7 @@ $JAVA_HOME/bin/javapackager \
-title Bitsquare \
-vendor Bitsquare \
-outdir gui/deploy \
-srcfiles "gui/deploy/Bitsquare-$version.jar:jdkfix/target/jdkfix-$version.jar" \
-srcfiles "gui/deploy/Bitsquare-$version.jar" \
-appclass io.bitsquare.app.BitsquareAppMain \
-outfile Bitsquare \
-BjvmProperties=-Djava.net.preferIPv4Stack=true

View File

@ -5,8 +5,6 @@
:: 64 bit build
:: Needs Inno Setup 5 or later (http://www.jrsoftware.org/isdl.php)
:: Did not get -BjvmOptions=-Xbootclasspath working on windows, but if the jdkfix jar is copied into the jdk/jre dir it will override the default classes
SET version=0.4.9.6
:: Private setup

View File

@ -49,7 +49,6 @@
<module>seednode</module>
<module>monitor</module>
<module>statistics</module>
<module>jdkfix</module>
</modules>
<build>