Skip to content

Commit

Permalink
fixed file name extraction from systemID
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Daniel Brookshire authored and Patrick Daniel Brookshire committed Apr 23, 2020
1 parent 0deae12 commit 471b16d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/
package org.adwmainz.da.extensions.askmore.operations;

import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.io.File;
import java.util.ResourceBundle;

import javax.swing.JOptionPane;
Expand Down Expand Up @@ -73,12 +72,7 @@ public void doOperation(AuthorAccess authorAccess, ArgumentsMap args)

// try to add file name to tab name
String systemID = documentController.getAuthorDocumentNode().getSystemID();
try {
String fileName = APIAccessUtils.getFileName(systemID);
resultsTabName += " - " + fileName;
} catch (MalformedURLException | URISyntaxException e) {
// leave the tab name as is
}
resultsTabName += " - " + new File(systemID).getName();

// prepare results view by removing previous results
ResultsManager resultsManager = PluginWorkspaceProvider.getPluginWorkspace().getResultsManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class APIAccessUtils {
* @param systemID the systemID of the AuthorDocumentNode
* @throws MalformedURLException
* @throws URISyntaxException
* @deprecated use new File(systemID).getName()
*/
public static String getFileName(String systemID) throws MalformedURLException, URISyntaxException {
File file = new File(new URL(systemID).toURI());
Expand Down

0 comments on commit 471b16d

Please sign in to comment.