|
8 | 8 |
|
9 | 9 | from java.io import IOException |
10 | 10 | from java.net import URI |
| 11 | +from java.net import URISyntaxException |
11 | 12 | from java.security import NoSuchAlgorithmException |
12 | 13 |
|
13 | 14 | from oracle.weblogic.deploy.deploy import DeployException |
@@ -328,36 +329,47 @@ def discard_current_edit(): |
328 | 329 | _logger.exiting(class_name=_class_name, method_name=_method_name) |
329 | 330 | return |
330 | 331 |
|
| 332 | + |
331 | 333 | def extract_from_uri(model_context, path_value): |
332 | 334 | """ |
333 | 335 | If the MBean path attribute has a URI file scheme, look past the scheme and |
334 | | - resolve any global tokens. |
| 336 | + resolve any global tokens. If the filename contains non-standard RFC 2936 and |
| 337 | + does not represent a file but rather a future file. |
335 | 338 |
|
336 | 339 | :param model_context: current context containing job information |
337 | 340 | :param path_value: MBean attribute path |
338 | 341 | :return: fully resolved URI path, or the path_value if not a URI scheme |
339 | 342 | """ |
340 | | - uri = URI(path_value) |
341 | | - if uri.getScheme() == 'file': |
342 | | - return FILE_URI + model_context.replace_token_string(uri.getPath()[1:]) |
| 343 | + _method_name = 'extract_from_uri' |
| 344 | + try: |
| 345 | + uri = URI(path_value) |
| 346 | + if uri.getScheme() == 'file': |
| 347 | + return FILE_URI + model_context.replace_token_string(uri.getPath()[1:]) |
| 348 | + except URISyntaxException, use: |
| 349 | + _logger.fine('WLSDPLY-09113', path_value, use, class_name=_class_name, method_name=_method_name) |
343 | 350 | return path_value |
344 | 351 |
|
345 | 352 |
|
346 | 353 | def get_rel_path_from_uri(model_context, path_value): |
347 | 354 | """ |
348 | 355 | If the MBean attribute is a URI. To extract it from the archive, need to make |
349 | | - it into a relative path. |
| 356 | + it into a relative path. If it contains non-standard RF 2396 characters, assume |
| 357 | + it is not a file name in the archive. |
350 | 358 | :param model_context: current context containing run information |
351 | 359 | :param path_value: the full value of the path attribute |
352 | 360 | :return: The relative value of the path attribute |
353 | 361 | """ |
354 | | - uri = URI(path_value) |
355 | | - if uri.getScheme() == 'file': |
356 | | - value = model_context.tokenize_path(uri.getPath()) |
357 | | - if value.startswith(model_context.DOMAIN_HOME_TOKEN): |
358 | | - # point past the token and first slash |
359 | | - value = value[len(model_context.DOMAIN_HOME_TOKEN)+1:] |
360 | | - return value |
| 362 | + _method_name = 'get_rel_path_from_uri' |
| 363 | + try: |
| 364 | + uri = URI(path_value) |
| 365 | + if uri.getScheme() == 'file': |
| 366 | + value = model_context.tokenize_path(uri.getPath()) |
| 367 | + if value.startswith(model_context.DOMAIN_HOME_TOKEN): |
| 368 | + # point past the token and first slash |
| 369 | + value = value[len(model_context.DOMAIN_HOME_TOKEN)+1:] |
| 370 | + return value |
| 371 | + except URISyntaxException, use: |
| 372 | + _logger.fine('WLSDPLY-09113', path_value, use, class_name=_class_name, method_name=_method_name) |
361 | 373 | return path_value |
362 | 374 |
|
363 | 375 |
|
|
0 commit comments