@Test public void testParseBlankPage() throws Exception { Gson gson = new Gson(); SoftwareHeritageOriginEntry[] results = SoftwareHeritageOriginsImporter.parsePage("", gson); assertNotNull(results); assertEquals(0, results.length); }
protected static SoftwareHeritageOriginEntry[] parsePage(String originsPage, Gson gson) { if (StringUtils.isNotBlank(originsPage)) { try { return gson.fromJson(originsPage, SoftwareHeritageOriginEntry[].class); } catch (JsonSyntaxException e) { throw new RuntimeException("invalid page contents: \n" + originsPage, e); } } else { return new SoftwareHeritageOriginEntry[0]; } }
SoftwareHeritageOriginsImporter implements eu.dnetlib.iis.common.java.Process { protected static SoftwareHeritageOriginEntry[] parsePage(String originsPage, Gson gson) { if (StringUtils.isNotBlank(originsPage)) { try { return gson.fromJson(originsPage, SoftwareHeritageOriginEntry[].class); } catch (JsonSyntaxException e) { throw new RuntimeException("invalid page contents: \n" + originsPage, e); } } else { return new SoftwareHeritageOriginEntry[0]; } } }
SoftwareHeritageOriginsImporter implements eu.dnetlib.iis.common.java.Process { protected static SoftwareHeritageOriginEntry[] parsePage(String originsPage, Gson gson) { if (StringUtils.isNotBlank(originsPage)) { try { return gson.fromJson(originsPage, SoftwareHeritageOriginEntry[].class); } catch (JsonSyntaxException e) { throw new RuntimeException("invalid page contents: \n" + originsPage, e); } } else { return new SoftwareHeritageOriginEntry[0]; } } SoftwareHeritageOriginsImporter(); }
SoftwareHeritageOriginsImporter implements eu.dnetlib.iis.common.java.Process { protected static SoftwareHeritageOriginEntry[] parsePage(String originsPage, Gson gson) { if (StringUtils.isNotBlank(originsPage)) { try { return gson.fromJson(originsPage, SoftwareHeritageOriginEntry[].class); } catch (JsonSyntaxException e) { throw new RuntimeException("invalid page contents: \n" + originsPage, e); } } else { return new SoftwareHeritageOriginEntry[0]; } } SoftwareHeritageOriginsImporter(); @Override Map<String, PortType> getInputPorts(); @Override Map<String, PortType> getOutputPorts(); @Override void run(PortBindings portBindings, Configuration conf, Map<String, String> parameters); }
SoftwareHeritageOriginsImporter implements eu.dnetlib.iis.common.java.Process { protected static SoftwareHeritageOriginEntry[] parsePage(String originsPage, Gson gson) { if (StringUtils.isNotBlank(originsPage)) { try { return gson.fromJson(originsPage, SoftwareHeritageOriginEntry[].class); } catch (JsonSyntaxException e) { throw new RuntimeException("invalid page contents: \n" + originsPage, e); } } else { return new SoftwareHeritageOriginEntry[0]; } } SoftwareHeritageOriginsImporter(); @Override Map<String, PortType> getInputPorts(); @Override Map<String, PortType> getOutputPorts(); @Override void run(PortBindings portBindings, Configuration conf, Map<String, String> parameters); static final String DEFAULT_METAFILE_NAME; }