Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery
/
mde
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e3747d78
authored
Mar 07, 2017
by
Adi Amir
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
bugfix: index out of bound while building link file name
parent
4b908432
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
src/main/java/logic/GEManager.java
src/main/java/logic/GEManager.java
View file @
e3747d78
...
@@ -77,6 +77,11 @@ public class GEManager {
...
@@ -77,6 +77,11 @@ public class GEManager {
SimpleHttpResponse
resp
=
null
;
SimpleHttpResponse
resp
=
null
;
BaseRestResponse
brr
=
new
BaseRestResponse
(
false
,
null
);
BaseRestResponse
brr
=
new
BaseRestResponse
(
false
,
null
);
String
api
=
""
;
for
(
String
tk:
apiIdAsParams
)
api
+=
tk
+
"."
;
logger
.
info
(
"received getCamera() serviceId="
+
serviceId
+
" api="
+
api
);
req
=
buildCameraHttpRequest
(
requestContext
,
content
,
apiIdAsParams
);
req
=
buildCameraHttpRequest
(
requestContext
,
content
,
apiIdAsParams
);
try
{
try
{
resp
=
httpClient
.
processRequest
(
req
);
resp
=
httpClient
.
processRequest
(
req
);
...
@@ -87,6 +92,7 @@ public class GEManager {
...
@@ -87,6 +92,7 @@ public class GEManager {
if
(
resp
.
getStatusCode
()
==
200
)
if
(
resp
.
getStatusCode
()
==
200
)
return
buildCameraResp
(
resp
);
return
buildCameraResp
(
resp
);
else
if
(
resp
.
getStatusCode
()
==
403
||
resp
.
getStatusCode
()
==
401
)
{
else
if
(
resp
.
getStatusCode
()
==
403
||
resp
.
getStatusCode
()
==
401
)
{
logger
.
info
(
"no valid token - obtain a new token ..."
);
if
(
getNewToken
())
if
(
getNewToken
())
brr
=
executeRequest
(
serviceId
,
apiIdAsParams
,
requestContext
,
content
,
isMaintenanceRequest
);
brr
=
executeRequest
(
serviceId
,
apiIdAsParams
,
requestContext
,
content
,
isMaintenanceRequest
);
else
else
...
@@ -103,6 +109,11 @@ public class GEManager {
...
@@ -103,6 +109,11 @@ public class GEManager {
SimpleHttpResponse
resp
=
null
;
SimpleHttpResponse
resp
=
null
;
BaseRestResponse
brr
=
new
BaseRestResponse
(
false
,
null
);
BaseRestResponse
brr
=
new
BaseRestResponse
(
false
,
null
);
String
api
=
""
;
for
(
String
tk:
apiIdAsParams
)
api
+=
tk
+
"."
;
logger
.
info
(
"received getCamerasList() serviceId="
+
serviceId
+
" api="
+
api
);
req
=
buildCamerasHttpRequest
(
requestContext
,
content
);
req
=
buildCamerasHttpRequest
(
requestContext
,
content
);
try
{
try
{
resp
=
httpClient
.
processRequest
(
req
);
resp
=
httpClient
.
processRequest
(
req
);
...
@@ -110,8 +121,9 @@ public class GEManager {
...
@@ -110,8 +121,9 @@ public class GEManager {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
if
(
resp
.
getStatusCode
()
==
200
)
if
(
resp
.
getStatusCode
()
==
200
)
return
buildCamera
s
Resp
(
resp
);
return
buildCamera
List
Resp
(
resp
);
else
if
(
resp
.
getStatusCode
()
==
403
||
resp
.
getStatusCode
()
==
401
)
{
else
if
(
resp
.
getStatusCode
()
==
403
||
resp
.
getStatusCode
()
==
401
)
{
logger
.
info
(
"no valid token - obtain a new token ..."
);
if
(
getNewToken
())
if
(
getNewToken
())
brr
=
executeRequest
(
serviceId
,
apiIdAsParams
,
requestContext
,
content
,
isMaintenanceRequest
);
brr
=
executeRequest
(
serviceId
,
apiIdAsParams
,
requestContext
,
content
,
isMaintenanceRequest
);
else
else
...
@@ -160,7 +172,10 @@ public class GEManager {
...
@@ -160,7 +172,10 @@ public class GEManager {
// file name
// file name
String
filename
=
getImageFileName
(
url
);
String
filename
=
getImageFileName
(
url
);
String
[]
fileNameTokens
=
filename
.
split
(
"\\."
);
String
[]
fileNameTokens
=
filename
.
split
(
"\\."
);
filename
=
fileNameTokens
[
0
]
+
".latest"
+
"."
+
fileNameTokens
[
1
];
if
(
fileNameTokens
.
length
==
2
)
filename
=
fileNameTokens
[
0
]
+
".latest"
+
"."
+
fileNameTokens
[
1
];
else
filename
=
fileNameTokens
[
0
]
+
".latest"
;
dataObj
.
put
(
"fileName"
,
filename
);
dataObj
.
put
(
"fileName"
,
filename
);
// data
// data
dataObj
.
put
(
"data"
,
resp
.
getContent
());
dataObj
.
put
(
"data"
,
resp
.
getContent
());
...
@@ -174,7 +189,7 @@ public class GEManager {
...
@@ -174,7 +189,7 @@ public class GEManager {
}
}
return
brr
;
return
brr
;
}
}
private
BaseRestResponse
buildCamera
s
Resp
(
SimpleHttpResponse
resp
)
{
private
BaseRestResponse
buildCamera
List
Resp
(
SimpleHttpResponse
resp
)
{
BaseRestResponse
brr
=
new
BaseRestResponse
(
true
,
null
);
BaseRestResponse
brr
=
new
BaseRestResponse
(
true
,
null
);
int
size
;
int
size
;
String
content
=
resp
.
getContent
();
String
content
=
resp
.
getContent
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment