■ ■ ■ ■ ■ ■
src/main/java/com/nccgroup/loggerplusplus/LoggerContextMenuFactory.java
| skipped 43 lines |
44 | 44 | | case IContextMenuInvocation.CONTEXT_MESSAGE_VIEWER_REQUEST: { |
45 | 45 | | try { |
46 | 46 | | byte[] msg = invocation.getSelectedMessages()[0].getRequest(); |
47 | | - | if(LoggerPlusPlus.callbacks.getHelpers().analyzeRequest(msg).getBodyOffset() >= invocation.getSelectionBounds()[0]){ |
| 47 | + | if (LoggerPlusPlus.callbacks.getHelpers().analyzeRequest(msg).getBodyOffset() > invocation.getSelectionBounds()[0]) { |
48 | 48 | | context = LogEntryField.REQUEST_HEADERS; |
49 | | - | }else{ |
| 49 | + | } else { |
50 | 50 | | context = LogEntryField.REQUEST_BODY; |
51 | 51 | | } |
52 | 52 | | selectedBytes = Arrays.copyOfRange(invocation.getSelectedMessages()[0].getRequest(), |
| skipped 4 lines |
57 | 57 | | |
58 | 58 | | case IContextMenuInvocation.CONTEXT_MESSAGE_EDITOR_RESPONSE: |
59 | 59 | | case IContextMenuInvocation.CONTEXT_MESSAGE_VIEWER_RESPONSE: { |
60 | | - | try{ |
| 60 | + | try { |
61 | 61 | | byte[] msg = invocation.getSelectedMessages()[0].getResponse(); |
62 | | - | if(LoggerPlusPlus.callbacks.getHelpers().analyzeRequest(msg).getBodyOffset() >= invocation.getSelectionBounds()[0]){ |
| 62 | + | if (LoggerPlusPlus.callbacks.getHelpers().analyzeRequest(msg).getBodyOffset() > invocation.getSelectionBounds()[0]) { |
63 | 63 | | context = LogEntryField.RESPONSE_HEADERS; |
64 | | - | }else{ |
| 64 | + | } else { |
65 | 65 | | context = LogEntryField.RESPONSE_BODY; |
66 | 66 | | } |
67 | 67 | | selectedBytes = Arrays.copyOfRange(invocation.getSelectedMessages()[0].getResponse(), |
68 | | - | invocation.getSelectionBounds()[0],invocation.getSelectionBounds()[1]); |
69 | | - | }catch (NullPointerException nPException){ return null; } |
| 68 | + | invocation.getSelectionBounds()[0], invocation.getSelectionBounds()[1]); |
| 69 | + | } catch (NullPointerException nPException) { |
| 70 | + | return null; |
| 71 | + | } |
70 | 72 | | break; |
71 | 73 | | } |
72 | | - | default: return null; |
| 74 | + | default: |
| 75 | + | return null; |
73 | 76 | | } |
| 77 | + | |
| 78 | + | if (selectedBytes != null) System.out.println(new String(selectedBytes)); |
74 | 79 | | |
75 | 80 | | final LogTable logTable = loggerPlusPlus.getLogViewController().getLogTableController().getLogTable(); |
76 | 81 | | String selectedText = StringEscapeUtils.escapeJava(new String(selectedBytes)); |
| skipped 62 lines |