Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ac
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OATS-CADC
ac
Commits
a10a124d
Commit
a10a124d
authored
10 years ago
by
Jeff Burke
Browse files
Options
Downloads
Patches
Plain Diff
s1666: fixed CsvReader handling group names
parent
057c890f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/cadcAccessControl/src/ca/nrc/cadc/ac/client/GMSClient.java
+14
-11
14 additions, 11 deletions
...adcAccessControl/src/ca/nrc/cadc/ac/client/GMSClient.java
with
14 additions
and
11 deletions
projects/cadcAccessControl/src/ca/nrc/cadc/ac/client/GMSClient.java
+
14
−
11
View file @
a10a124d
...
@@ -78,6 +78,7 @@ import java.net.HttpURLConnection;
...
@@ -78,6 +78,7 @@ import java.net.HttpURLConnection;
import
java.net.MalformedURLException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.nio.charset.Charset
;
import
java.security.AccessControlContext
;
import
java.security.AccessControlContext
;
import
java.security.AccessControlException
;
import
java.security.AccessControlException
;
import
java.security.AccessController
;
import
java.security.AccessController
;
...
@@ -313,15 +314,13 @@ public class GMSClient
...
@@ -313,15 +314,13 @@ public class GMSClient
URL
getGroupNamesURL
=
new
URL
(
this
.
baseURL
+
"/groups"
);
URL
getGroupNamesURL
=
new
URL
(
this
.
baseURL
+
"/groups"
);
log
.
debug
(
"getGroupNames request to "
+
getGroupNamesURL
.
toString
());
log
.
debug
(
"getGroupNames request to "
+
getGroupNamesURL
.
toString
());
HttpURLConnection
conn
=
HttpURLConnection
conn
=
(
HttpURLConnection
)
getGroupNamesURL
.
openConnection
();
(
HttpURLConnection
)
getGroupNamesURL
.
openConnection
();
conn
.
setRequestMethod
(
"GET"
);
conn
.
setRequestMethod
(
"GET"
);
SSLSocketFactory
sf
=
getSSLSocketFactory
();
SSLSocketFactory
sf
=
getSSLSocketFactory
();
if
((
sf
!=
null
)
&&
((
conn
instanceof
HttpsURLConnection
)))
if
((
sf
!=
null
)
&&
((
conn
instanceof
HttpsURLConnection
)))
{
{
((
HttpsURLConnection
)
conn
)
((
HttpsURLConnection
)
conn
).
setSSLSocketFactory
(
sf
);
.
setSSLSocketFactory
(
sf
);
}
}
int
responseCode
=
-
1
;
int
responseCode
=
-
1
;
try
try
...
@@ -332,11 +331,12 @@ public class GMSClient
...
@@ -332,11 +331,12 @@ public class GMSClient
{
{
throw
new
AccessControlException
(
e
.
getMessage
());
throw
new
AccessControlException
(
e
.
getMessage
());
}
}
log
.
debug
(
"getGroupNames response "
+
responseCode
);
if
(
responseCode
!=
200
)
if
(
responseCode
!=
200
)
{
{
String
errMessage
=
NetUtil
.
getErrorBody
(
conn
);
String
errMessage
=
NetUtil
.
getErrorBody
(
conn
);
log
.
debug
(
"
del
et
e
Group response "
+
responseCode
+
": "
+
log
.
debug
(
"
g
etGroup
Names
response "
+
responseCode
+
": "
+
errMessage
);
errMessage
);
if
((
responseCode
==
401
)
||
(
responseCode
==
403
)
||
if
((
responseCode
==
401
)
||
(
responseCode
==
403
)
||
...
@@ -351,16 +351,19 @@ public class GMSClient
...
@@ -351,16 +351,19 @@ public class GMSClient
throw
new
IOException
(
"HttpResponse ("
+
responseCode
+
") - "
+
errMessage
);
throw
new
IOException
(
"HttpResponse ("
+
responseCode
+
") - "
+
errMessage
);
}
}
log
.
error
(
"Content-Length: "
+
conn
.
getHeaderField
(
"Content-Length"
));
log
.
error
(
"Content-Type: "
+
conn
.
getHeaderField
(
"Content-Type"
));
try
try
{
{
List
<
String
>
groupNames
=
new
ArrayList
<
String
>();
List
<
String
>
groupNames
=
new
ArrayList
<
String
>();
Reader
ioReader
=
new
InputStreamReader
(
conn
.
getInputStream
());
CsvReader
reader
=
new
CsvReader
(
conn
.
getInputStream
(),
','
,
Charset
.
forName
(
"UTF-8"
));
BufferedReader
br
=
new
BufferedReader
(
ioReader
);
if
(
reader
.
readRecord
())
CsvReader
reader
=
new
CsvReader
(
br
);
for
(
int
i
=
0
;
i
<
reader
.
getColumnCount
();
i
++)
{
{
groupNames
.
add
(
reader
.
get
(
i
));
for
(
int
i
=
0
;
i
<
reader
.
getColumnCount
();
i
++)
{
groupNames
.
add
(
reader
.
get
(
i
));
}
}
}
return
groupNames
;
return
groupNames
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment