List of usage examples for java.util LinkedHashMap containsKey
boolean containsKey(Object key);
From source file:net.sf.maltcms.chromaui.project.spi.DBProjectFactory.java
private static void initSampleGroups(LinkedHashSet<String> sampleGroups, Map<File, String> fileToSampleGroup, LinkedHashMap<String, Set<File>> groupToFile) { sampleGroups.addAll(fileToSampleGroup.values()); for (String sampleGroup : sampleGroups) { for (File key : fileToSampleGroup.keySet()) { if (fileToSampleGroup.get(key).equals(sampleGroup)) { if (groupToFile.containsKey(sampleGroup)) { Set<File> s = groupToFile.get(sampleGroup); s.add(key);/*from w ww .j av a 2 s . co m*/ } else { Set<File> s = new LinkedHashSet<>(); s.add(key); groupToFile.put(sampleGroup, s); } } } } }
From source file:com.geewhiz.pacify.utils.ArchiveUtils.java
private static LinkedHashMap<PArchive, List<PArchive>> getParentArchives(List<PFile> replacePFiles) { LinkedHashMap<PArchive, List<PArchive>> parentArchives = new LinkedHashMap<PArchive, List<PArchive>>(); // for performance get first all archives in an archive for (PFile pFile : replacePFiles) { if (!pFile.isArchiveFile()) { continue; }// ww w. j ava2s. com PArchive pArchive = pFile.getPArchive(); if (!pArchive.isArchiveFile()) { continue; } if (!parentArchives.containsKey(pArchive.getParentArchive())) { parentArchives.put(pArchive.getParentArchive(), new ArrayList<PArchive>()); } List<PArchive> pArchivesToReplace = parentArchives.get(pArchive.getParentArchive()); if (!pArchivesToReplace.contains(pArchive)) { pArchivesToReplace.add(pArchive); } } return parentArchives; }
From source file:com.stratio.crossdata.sh.utils.ConsoleUtils.java
/** * In order to print the result, this method calculates the maximum width of every column. * * @param resultSet structure representing the result of a execution. * @return Map<String, Integer> where the key is the name of the column and Integer is the maximum * width./*from w w w. java 2 s. c o m*/ */ private static Map<String, Integer> calculateColWidths(ResultSet resultSet) { LinkedHashMap<String, Integer> colWidths = new LinkedHashMap<>(); // Get column names or aliases width for (ColumnMetadata columnMetadata : resultSet.getColumnMetadata()) { colWidths.put(columnMetadata.getName().getColumnNameToShow(), columnMetadata.getName().getColumnNameToShow().length()); } // Find widest cell content of every column for (Row row : resultSet) { int pos = 0; for (String key : row.getCells().keySet()) { String cellContent = String.valueOf(row.getCell(key).getValue()); int currentWidth; if (colWidths.containsKey(key)) { currentWidth = colWidths.get(key); } else { Iterator<Map.Entry<String, Integer>> iter = colWidths.entrySet().iterator(); int limit = 0; while (limit < pos) { iter.next(); limit++; } currentWidth = iter.next().getKey().length(); } if (cellContent.length() > currentWidth) { colWidths.put(key, cellContent.length()); } pos++; } } return colWidths; }
From source file:adalid.core.XS1.java
private static Collection<Field> getRidOfDupFields(Collection<Field> fields) { LinkedHashMap<String, Field> map = new LinkedHashMap<>(); String key;//from w ww . j a v a2s . c o m for (Field field : fields) { key = field.getName(); if (map.containsKey(key)) { TLC.getProject().getParser().error("Field " + key + " hides another field"); logger.error(TAB + "hiding field: " + field); logger.error(TAB + "hidden field: " + map.get(key)); } map.put(key, field); } return map.values(); }
From source file:eu.itesla_project.modules.histo.IIDM2DB.java
public static CimValuesMap extractCimValues(Network n, Config config) { CimValuesMap valuesMap = new CimValuesMap(); for (Substation ss : n.getSubstations()) { if (config.getCountryFilter() != null && !config.getCountryFilter().contains(ss.getCountry())) { continue; }//w w w . ja v a 2 s .c o m for (VoltageLevel vl : ss.getVoltageLevels()) { if (vl.getNominalV() < config.getMinBaseVoltageFilter()) { continue; } String horizon = n.getForecastDistance() > 0 ? "DACF" : "SN"; // for backward compatibility final LinkedHashMap<HistoDbAttributeId, Object> valueMap = valuesMap .getValueMap(new HorizonKey(n.getForecastDistance(), horizon)); if (config.getCimName() != null && !valueMap.containsKey(HistoDbMetaAttributeId.cimName)) valueMap.put(HistoDbMetaAttributeId.cimName, config.getCimName()); if (config.isExtractTemporalFields()) { if (!valueMap.containsKey(HistoDbMetaAttributeId.datetime)) valueMap.put(HistoDbMetaAttributeId.datetime, n.getCaseDate().toDate()); if (!valueMap.containsKey(HistoDbMetaAttributeId.daytime)) valueMap.put(HistoDbMetaAttributeId.daytime, n.getCaseDate().getMillisOfDay()); if (!valueMap.containsKey(HistoDbMetaAttributeId.month)) valueMap.put(HistoDbMetaAttributeId.month, n.getCaseDate().getMonthOfYear()); if (!valueMap.containsKey(HistoDbMetaAttributeId.forecastTime)) valueMap.put(HistoDbMetaAttributeId.forecastTime, n.getForecastDistance()); if (!valueMap.containsKey(HistoDbMetaAttributeId.horizon)) valueMap.put(HistoDbMetaAttributeId.horizon, horizon); } vl.visitEquipments(new AbstractTopologyVisitor() { private void visitInjection(SingleTerminalConnectable inj) { visitInjection(inj, new TerminalContext()); } private void visitInjection(SingleTerminalConnectable inj, TerminalContext context) { Terminal t = inj.getTerminal(); context.update(t); if (config.isReplaceMissingValues()) { if (Float.isNaN(context.p)) { context.p = 0f; } if (Float.isNaN(context.q)) { context.q = 0f; } if (Float.isNaN(context.v)) { // use connectable bus voltage, better than nothing... context.v = t.getBusBreakerView().getConnectableBus().getV(); } if (Float.isNaN(context.v)) { context.v = 0f; // TODO is there a better value? } if (Float.isNaN(context.i)) { context.i = 0f; } } valueMap.put(new HistoDbNetworkAttributeId(inj.getId(), HistoDbAttr.P), context.p); valueMap.put(new HistoDbNetworkAttributeId(inj.getId(), HistoDbAttr.Q), context.q); valueMap.put(new HistoDbNetworkAttributeId(inj.getId(), HistoDbAttr.V), context.v); valueMap.put(new HistoDbNetworkAttributeId(inj.getId(), HistoDbAttr.I), context.i); } private void visitBranch(TwoTerminalsConnectable branch, TwoTerminalsConnectable.Side side, float r, float x, float g1, float b1, float g2, float b2, float ratio) { Terminal t = side == TwoTerminalsConnectable.Side.ONE ? branch.getTerminal1() : branch.getTerminal2(); TerminalContext context = TerminalContext.create(t); if (config.isReplaceMissingValues()) { if (Float.isNaN(context.p)) { context.p = 0f; } if (Float.isNaN(context.q)) { context.q = 0f; } if (Float.isNaN(context.v)) { Terminal otherT = t == branch.getTerminal1() ? branch.getTerminal2() : branch.getTerminal1(); Bus otherBus = otherT.getBusView().getBus(); if (otherBus != null && !Float.isNaN(otherBus.getV())) { // compute the voltage from the other side physical values // TODO approx we do not consider voltage drop due to branch impedance if (t == branch.getTerminal1()) { // we are on side 1 disconnected and side 2 is connected context.v = otherBus.getV() / ratio; } else if (t == branch.getTerminal2()) { // we are on side 2 disconnected and side 1 is connected context.v = otherBus.getV() * ratio; } else { throw new AssertionError(); } } else { // use connectable bus voltage, better than nothing... context.v = t.getBusBreakerView().getConnectableBus().getV(); } } if (Float.isNaN(context.v)) { context.v = 0; // TODO is there a better value? } if (Float.isNaN(context.i)) { context.i = 0; } } valueMap.put(new HistoDbNetworkAttributeId(branch.getId(), t.getVoltageLevel().getId(), HistoDbAttr.P), context.p); valueMap.put(new HistoDbNetworkAttributeId(branch.getId(), t.getVoltageLevel().getId(), HistoDbAttr.Q), context.q); valueMap.put(new HistoDbNetworkAttributeId(branch.getId(), t.getVoltageLevel().getId(), HistoDbAttr.V), context.v); valueMap.put(new HistoDbNetworkAttributeId(branch.getId(), t.getVoltageLevel().getId(), HistoDbAttr.I), context.i); } @Override public void visitGenerator(Generator g) { TerminalContext context = new TerminalContext(); visitInjection(g, context); // reactive limit float qmax = g.getReactiveLimits().getMaxQ(context.p); valueMap.put(new HistoDbNetworkAttributeId(g.getId(), HistoDbAttr.QR), Math.abs(qmax - context.q)); } @Override public void visitLoad(Load l) { if (l.getLoadType() != LoadType.FICTITIOUS) { visitInjection(l); } } @Override public void visitShuntCompensator(ShuntCompensator sc) { visitInjection(sc); } @Override public void visitDanglingLine(DanglingLine dl) { visitInjection(dl); valueMap.put(new HistoDbNetworkAttributeId(dl.getId(), HistoDbAttr.P0), dl.getP0()); valueMap.put(new HistoDbNetworkAttributeId(dl.getId(), HistoDbAttr.Q0), dl.getQ0()); } @Override public void visitLine(Line l, Line.Side side) { visitBranch(l, side, l.getR(), l.getX(), l.getG1(), l.getB1(), l.getG2(), l.getB2(), 1); } @Override public void visitTwoWindingsTransformer(TwoWindingsTransformer twt, TwoWindingsTransformer.Side side) { visitBranch(twt, side, twt.getR(), twt.getX(), twt.getG(), twt.getB(), 0, 0, SV.getRatio(twt)); } @Override public void visitThreeWindingsTransformer(ThreeWindingsTransformer twt, ThreeWindingsTransformer.Side side) { Terminal t; switch (side) { case ONE: t = twt.getLeg1().getTerminal(); break; case TWO: t = twt.getLeg2().getTerminal(); break; case THREE: t = twt.getLeg3().getTerminal(); break; default: throw new AssertionError(); } TerminalContext context = TerminalContext.create(t); if (config.isReplaceMissingValues()) { if (Float.isNaN(context.p)) { context.p = 0f; } if (Float.isNaN(context.q)) { context.q = 0f; } if (Float.isNaN(context.v)) { context.v = 0; // TODO is possible to find a better replacement value? } if (Float.isNaN(context.i)) { context.i = 0f; } } valueMap.put(new HistoDbNetworkAttributeId(twt.getId(), t.getVoltageLevel().getId(), HistoDbAttr.V), context.v); valueMap.put(new HistoDbNetworkAttributeId(twt.getId(), t.getVoltageLevel().getId(), HistoDbAttr.I), context.i); valueMap.put(new HistoDbNetworkAttributeId(twt.getId(), t.getVoltageLevel().getId(), HistoDbAttr.P), context.p); valueMap.put(new HistoDbNetworkAttributeId(twt.getId(), t.getVoltageLevel().getId(), HistoDbAttr.Q), context.q); } }); // taps for (TwoWindingsTransformer twt : ss.getTwoWindingsTransformers()) { if (twt.getPhaseTapChanger() != null) { valueMap.put(new HistoDbNetworkAttributeId(twt.getId(), HistoDbAttr.PTC), twt.getPhaseTapChanger().getTapPosition()); } if (twt.getRatioTapChanger() != null) { valueMap.put(new HistoDbNetworkAttributeId(twt.getId(), HistoDbAttr.RTC), twt.getRatioTapChanger().getTapPosition()); } } for (ThreeWindingsTransformer twt : ss.getThreeWindingsTransformers()) { valueMap.put( new HistoDbNetworkAttributeId(twt.getId(), twt.getLeg2().getTerminal().getVoltageLevel().getId(), HistoDbAttr.RTC), twt.getLeg2().getRatioTapChanger().getTapPosition()); valueMap.put( new HistoDbNetworkAttributeId(twt.getId(), twt.getLeg3().getTerminal().getVoltageLevel().getId(), HistoDbAttr.RTC), twt.getLeg3().getRatioTapChanger().getTapPosition()); } /** * Extract topologies and mean tension */ try { JSONArray toposArray = toTopoSet(vl); String jsonRep = toposArray.toString(); valueMap.put(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.TOPO), jsonRep); String base64hash = computeTopoHash(jsonRep); valuesMap.addTopology(vl.getId(), base64hash, toposArray); valueMap.put(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.TOPOHASH), base64hash); } catch (JSONException e) { throw new RuntimeException("Failed to gather topologies", e); } float pgen = 0; float qgen = 0; float pload = 0; float qload = 0; float qshunt = 0; for (Generator g : vl.getGenerators()) { Terminal t = g.getTerminal(); if (t.getBusView().getBus() != null) { if (!Float.isNaN(t.getP())) { pgen += t.getP(); } if (!Float.isNaN(t.getQ())) { qgen += t.getQ(); } } } for (Load l : vl.getLoads()) { Terminal t = l.getTerminal(); if (t.getBusView().getBus() != null) { if (!Float.isNaN(t.getP())) { pload += t.getP(); } if (!Float.isNaN(t.getQ())) { qload += t.getQ(); } } } for (ShuntCompensator s : vl.getShunts()) { Terminal t = s.getTerminal(); if (t.getBusView().getBus() != null) { if (!Float.isNaN(t.getQ())) { qshunt += t.getQ(); } } } float vSum = 0; int validBusCount = 0; int busCount = 0; float vMin = Float.NaN; float vMax = Float.NaN; for (Bus b : vl.getBusView().getBuses()) { if (!Float.isNaN(b.getV())) { vSum += b.getV(); validBusCount++; vMin = Float.isNaN(vMin) ? b.getV() : Math.min(vMin, b.getV()); vMax = Float.isNaN(vMax) ? b.getV() : Math.max(vMax, b.getV()); } busCount++; } float meanV = Float.NaN; if (validBusCount > 0) { meanV = vSum / validBusCount; } if (config.isReplaceMissingValues()) { if (Float.isNaN(meanV)) { meanV = 0; // TODO is there a better value? } if (Float.isNaN(vMin)) { vMin = 0; // TODO is there a better value? } if (Float.isNaN(vMax)) { vMax = 0; // TODO is there a better value? } } valueMap.put(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.PGEN), pgen); valueMap.put(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.QGEN), qgen); valueMap.put(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.PLOAD), pload); valueMap.put(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.QLOAD), qload); valueMap.put(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.QSHUNT), qshunt); valueMap.put(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.V), meanV); valueMap.put(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.VMIN), vMin); valueMap.put(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.VMAX), vMax); valueMap.put(new HistoDbNetworkAttributeId(vl.getId(), HistoDbAttr.BC), busCount); } } return valuesMap; }
From source file:org.eclipse.recommenders.utils.rcp.JdtUtils.java
public static Collection<IMember> findAllRelevanFieldsAndMethods(final IType type, final Predicate<IField> fieldFilter, final Predicate<IMethod> methodFilter) { final LinkedHashMap<String, IMember> tmp = new LinkedHashMap<String, IMember>(); for (final IType cur : findAllSupertypesIncludeingArgument(type)) { try {/*from ww w . j av a2s .c o m*/ for (final IMethod method : cur.getMethods()) { if (methodFilter.apply(method)) { continue; } final String key = createMethodKey(method); if (!tmp.containsKey(key)) { tmp.put(key, method); } } for (final IField field : cur.getFields()) { if (fieldFilter.apply(field)) { continue; } final String key = createFieldKey(field); if (!tmp.containsKey(key)) { tmp.put(key, field); } } } catch (final Exception e) { log(e); } } return tmp.values(); }
From source file:com.google.api.codegen.config.GapicProductConfig.java
private static void createSingleResourceNameConfig(DiagCollector diagCollector, Resource resource, ProtoFile file, String pathTemplate, ProtoParser protoParser, LinkedHashMap<String, SingleResourceNameConfig> singleResourceNameConfigsMap) { SingleResourceNameConfig singleResourceNameConfig = SingleResourceNameConfig .createSingleResourceName(resource, pathTemplate, file, diagCollector); if (singleResourceNameConfigsMap.containsKey(singleResourceNameConfig.getEntityId())) { SingleResourceNameConfig otherConfig = singleResourceNameConfigsMap .get(singleResourceNameConfig.getEntityId()); if (!singleResourceNameConfig.getNamePattern().equals(otherConfig.getNamePattern())) { diagCollector.addDiag(Diag.error(SimpleLocation.TOPLEVEL, "Inconsistent collection configs across interfaces. Entity name: " + singleResourceNameConfig.getEntityId())); }/*from w w w . j a va2s. c o m*/ } else { String fullyQualifiedName = singleResourceNameConfig.getEntityId(); fullyQualifiedName = StringUtils.prependIfMissing(fullyQualifiedName, protoParser.getProtoPackage(file) + "."); singleResourceNameConfigsMap.put(fullyQualifiedName, singleResourceNameConfig); } }
From source file:org.bimserver.charting.SupportFunctions.java
public static ArrayList<LinkedHashMap<String, Object>> getIfcDataByClassWithTreeStructure( String structureKeyword, IfcModelInterface model, Chart chart, int superClassesToStepBackwardsThrough) { ArrayList<LinkedHashMap<String, Object>> rawData = new ArrayList<>(); // Prepare for static iteration. LinkedHashMap<Class<? extends IfcProduct>, Integer> ifcProductClassCounts = new LinkedHashMap<>(); // Iterate only the products. for (IfcProduct ifcProduct : model.getAllWithSubTypes(IfcProduct.class)) { Class<? extends IfcProduct> key = ifcProduct.getClass(); Integer value = 0;//from w ww . java 2s . c o m if (ifcProductClassCounts.containsKey(key)) value = ifcProductClassCounts.get(key); ifcProductClassCounts.put(key, value + 1); } // Derive the column names. ArrayList<String> hierarchyColumnNames = new ArrayList<>(); superClassesToStepBackwardsThrough = Math.max(0, superClassesToStepBackwardsThrough); String leafColumnName = String.format("%s%d", structureKeyword, superClassesToStepBackwardsThrough + 1); for (int i = 0; i < superClassesToStepBackwardsThrough + 1; i++) hierarchyColumnNames.add(String.format("%s%d", structureKeyword, i + 1)); // Update the chart configuration. chart.setDimensionLookupKeys(structureKeyword, hierarchyColumnNames); chart.setDimensionLookupKey("size", "size"); chart.setDimensionLookupKey("label", "label"); chart.setDimensionLookupKey("color", "size"); // Add each entry. for (Entry<Class<? extends IfcProduct>, Integer> countedEntry : ifcProductClassCounts.entrySet()) { // Prepare to store this raw data entry. LinkedHashMap<String, Object> dataEntry = new LinkedHashMap<>(); // Integer count = countedEntry.getValue(); Class<? extends IfcProduct> productClass = countedEntry.getKey(); // Sanitize. String className = getSanitizedSimpleClassName(productClass); // Name the group. String name = String.format("%s (%s)", className, count); dataEntry.put(leafColumnName, name); // Step back through the inheritance of the IfcProduct. if (superClassesToStepBackwardsThrough > 0) { Class<?> childClass = productClass; for (int i = superClassesToStepBackwardsThrough - 1; i >= 0; i--) { String thisColumnName = String.format("%s%d", structureKeyword, i + 1); Class<?> superClass = childClass.getSuperclass(); String enclosingClassName = getSanitizedSimpleClassName(superClass); dataEntry.put(thisColumnName, enclosingClassName); // Update pointer. childClass = superClass; } } dataEntry.put("size", count); dataEntry.put("label", name); // Push the entry into the data pool. rawData.add(dataEntry); } // Send it all back. return rawData; }
From source file:edu.usc.irds.sparkler.SparklerConfiguration.java
public LinkedHashMap<String, Object> getPluginConfiguration(String pluginId) throws SparklerException { if (this.containsKey(Constants.key.PLUGINS)) { LinkedHashMap plugins = (LinkedHashMap) this.get(Constants.key.PLUGINS); if (plugins.containsKey(pluginId)) { return (LinkedHashMap<String, Object>) plugins.get(pluginId); } else {// ww w. j a v a2 s. c o m throw new SparklerException("No configuration found for Plugin: " + pluginId); } } else { throw new SparklerException("No plugin configuration found!"); } }
From source file:org.daxplore.presenter.server.servlets.AdminUploadServlet.java
private static void unzipAll(PersistenceManager pm, String prefix, byte[] fileData) throws BadRequestException, InternalServerException { LinkedHashMap<String, byte[]> fileMap = new LinkedHashMap<>(); try (ZipInputStream zipIn = ServerTools.getAsZipInputStream(fileData)) { // Unzip all the files and put them in a map try {//from w w w . j av a 2 s.c o m ZipEntry entry; while ((entry = zipIn.getNextEntry()) != null) { if (!entry.isDirectory()) { byte[] data = IOUtils.toByteArray(zipIn); fileMap.put(entry.getName(), data); } } } catch (IOException e) { throw new BadRequestException("Error when reading uploaded file (invalid file?)", e); } // Read the file manifest to get metadata about the file if (!fileMap.containsKey("manifest.xml")) { throw new BadRequestException("No manifest.xml found in uploaded file"); } try (InputStream manifestStream = new ByteArrayInputStream(fileMap.get("manifest.xml"))) { UploadFileManifest manifest = new UploadFileManifest(manifestStream); // Check manifest content and make sure that the file is in proper order if (!ServerTools.isSupportedUploadFileVersion(manifest.getVersionMajor(), manifest.getVersionMinor())) { throw new BadRequestException("Unsupported file version"); } Locale unsupportedLocale = null; for (Locale locale : manifest.getSupportedLocales()) { if (!ServerTools.isSupportedLocale(locale)) { unsupportedLocale = locale; break; } } if (unsupportedLocale != null) { //TODO move exception into the for-loop above if Eclipse/Java stops warning about it throw new BadRequestException("Unsupported language: " + unsupportedLocale.toLanguageTag()); } Set<String> missingUploadFiles = SharedResourceTools.findMissingUploadFiles(fileMap.keySet(), manifest.getSupportedLocales()); if (!missingUploadFiles.isEmpty()) { throw new BadRequestException("Uploaded doesn't contain required files: " + SharedTools.join(missingUploadFiles, ", ")); } Set<String> unwantedUploadFiles = SharedResourceTools.findUnwantedUploadFiles(fileMap.keySet(), manifest.getSupportedLocales()); if (!unwantedUploadFiles.isEmpty()) { throw new BadRequestException( "Uploaded file contains extra files: " + SharedTools.join(unwantedUploadFiles, ", ")); } // Purge all existing data that uses this prefix, but save gaID String gaID = SettingItemStore.getProperty(pm, prefix, "adminpanel", "gaID"); String statStoreKey = prefix + "#adminpanel/gaID"; String deleteResult = DeleteData.deleteForPrefix(pm, prefix); pm.makePersistent(new SettingItemStore(statStoreKey, gaID)); logger.log(Level.INFO, deleteResult); // Since we just deleted the prefix and all it's data, we have to add it // again pm.makePersistent(new PrefixStore(prefix)); logger.log(Level.INFO, "Added prefix to system: '" + prefix + "'"); LocaleStore localeStore = new LocaleStore(prefix, manifest.getSupportedLocales(), manifest.getDefaultLocale()); pm.makePersistent(localeStore); logger.log(Level.INFO, "Added locale settings for prefix '" + prefix + "'"); for (String fileName : fileMap.keySet()) { String storeName = prefix + "#" + fileName; if (fileName.startsWith("properties/")) { unpackPropertyFile(pm, storeName, fileMap.get(fileName)); } else if (fileName.startsWith("data/")) { unpackStatisticalDataFile(pm, prefix, fileMap.get(fileName)); } else if (fileName.startsWith("meta/")) { unpackStaticFile(pm, storeName, fileMap.get(fileName)); } } } catch (BadRequestException e) { throw e; } } catch (IOException e) { throw new InternalServerException("Failed to close unzip file", e); } }