|
From: <pe...@us...> - 2003-11-21 04:44:34
|
Update of /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv10728/src/java/org/neuclear/xml
Modified Files:
AbstractElementProxy.java XMLException.java XMLTools.java
Log Message:
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
Otherwise You will Finaliate.
Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
This should hopefully make everything more stable (and secure).
Index: AbstractElementProxy.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/AbstractElementProxy.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AbstractElementProxy.java 19 Nov 2003 23:33:17 -0000 1.2
--- AbstractElementProxy.java 21 Nov 2003 04:44:31 -0000 1.3
***************
*** 2,5 ****
--- 2,11 ----
* $Id$
* $Log$
+ * Revision 1.3 2003/11/21 04:44:31 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.2 2003/11/19 23:33:17 pelle
* Signers now can generatekeys via the generateKey() method.
***************
*** 86,106 ****
public abstract class AbstractElementProxy implements ElementProxy {
! protected AbstractElementProxy(String name, String prefix, String nsURI) {
this(name, DocumentHelper.createNamespace(prefix, nsURI));
}
! protected AbstractElementProxy(String name, Namespace ns) {
this(DocumentHelper.createQName(name, ns));
}
! protected AbstractElementProxy(QName qname) {
this.element = DocumentHelper.createElement(qname);
}
! protected AbstractElementProxy(Element elem) {
element = elem;
}
! private Element element;
public final Element getElement() {
--- 92,112 ----
public abstract class AbstractElementProxy implements ElementProxy {
! protected AbstractElementProxy(final String name, final String prefix, final String nsURI) {
this(name, DocumentHelper.createNamespace(prefix, nsURI));
}
! protected AbstractElementProxy(final String name, final Namespace ns) {
this(DocumentHelper.createQName(name, ns));
}
! protected AbstractElementProxy(final QName qname) {
this.element = DocumentHelper.createElement(qname);
}
! protected AbstractElementProxy(final Element elem) {
element = elem;
}
! private final Element element;
public final Element getElement() {
***************
*** 108,116 ****
}
! protected void addElement(AbstractElementProxy child) throws XMLException {
addElement(child.getElement());
}
! protected void addElement(Element child) throws XMLException {
element.add(child);
element.addText("\n");
--- 114,122 ----
}
! protected final void addElement(final AbstractElementProxy child) throws XMLException {
addElement(child.getElement());
}
! protected final void addElement(final Element child) throws XMLException {
element.add(child);
element.addText("\n");
***************
*** 133,137 ****
public abstract Namespace getNS();
! static Namespace XMLNS = DocumentHelper.createNamespace("xmlns", "http://www.w3.org/XML/1998/namespace");
}
--- 139,143 ----
public abstract Namespace getNS();
! static final Namespace XMLNS = DocumentHelper.createNamespace("xmlns", "http://www.w3.org/XML/1998/namespace");
}
Index: XMLException.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/XMLException.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** XMLException.java 11 Nov 2003 16:33:20 -0000 1.1.1.1
--- XMLException.java 21 Nov 2003 04:44:31 -0000 1.2
***************
*** 1,4 ****
--- 1,10 ----
/* $Id$
* $Log$
+ * Revision 1.2 2003/11/21 04:44:31 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.1.1.1 2003/11/11 16:33:20 pelle
* Moved over from neudist.org
***************
*** 26,38 ****
public class XMLException extends Exception {
! public XMLException(String message) {
super(message);
}
! public XMLException(Throwable t) {
super(t);
}
! public XMLException(String message, Throwable t) {
super(message, t);
}
--- 32,44 ----
public class XMLException extends Exception {
! public XMLException(final String message) {
super(message);
}
! public XMLException(final Throwable t) {
super(t);
}
! public XMLException(final String message, final Throwable t) {
super(message, t);
}
Index: XMLTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/XMLTools.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** XMLTools.java 19 Nov 2003 23:33:17 -0000 1.2
--- XMLTools.java 21 Nov 2003 04:44:31 -0000 1.3
***************
*** 2,5 ****
--- 2,11 ----
* $Id$
* $Log$
+ * Revision 1.3 2003/11/21 04:44:31 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.2 2003/11/19 23:33:17 pelle
* Signers now can generatekeys via the generateKey() method.
***************
*** 136,140 ****
! public class XMLTools {
/**
* public static void writeDom(Document doc,OutputStream out) throws IOException{
--- 142,146 ----
! public final class XMLTools {
/**
* public static void writeDom(Document doc,OutputStream out) throws IOException{
***************
*** 158,162 ****
* }
*/
! public static boolean isAttributeTrue(Element elem, String name) {
return isTrue(elem.attributeValue(name), false);
}
--- 164,168 ----
* }
*/
! public static boolean isAttributeTrue(final Element elem, final String name) {
return isTrue(elem.attributeValue(name), false);
}
***************
*** 166,172 ****
}
! public static Document loadDocument(InputStream is) throws XMLException {
try {
! SAXReader xmlReader = new SAXReader();
return xmlReader.read(is);
} catch (Exception e) {
--- 172,178 ----
}
! public static Document loadDocument(final InputStream is) throws XMLException {
try {
! final SAXReader xmlReader = new SAXReader();
return xmlReader.read(is);
} catch (Exception e) {
***************
*** 176,181 ****
}
! public static Document loadDocument(File f) throws XMLException {
! SAXReader xmlReader = new SAXReader();
try {
return xmlReader.read(f);
--- 182,187 ----
}
! public static Document loadDocument(final File f) throws XMLException {
! final SAXReader xmlReader = new SAXReader();
try {
return xmlReader.read(f);
***************
*** 188,196 ****
}
! public static void writeFile(File outputFile, Document doc) throws XMLException {
writeFile(outputFile, doc.getRootElement());
}
! public static void writeFile(File outputFile, Element doc) throws XMLException {
try {
writeFile(new FileOutputStream(outputFile), doc);
--- 194,202 ----
}
! public static void writeFile(final File outputFile, final Document doc) throws XMLException {
writeFile(outputFile, doc.getRootElement());
}
! public static void writeFile(final File outputFile, final Element doc) throws XMLException {
try {
writeFile(new FileOutputStream(outputFile), doc);
***************
*** 200,207 ****
}
! public static void writeFile(OutputStream out, Element doc) throws XMLException {
try {
! XMLWriter writer = new XMLWriter(out, getOutputFormat());
writer.write(doc);
writer.close();
--- 206,213 ----
}
! public static void writeFile(final OutputStream out, final Element doc) throws XMLException {
try {
! final XMLWriter writer = new XMLWriter(out, getOutputFormat());
writer.write(doc);
writer.close();
***************
*** 211,218 ****
}
! public static String asXML(Element doc) throws XMLException {
! StringWriter ow = new StringWriter();
try {
! XMLWriter writer = new XMLWriter(ow, getOutputFormat());
writer.write(doc);
writer.close();
--- 217,224 ----
}
! public static String asXML(final Element doc) throws XMLException {
! final StringWriter ow = new StringWriter();
try {
! final XMLWriter writer = new XMLWriter(ow, getOutputFormat());
writer.write(doc);
writer.close();
***************
*** 224,228 ****
private static OutputFormat getOutputFormat() {
! OutputFormat format = OutputFormat.createCompactFormat();
format.setExpandEmptyElements(false);
format.setIndent(false);
--- 230,234 ----
private static OutputFormat getOutputFormat() {
! final OutputFormat format = OutputFormat.createCompactFormat();
format.setExpandEmptyElements(false);
format.setIndent(false);
***************
*** 233,240 ****
}
! public org.w3c.dom.Document doc2dom(Document doc) throws XMLException {
if (!(doc instanceof DOMDocument)) {
try {
! DOMWriter domWriter = new DOMWriter();
return domWriter.write(doc);
} catch (DocumentException e) {
--- 239,246 ----
}
! public final org.w3c.dom.Document doc2dom(final Document doc) throws XMLException {
if (!(doc instanceof DOMDocument)) {
try {
! final DOMWriter domWriter = new DOMWriter();
return domWriter.write(doc);
} catch (DocumentException e) {
***************
*** 245,258 ****
}
! public Document dom2doc(org.w3c.dom.Document dom) {
if (dom instanceof DOMDocument)
return (DOMDocument) dom;
else {
! DOMReader domReader = new DOMReader();
return domReader.read(dom);
}
}
! public static boolean isTrue(String clause, boolean defaultVal) {
if (isEmpty(clause))
return defaultVal;
--- 251,264 ----
}
! public final Document dom2doc(final org.w3c.dom.Document dom) {
if (dom instanceof DOMDocument)
return (DOMDocument) dom;
else {
! final DOMReader domReader = new DOMReader();
return domReader.read(dom);
}
}
! public static boolean isTrue(String clause, final boolean defaultVal) {
if (isEmpty(clause))
return defaultVal;
***************
*** 261,269 ****
}
! public static boolean isEmpty(Object obj) {
return (obj == null || obj.toString().equals(""));
}
! public static void rethrowException(Throwable e) throws XMLException {
throw new XMLException(e);
}
--- 267,275 ----
}
! public static boolean isEmpty(final Object obj) {
return (obj == null || obj.toString().equals(""));
}
! public static void rethrowException(final Throwable e) throws XMLException {
throw new XMLException(e);
}
|