Skip to Content.
Sympa Menu

idok-commit - [idok-commit] idok commit r269 - in trunk/java/ch/idok: cli/command service/client/search/corba service/client/search/rest service/common

idok-commit AT lists.psi.ch

Subject: Commit emails of the iDok project

List archive

[idok-commit] idok commit r269 - in trunk/java/ch/idok: cli/command service/client/search/corba service/client/search/rest service/common


Chronological Thread 
  • From: "AFS account Roman Geus" <geus AT savannah.psi.ch>
  • To: idok-commit AT lists.psi.ch
  • Subject: [idok-commit] idok commit r269 - in trunk/java/ch/idok: cli/command service/client/search/corba service/client/search/rest service/common
  • Date: Thu, 2 Oct 2008 15:05:52 +0200
  • List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
  • List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>

Author: geus
Date: Thu Oct 2 15:05:52 2008
New Revision: 269

Log:
Fixed implementation, documentation and usage of Iterator.destroy()


Modified:
trunk/java/ch/idok/cli/command/SearchCommand.java
trunk/java/ch/idok/service/client/search/corba/CorbaSearchService.java
trunk/java/ch/idok/service/client/search/rest/RestSearchIterator.java
trunk/java/ch/idok/service/common/Iterator.java

Modified: trunk/java/ch/idok/cli/command/SearchCommand.java
==============================================================================
--- trunk/java/ch/idok/cli/command/SearchCommand.java (original)
+++ trunk/java/ch/idok/cli/command/SearchCommand.java Thu Oct 2 15:05:52
2008
@@ -120,7 +120,6 @@
out.println("\t" + new String(rawContent));
m = it.nextElement();
}
- it.destroy();
} catch (DmsException e) {
throw e;
} catch (Throwable th) {

Modified:
trunk/java/ch/idok/service/client/search/corba/CorbaSearchService.java
==============================================================================
--- trunk/java/ch/idok/service/client/search/corba/CorbaSearchService.java
(original)
+++ trunk/java/ch/idok/service/client/search/corba/CorbaSearchService.java
Thu Oct 2 15:05:52 2008
@@ -190,9 +190,10 @@

/** @brief Destroy the iterator. */
public void destroy() throws DmsException { // post: finished
- corbaIterator.destroy();
- corbaResult = null;
+ if (corbaIterator != null)
+ corbaIterator.destroy();
corbaIterator = null;
+ corbaResult = null;
}
}


Modified:
trunk/java/ch/idok/service/client/search/rest/RestSearchIterator.java
==============================================================================
--- trunk/java/ch/idok/service/client/search/rest/RestSearchIterator.java
(original)
+++ trunk/java/ch/idok/service/client/search/rest/RestSearchIterator.java
Thu Oct 2 15:05:52 2008
@@ -159,19 +159,19 @@
.getProperty("ch.idok.service.server.principal");
try {
// In Java 5 this ugly type cast is necessary
- final String token = (String)
Subject.doAsPrivileged(cred.getSubject(),
- new PrivilegedExceptionAction<String>() {
- public String run() throws Exception {
- return NegotiateFilter.buildToken64(serviceName);
- }
- }, null);
+ final String token = (String) Subject.doAsPrivileged(cred
+ .getSubject(), new PrivilegedExceptionAction<String>() {
+ public String run() throws Exception {
+ return NegotiateFilter.buildToken64(serviceName);
+ }
+ }, null);
request.setChallengeResponse(new ChallengeResponse(scheme,
token));
return request;
-
+
} catch (java.security.PrivilegedActionException pae) {
throw new DmsException(ErrorType.AUTHENTICATION, null,
"Could not generate Negotiate token", "",
pae.getCause());
- }
+ }
}

/**
@@ -222,7 +222,6 @@
* @see ch.idok.service.common.Iterator#destroy()
*/
public void destroy() throws DmsException {
-
}

/**
@@ -254,9 +253,10 @@
*/
public QueryMatch nextElement() throws DmsException {
QueryMatch result = nextElement;
- if (result == null)
+ if (result == null) {
+ destroy();
return null;
- else {
+ } else {
index += 1;
if (hits.hasNext())
nextElement = new RestQueryMatch(hits.next());

Modified: trunk/java/ch/idok/service/common/Iterator.java
==============================================================================
--- trunk/java/ch/idok/service/common/Iterator.java (original)
+++ trunk/java/ch/idok/service/common/Iterator.java Thu Oct 2 15:05:52
2008
@@ -39,6 +39,10 @@

/**
* @brief Get the next element of the sequence.
+ *
+ * Implementations of this method should call destroy() automatically
after
+ * the last element has been fetched.
+ *
* @return The next element in the sequence.
* @throws NoSuchElementException
* if hasNext() is false.
@@ -58,6 +62,9 @@
* This method has been added to provide the same functionality as
next(),
* but with project conformant error reporting.
*
+ * Implementations of this method should call destroy() automatically
after
+ * the last element has been fetched.
+ *
* @return The next elements of the sequence, or null if there is no next
* element.
* @throws DmsException



  • [idok-commit] idok commit r269 - in trunk/java/ch/idok: cli/command service/client/search/corba service/client/search/rest service/common, AFS account Roman Geus, 10/02/2008

Archive powered by MHonArc 2.6.19.

Top of Page