diff options
author | Venky Shankar <vshankar@redhat.com> | 2012-02-29 19:25:30 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-03-01 08:49:42 -0800 |
commit | f93045296870cb6938d9b4356a4f3198cbebe3ba (patch) | |
tree | 39b35f201019fc2d6c953fa460eb3c73cc775fd7 /hdfs | |
parent | 0978b5a36d379839ff543fd54612fde476deede7 (diff) |
hdfs/plugin: Fix regex for parsing pathinfo string
Change-Id: I3a5d78f39a15c8029cd40225013e9ac40beb9373
BUG: 797116
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.com/2844
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'hdfs')
-rw-r--r-- | hdfs/0.20.2/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFSXattr.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/hdfs/0.20.2/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFSXattr.java b/hdfs/0.20.2/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFSXattr.java index 54946585930..18e9003b43e 100644 --- a/hdfs/0.20.2/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFSXattr.java +++ b/hdfs/0.20.2/src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFSXattr.java @@ -148,9 +148,18 @@ public class GlusterFSXattr { while ( (s = brInput.readLine()) != null ) cmdOut += s; - Pattern pattern = Pattern.compile("<(.*?):(.*?)>"); + /** + * TODO: Use a single regex for extracting posix paths as well + * as xlator counts for layout matching. + */ + + Pattern pattern = Pattern.compile("<(.*?)[:\\(](.*?)>"); Matcher matcher = pattern.matcher(cmdOut); + Pattern p_px = Pattern.compile(".*?:(.*)"); + Matcher m_px; + String gibberish_path; + s = null; while (matcher.find()) { xlator = matcher.group(1); @@ -169,8 +178,14 @@ public class GlusterFSXattr { if (vol.get(key) == null) vol.put(key, new ArrayList<String>()); - vol.get(key).add(matcher.group(2)); + gibberish_path = matcher.group(2); + + /* extract posix path from the gibberish string */ + m_px = p_px.matcher(gibberish_path); + if (!m_px.find()) + throw new IOException("Cannot extract posix path"); + vol.get(key).add(m_px.group(1)); continue; } |