1 /* |
1 /* |
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
107 * then wrap the map in a function that getEntry can use to override root |
107 * then wrap the map in a function that getEntry can use to override root |
108 * entry lookup for entries that have corresponding versioned entries |
108 * entry lookup for entries that have corresponding versioned entries |
109 */ |
109 */ |
110 private Function<byte[],byte[]> createVersionedLinks(int version) { |
110 private Function<byte[],byte[]> createVersionedLinks(int version) { |
111 HashMap<IndexNode,byte[]> aliasMap = new HashMap<>(); |
111 HashMap<IndexNode,byte[]> aliasMap = new HashMap<>(); |
112 getVersionMap(version, getInode(getBytes("/META-INF/versions"))).values() |
112 IndexNode verdir = getInode(getBytes("/META-INF/versions")); |
|
113 if (verdir != null) { |
|
114 getVersionMap(version, verdir).values() |
113 .forEach(versionNode -> { // for each META-INF/versions/{n} directory |
115 .forEach(versionNode -> { // for each META-INF/versions/{n} directory |
114 // put all the leaf inodes, i.e. entries, into the alias map |
116 // put all the leaf inodes, i.e. entries, into the alias map |
115 // possibly shadowing lower versioned entries |
117 // possibly shadowing lower versioned entries |
116 walk(versionNode, entryNode -> { |
118 walk(versionNode, entryNode -> { |
117 byte[] rootName = getRootName(versionNode, entryNode); |
119 byte[] rootName = getRootName(versionNode, entryNode); |