import cleanup
This commit is contained in:
@@ -13,11 +13,8 @@ import javax.crypto.IllegalBlockSizeException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import nodash.core.NoAdapter;
|
||||
import nodash.core.NoCore;
|
||||
import nodash.core.NoUtil;
|
||||
import nodash.exceptions.NoByteSetBadDecryptionException;
|
||||
import nodash.exceptions.NoDashFatalException;
|
||||
import nodash.exceptions.NoDashSessionBadUuidException;
|
||||
import nodash.exceptions.NoSessionConfirmedException;
|
||||
import nodash.exceptions.NoSessionExpiredException;
|
||||
import nodash.exceptions.NoSessionNotAwaitingConfirmationException;
|
||||
@@ -191,26 +188,6 @@ public final class NoSession implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
private static String decryptUuid(String data) throws NoDashSessionBadUuidException {
|
||||
return decryptUuid(Base64.decodeBase64(data));
|
||||
}
|
||||
|
||||
private static String decryptUuid(byte[] data) throws NoDashSessionBadUuidException {
|
||||
if (data == null) {
|
||||
throw new NoDashSessionBadUuidException();
|
||||
}
|
||||
|
||||
try {
|
||||
return Base64.encodeBase64String(NoUtil.decrypt(data));
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new NoDashSessionBadUuidException();
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
throw new NoDashSessionBadUuidException();
|
||||
} catch (BadPaddingException e) {
|
||||
throw new NoDashSessionBadUuidException();
|
||||
}
|
||||
}
|
||||
|
||||
public void setIncoming(Collection<NoByteSet> incoming) {
|
||||
this.incoming = incoming;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,10 @@ package nodash.models.noactiontypes;
|
||||
|
||||
import java.security.PublicKey;
|
||||
|
||||
import nodash.core.NoCore;
|
||||
import nodash.core.NoAdapter;
|
||||
import nodash.exceptions.NoAdapterException;
|
||||
import nodash.exceptions.NoCannotGetInfluenceException;
|
||||
import nodash.exceptions.NoDashFatalException;
|
||||
import nodash.models.NoByteSet;
|
||||
import nodash.models.NoInfluence;
|
||||
|
||||
@@ -36,20 +38,27 @@ public abstract class NoErrorableAction extends NoTargetedAction {
|
||||
super(source);
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
@Override
|
||||
public void execute(NoAdapter adapter) {
|
||||
this.process();
|
||||
try {
|
||||
NoInfluence influence = this.generateTargetInfluence();
|
||||
if (influence != null) {
|
||||
NoByteSet byteSet = influence.getByteSet(this.target);
|
||||
NoCore.addByteSet(byteSet, this.target);
|
||||
adapter.addNoByteSet(byteSet, this.target);
|
||||
}
|
||||
} catch (NoCannotGetInfluenceException e) {
|
||||
NoInfluence errorInfluence = e.getResponseInfluence();
|
||||
if (errorInfluence != null) {
|
||||
NoByteSet byteSet = errorInfluence.getByteSet(this.target);
|
||||
NoCore.addByteSet(byteSet, this.target);
|
||||
try {
|
||||
adapter.addNoByteSet(byteSet, this.target);
|
||||
} catch (NoAdapterException e1) {
|
||||
throw new NoDashFatalException("Could not add the error byte set to the pool.");
|
||||
}
|
||||
}
|
||||
} catch (NoAdapterException e) {
|
||||
throw new NoDashFatalException("Could not add the byte set to the pool.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,10 @@ package nodash.models.noactiontypes;
|
||||
|
||||
import java.security.PublicKey;
|
||||
|
||||
import nodash.core.NoCore;
|
||||
import nodash.core.NoAdapter;
|
||||
import nodash.exceptions.NoAdapterException;
|
||||
import nodash.exceptions.NoCannotGetInfluenceException;
|
||||
import nodash.exceptions.NoDashFatalException;
|
||||
import nodash.models.NoByteSet;
|
||||
import nodash.models.NoInfluence;
|
||||
|
||||
@@ -37,30 +39,33 @@ public abstract class NoHandshakeAction extends NoSourcedAction {
|
||||
super(target, source);
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
@Override
|
||||
public void execute(NoAdapter adapter) {
|
||||
this.process();
|
||||
try {
|
||||
NoInfluence influence = this.generateTargetInfluence();
|
||||
if (influence != null) {
|
||||
NoByteSet byteSet = influence.getByteSet(this.target);
|
||||
NoCore.addByteSet(byteSet, this.target);
|
||||
adapter.addNoByteSet(byteSet, this.target);
|
||||
}
|
||||
|
||||
NoInfluence result = this.generateReturnedInfluence();
|
||||
if (result != null) {
|
||||
NoByteSet byteSet = result.getByteSet(this.source);
|
||||
NoCore.addByteSet(byteSet, this.source);
|
||||
adapter.addNoByteSet(byteSet, this.source);
|
||||
}
|
||||
} catch (NoCannotGetInfluenceException e) {
|
||||
NoInfluence errorInfluence = e.getResponseInfluence();
|
||||
if (errorInfluence != null) {
|
||||
NoByteSet byteSet = errorInfluence.getByteSet(this.source);
|
||||
NoCore.addByteSet(byteSet, this.source);
|
||||
try {
|
||||
adapter.addNoByteSet(byteSet, this.source);
|
||||
} catch (NoAdapterException e1) {
|
||||
throw new NoDashFatalException("Could not add error byte set to the pool.");
|
||||
}
|
||||
}
|
||||
} catch (NoAdapterException e) {
|
||||
throw new NoDashFatalException("Could not add byte sets to the pool.", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void purge() {
|
||||
super.purge();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,10 @@ package nodash.models.noactiontypes;
|
||||
|
||||
import java.security.PublicKey;
|
||||
|
||||
import nodash.core.NoCore;
|
||||
import nodash.core.NoAdapter;
|
||||
import nodash.exceptions.NoAdapterException;
|
||||
import nodash.exceptions.NoCannotGetInfluenceException;
|
||||
import nodash.exceptions.NoDashFatalException;
|
||||
import nodash.models.NoByteSet;
|
||||
import nodash.models.NoInfluence;
|
||||
|
||||
@@ -38,23 +40,31 @@ public abstract class NoSourcedAction extends NoTargetedAction {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
@Override
|
||||
public void execute(NoAdapter adapter) {
|
||||
this.process();
|
||||
try {
|
||||
NoInfluence influence = this.generateTargetInfluence();
|
||||
if (influence != null) {
|
||||
NoByteSet byteSet = influence.getByteSet(this.target);
|
||||
NoCore.addByteSet(byteSet, this.target);
|
||||
adapter.addNoByteSet(byteSet, this.target);
|
||||
}
|
||||
} catch (NoCannotGetInfluenceException e) {
|
||||
NoInfluence errorInfluence = e.getResponseInfluence();
|
||||
if (errorInfluence != null) {
|
||||
NoByteSet byteSet = errorInfluence.getByteSet(this.source);
|
||||
NoCore.addByteSet(byteSet, this.source);
|
||||
try {
|
||||
adapter.addNoByteSet(byteSet, this.source);
|
||||
} catch (NoAdapterException e1) {
|
||||
throw new NoDashFatalException("Could not add error byte set to the pool.", e);
|
||||
}
|
||||
}
|
||||
} catch (NoAdapterException e) {
|
||||
throw new NoDashFatalException("Could not add byte set to the pool.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purge() {
|
||||
super.purge();
|
||||
this.source = null;
|
||||
|
||||
@@ -19,7 +19,8 @@ package nodash.models.noactiontypes;
|
||||
|
||||
import java.security.PublicKey;
|
||||
|
||||
import nodash.core.NoCore;
|
||||
import nodash.core.NoAdapter;
|
||||
import nodash.exceptions.NoAdapterException;
|
||||
import nodash.exceptions.NoCannotGetInfluenceException;
|
||||
import nodash.exceptions.NoDashFatalException;
|
||||
import nodash.models.NoAction;
|
||||
@@ -36,22 +37,26 @@ public abstract class NoTargetedAction extends NoAction {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
@Override
|
||||
public void execute(NoAdapter adapter) {
|
||||
this.process();
|
||||
try {
|
||||
NoInfluence influence = this.generateTargetInfluence();
|
||||
if (influence != null) {
|
||||
NoByteSet byteSet = influence.getByteSet(this.target);
|
||||
NoCore.addByteSet(byteSet, this.target);
|
||||
adapter.addNoByteSet(byteSet, this.target);
|
||||
}
|
||||
} catch (NoCannotGetInfluenceException e) {
|
||||
if (e.getResponseInfluence() != null) {
|
||||
throw new NoDashFatalException(
|
||||
"Unsourced action has generated an error with an undeliverable influence.", e);
|
||||
}
|
||||
} catch (NoAdapterException e) {
|
||||
throw new NoDashFatalException("Could not add byte set to the pool.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purge() {
|
||||
this.target = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user