the program is suppost to compare the lines of one textbox individually to all the individual lines in another to try and find a match and if it finds a match it reports it in another textbox under Valid Nodes but if there is more than 1 it goes to a textbox under Duplicated Nodes with the amount of nodes and their line number and if it doesnt find a match then that to get reported in a seperate textbox under Unassigned Nodes and it does this for all of the lines of the first textbox.
its designed for filtering permission nodes so that i dont have to spend hours going through and double checking plugin permission nodes every time i want to validate access permissions, in time plugins require me to add and alter permission nodes sdo after a while it can become a bit of a mess so i have to re-validate everything to make sure its still ok.
The result im looking for is that any text that appears more than once in the script textbox should be shown in the duplicated nodes textbox with "x<times duplicated>, <script location for each>,", the f should be in the unnasigned nodes textbox and the rest should be in the valid nodea textbox
private void btnStartMousePressed(java.awt.event.MouseEvent evt) { // TODO add your handling code here: int[] TextCoOrds = {0,0,0,0}; //var save line location values . String[] Temp = {"",""};//array for comparing selected text. String OutputY = "";//used to output the location on the script of the duplicated line. int DupCheck = 0;//stores duplication amount. String PrevY;//stores previous duplicate line number. prgProgress.setMaximum(txtInput.getLineCount());//sets the progress bar maximum to max lines in script. for(int x = 0;x < txtInput.getLineCount();x++){//start looping through input textbox.lines TextCoOrds[0] = 0;//set text selection astart location to 0. TextCoOrds[1] = txtInput.getText().length();//set text selection end location to the end of that line. txtInput.select(TextCoOrds[0], TextCoOrds[1]);//use the above values to select the text. Temp[0] = txtInput.getSelectedText();//store the selected text to the first portion of the temp array. for(int y = 0;y < txtScript1.getLineCount();y++){//start looping through script textbox lines TextCoOrds[2] = 0;//set text selection a start location to 0. TextCoOrds[3] = txtScript1.getText().length();//set text selection end location to the end of that line. txtScript1.select(TextCoOrds[2], TextCoOrds[3]);//select text in line in script textbox using above values. Temp[1] = txtScript1.getSelectedText();//save selected text to other part of array if(Temp[0].equals(Temp[1])){//compare the two array values, if they match proceed. DupCheck++;//increase dupcheck by 1; if(DupCheck > 1){//if dupcheck is higher than 1(multiple duplications) PrevY = String.valueOf(y);//store y as previous location txtDuplicated.setText(Temp[0] + " " + "x" + DupCheck + ", " + OutputY + y);//output in duplicate box the duplicated line with how many duoplicates and line locations. OutputY = PrevY + y;//add location of y for next run. } else if(DupCheck < 1){//if dupcheck is lower than 1 proceed. txtUnnasigned.setText(Temp[0]);//add node to the unnassigned textbox. } else if(DupCheck == 1){//if it is equal to 1. txtValid.setText(Temp[0]);//add it to the valid textbox. } } } DupCheck = 0;//reset dupcheck prgProgress.setValue((txtInput.getLineCount()/100)*x);//validate progressbar to script progress } }
its a null pointer exception but i dont know where in the line it is
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.mycompany.permissions_analyzer.Main.btnStartMousePressed(Main.java:231) at com.mycompany.permissions_analyzer.Main$2.mousePressed(Main.java:85) at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:288) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6633) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342) at java.desktop/java.awt.Component.processEvent(Component.java:6401) at java.desktop/java.awt.Container.processEvent(Container.java:2263) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5012) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4544) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2762) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)