Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 139726 Details for
Bug 281046
[xpath2] implementation of xs:base64Binary data type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch file for the bug
bug281046_patch.txt (text/plain), 5.59 KB, created by
Mukul Gandhi
on 2009-06-22 04:50:58 EDT
(
hide
)
Description:
patch file for the bug
Filename:
MIME Type:
Creator:
Mukul Gandhi
Created:
2009-06-22 04:50:58 EDT
Size:
5.59 KB
patch
obsolete
>Index: src/org/eclipse/wst/xml/xpath2/processor/function/XSCtrLibrary.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/function/XSCtrLibrary.java,v >retrieving revision 1.17 >diff -u -r1.17 XSCtrLibrary.java >--- src/org/eclipse/wst/xml/xpath2/processor/function/XSCtrLibrary.java 25 May 2009 23:43:45 -0000 1.17 >+++ src/org/eclipse/wst/xml/xpath2/processor/function/XSCtrLibrary.java 22 Jun 2009 08:48:33 -0000 >@@ -19,7 +19,8 @@ > * Mukul Gandhi - bug 277639 - implementation of xs:byte data type > * Mukul Gandhi - bug 277642 - implementation of xs:unsignedInt data type > * Mukul Gandhi - bug 277645 - implementation of xs:unsighedShort data type >- * Mukul Gandhi - bug 277650 - implementation of xs:unsignedByte data type >+ * Mukul Gandhi - bug 277650 - implementation of xs:unsignedByte data type >+ * Mukul Gandhi - bug 281046 - implementation of xs:base64Binary data type > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.function; >@@ -79,5 +80,7 @@ > add_type(new XSAnyURI()); > add_type(new XSYearMonthDuration()); > add_type(new XSDayTimeDuration()); >+ >+ add_type(new XSBase64Binary()); > } > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBase64Binary.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBase64Binary.java >diff -N src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBase64Binary.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/XSBase64Binary.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,149 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 Mukul Gandhi, and others >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Mukul Gandhi - bug 281046 - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.wst.xml.xpath2.processor.internal.types; >+ >+import org.apache.xerces.impl.dv.util.Base64; >+import org.eclipse.wst.xml.xpath2.processor.DynamicError; >+import org.eclipse.wst.xml.xpath2.processor.ResultSequence; >+import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >+import org.eclipse.wst.xml.xpath2.processor.internal.function.CmpEq; >+ >+/** >+ * A representation of the base64Binary datatype >+ */ >+public class XSBase64Binary extends CtrType implements CmpEq { >+ >+ private String _value; >+ >+ /** >+ * Initialises using the supplied String >+ * >+ * @param x >+ * The String to initialise to >+ */ >+ public XSBase64Binary(String x) { >+ _value = x; >+ } >+ >+ /** >+ * Initialises to null >+ */ >+ public XSBase64Binary() { >+ this(null); >+ } >+ >+ /** >+ * Retrieves the datatype's full pathname >+ * >+ * @return "xs:base64Binary" which is the datatype's full pathname >+ */ >+ @Override >+ public String string_type() { >+ return "xs:base64Binary"; >+ } >+ >+ /** >+ * Retrieves the datatype's name >+ * >+ * @return "base64Binary" which is the datatype's name >+ */ >+ @Override >+ public String type_name() { >+ return "base64Binary"; >+ } >+ >+ /** >+ * Retrieves a String representation of the base64Binary stored. This method is >+ * functionally identical to value() >+ * >+ * @return The base64Binary stored >+ */ >+ @Override >+ public String string_value() { >+ return _value; >+ } >+ >+ /** >+ * Retrieves a String representation of the base64Binary stored. This method is >+ * functionally identical to string_value() >+ * >+ * @return The base64Binary stored >+ */ >+ public String value() { >+ return _value; >+ } >+ >+ /** >+ * Creates a new ResultSequence consisting of the base64Binary value >+ * >+ * @param arg >+ * The ResultSequence from which to construct base64Binary value >+ * @return New ResultSequence representing base64Binary value >+ * @throws DynamicError >+ */ >+ @Override >+ public ResultSequence constructor(ResultSequence arg) throws DynamicError { >+ ResultSequence rs = ResultSequenceFactory.create_new(); >+ >+ if (arg.empty()) >+ return rs; >+ >+ AnyAtomicType aat = (AnyAtomicType) arg.first(); >+ >+ String str_value = aat.string_value(); >+ byte[] decodedValue = Base64.decode(str_value); >+ if (decodedValue != null) { >+ rs.add(new XSBase64Binary(str_value)); >+ } >+ else { >+ // invalid base64 string >+ throw DynamicError.throw_type_error(); >+ } >+ >+ return rs; >+ } >+ >+ >+ /** >+ * Equality comparison between this and the supplied representation which >+ * must be of type base64Binary >+ * >+ * @param arg >+ * The representation to compare with >+ * @return True if the two representation are same. False otherwise. >+ * >+ * @throws DynamicError >+ */ >+ public boolean eq(AnyType arg) throws DynamicError { >+ String valToCompare = arg.string_value(); >+ >+ byte[] value1 = Base64.decode(_value); >+ byte[] value2 = Base64.decode(valToCompare); >+ if (value2 == null) { >+ return false; >+ } >+ >+ int len = value1.length; >+ if (len != value2.length) { >+ return false; >+ } >+ >+ for (int i = 0; i < len; i++) { >+ if (value1[i] != value2[i]) { >+ return false; >+ } >+ } >+ >+ return true; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 281046
: 139726 |
139727