MCPcopy Create free account
hub / github.com/apache/tomcat / addSDE

Method addSDE

java/org/apache/jasper/compiler/SmapUtil.java:208–261  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

206 }
207
208 void addSDE() throws UnsupportedEncodingException, IOException {
209 copy(4 + 2 + 2); // magic min/maj version
210 int constantPoolCountPos = genPos;
211 int constantPoolCount = readU2();
212 if (log.isTraceEnabled()) {
213 log.trace("constant pool count: " + constantPoolCount);
214 }
215 writeU2(constantPoolCount);
216
217 // copy old constant pool return index of SDE symbol, if found
218 sdeIndex = copyConstantPool(constantPoolCount);
219 if (sdeIndex < 0) {
220 // if "SourceDebugExtension" symbol not there add it
221 writeUtf8ForSDE();
222
223 // increment the constantPoolCount
224 sdeIndex = constantPoolCount;
225 ++constantPoolCount;
226 randomAccessWriteU2(constantPoolCountPos, constantPoolCount);
227
228 if (log.isTraceEnabled()) {
229 log.trace("SourceDebugExtension not found, installed at: " + sdeIndex);
230 }
231 } else {
232 if (log.isTraceEnabled()) {
233 log.trace("SourceDebugExtension found at: " + sdeIndex);
234 }
235 }
236 copy(2 + 2 + 2); // access, this, super
237 int interfaceCount = readU2();
238 writeU2(interfaceCount);
239 if (log.isTraceEnabled()) {
240 log.trace("interfaceCount: " + interfaceCount);
241 }
242 copy(interfaceCount * 2);
243 copyMembers(); // fields
244 copyMembers(); // methods
245 int attrCountPos = genPos;
246 int attrCount = readU2();
247 writeU2(attrCount);
248 if (log.isTraceEnabled()) {
249 log.trace("class attrCount: " + attrCount);
250 }
251 // copy the class attributes, return true if SDE attr found (not copied)
252 if (!copyAttrs(attrCount)) {
253 // we will be adding SDE and it isn't already counted
254 ++attrCount;
255 randomAccessWriteU2(attrCountPos, attrCount);
256 if (log.isTraceEnabled()) {
257 log.trace("class attrCount incremented");
258 }
259 }
260 writeAttrForSDE(sdeIndex);
261 }
262
263 void copyMembers() {
264 int count = readU2();

Callers 1

installMethod · 0.95

Calls 11

copyMethod · 0.95
readU2Method · 0.95
writeU2Method · 0.95
copyConstantPoolMethod · 0.95
writeUtf8ForSDEMethod · 0.95
randomAccessWriteU2Method · 0.95
copyMembersMethod · 0.95
copyAttrsMethod · 0.95
writeAttrForSDEMethod · 0.95
isTraceEnabledMethod · 0.65
traceMethod · 0.65

Tested by

no test coverage detected