From 482b98e869d07802310e249d09d784c63f9a86b6 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 19 Sep 2014 15:40:50 +0200 Subject: Introduced static method ItemPath.fromUUIDString and made the UUID constructor protected to better handle ItemPath and AgentPath construction with String UUIDs, throwing the right exceptions. --- src/main/java/com/c2kernel/process/ItemHTTPBridge.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/c2kernel/process/ItemHTTPBridge.java') diff --git a/src/main/java/com/c2kernel/process/ItemHTTPBridge.java b/src/main/java/com/c2kernel/process/ItemHTTPBridge.java index 86e3659..8e4329c 100644 --- a/src/main/java/com/c2kernel/process/ItemHTTPBridge.java +++ b/src/main/java/com/c2kernel/process/ItemHTTPBridge.java @@ -1,11 +1,11 @@ package com.c2kernel.process; import java.util.StringTokenizer; -import java.util.UUID; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.lookup.DomainPath; +import com.c2kernel.lookup.InvalidItemPathException; import com.c2kernel.lookup.ItemPath; import com.c2kernel.utils.server.HTTPRequestHandler; @@ -33,8 +33,8 @@ public class ItemHTTPBridge extends HTTPRequestHandler { String query = tok.nextToken(); ItemPath itemPath; try { - itemPath = new ItemPath(UUID.fromString(path)); - } catch (IllegalArgumentException ex) { + itemPath = ItemPath.fromUUIDString(path); + } catch (InvalidItemPathException ex) { DomainPath domPath = new DomainPath(path); if (!domPath.exists()) return error("404 Not Found", "The path "+path+" you requested was not found."); -- cgit v1.2.3