This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 186659
Collapse All | Expand All

(-)a/profiler/src/org/netbeans/modules/profiler/heapwalk/model/InstanceNode.java (+26 lines)
Lines 57-62 Link Here
57
import org.netbeans.lib.profiler.heap.HeapProgress;
57
import org.netbeans.lib.profiler.heap.HeapProgress;
58
import org.netbeans.lib.profiler.heap.Instance;
58
import org.netbeans.lib.profiler.heap.Instance;
59
import org.netbeans.lib.profiler.heap.JavaClass;
59
import org.netbeans.lib.profiler.heap.JavaClass;
60
import org.netbeans.lib.profiler.heap.PrimitiveArrayInstance;
60
61
61
62
62
/**
63
/**
Lines 196-201 Link Here
196
            }
197
            }
197
        }
198
        }
198
199
200
        if ("java.lang.String".equals(instance.getJavaClass().getName())) { // NOI18N
201
            Object _value = instance.getValueOfField("value"); // NOI18N
202
            Object _offset = instance.getValueOfField("offset"); // NOI18N
203
            Object _count = instance.getValueOfField("count"); // NOI18N
204
            if (_value instanceof PrimitiveArrayInstance && ((Instance) _value).getJavaClass().getName().equals("char[]") && // NOI18N
205
                    _offset instanceof Integer && _count instanceof Integer) {
206
                int offset = (Integer) _offset;
207
                int count = (Integer) _count;
208
                List fields = ((PrimitiveArrayInstance) _value).getValues();
209
                StringBuilder logicalValue = new StringBuilder();
210
                boolean truncated = false;
211
                if (count > PrimitiveArrayNode.MAX_CHAR_ARRAY_STRING_SIZE) {
212
                    truncated = true;
213
                    count = PrimitiveArrayNode.MAX_CHAR_ARRAY_STRING_SIZE;
214
                }
215
                for (int i = offset; i < offset + count; i++) {
216
                    logicalValue.append((String) fields.get(i));
217
                }
218
                if (truncated) {
219
                    logicalValue.append(PrimitiveArrayNode.TRUNCATED_STRING);
220
                }
221
                return "#" + instance.getInstanceNumber() + " (\"" + logicalValue + "\")"; // NOI18N
222
            }
223
        }
224
199
        return "#" + instance.getInstanceNumber(); // NOI18N
225
        return "#" + instance.getInstanceNumber(); // NOI18N
200
    }
226
    }
201
227
(-)a/profiler/src/org/netbeans/modules/profiler/heapwalk/model/PrimitiveArrayNode.java (-2 / +2 lines)
Lines 120-132 Link Here
120
120
121
    // -----
121
    // -----
122
    // I18N String constants
122
    // I18N String constants
123
    private static final String TRUNCATED_STRING = NbBundle.getMessage(PrimitiveArrayNode.class,
123
    static final String TRUNCATED_STRING = NbBundle.getMessage(PrimitiveArrayNode.class,
124
                                                                       "PrimitiveArrayNode_TruncatedString"); // NOI18N
124
                                                                       "PrimitiveArrayNode_TruncatedString"); // NOI18N
125
    private static final String ITEMS_NUMBER_STRING = NbBundle.getMessage(PrimitiveArrayNode.class,
125
    private static final String ITEMS_NUMBER_STRING = NbBundle.getMessage(PrimitiveArrayNode.class,
126
                                                                          "PrimitiveArrayNode_ItemsNumberString"); // NOI18N
126
                                                                          "PrimitiveArrayNode_ItemsNumberString"); // NOI18N
127
    private static final String LOOP_TO_STRING = NbBundle.getMessage(PrimitiveArrayNode.class, "PrimitiveArrayNode_LoopToString"); // NOI18N
127
    private static final String LOOP_TO_STRING = NbBundle.getMessage(PrimitiveArrayNode.class, "PrimitiveArrayNode_LoopToString"); // NOI18N
128
                                                                                                                                   // -----
128
                                                                                                                                   // -----
129
    private static final int MAX_CHAR_ARRAY_STRING_SIZE = 128;
129
    static final int MAX_CHAR_ARRAY_STRING_SIZE = 128;
130
130
131
    //~ Constructors -------------------------------------------------------------------------------------------------------------
131
    //~ Constructors -------------------------------------------------------------------------------------------------------------
132
132

Return to bug 186659