auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); JWTI18n.init(); try { extensionHook.addOptionsParamSet(getJWTConfiguration()); extensionHook.getHookView().addOptionPanel(new JWTOptionsPanel()); LOGGER.info("JWT Extension loaded successfully"); } catch (Exception e) { LOGGER.error("JWT Extension can't be loaded. Configuration not found or invalid", e); } }

Target:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); JWTI18n.init(); try { extensionHook.addOptionsParamSet(getJWTConfiguration()); extensionHook.getHookView().addOptionPanel(new JWTOptionsPanel()); LOGGER.debug("JWT Extension loaded successfully"); } catch (Exception e) { LOGGER.error("JWT Extension can't be loaded. Configuration not found or invalid", e); } }
Source:
public boolean checkFileExistsInGlobalSpace(Session session, String pathname) throws NotConnectedException, PermissionException { try { return fileSystem(session).resolveFileInGlobalspace(pathname).exists(); } catch (FileSystemException e) { return false; } }

Target:
public boolean checkFileExistsInGlobalSpace(Session session, String pathname) throws NotConnectedException, PermissionException { try { return fileSystem(session).resolveFileInGlobalspace(pathname).exists(); } catch (FileSystemException e) { logger.debug(String.format("Can't parse the file name [%s] in the global space.", pathname), e); return false; } }
Source:
public void updateProfiles(ModelQueryLookup querySet, Vector<PredicateProfile> profiles) { profiles.removeElementAt(0); }

Target:
public void updateProfiles(ModelQueryLookup querySet, Vector<PredicateProfile> profiles) { profiles.remove(querySet); }
Source:
protected Method getServiceMethod(Message message) { Message inMessage = message.getExchange().getInMessage(); Method method = null; if (inMessage != null) { method = MessageUtils.getTargetMethod(inMessage, null); } if (method == null) { method = message.getExchange().get(Method.class); } return method; }

Target:
protected Method getServiceMethod(Message message) { Message inMessage = message.getExchange().getInMessage(); Method method = null; if (inMessage != null) { method = MessageUtils.getTargetMethod(inMessage).orElse(null); } if (method == null) { method = message.getExchange().get(Method.class); } return method; }
Source:
public void sysErrAvailable(final byte[] data) { if (this.sysErrStream == null) { try { this.sysErrFilePath = Files.createTempFile(null, "syserr"); this.sysErrFilePath.toFile().deleteOnExit(); this.sysErrStream = Files.newOutputStream(this.sysOutFilePath); } catch (IOException e) { handleException(e); return; } } try { this.sysErrStream.write(data); } catch (IOException e) { handleException(e); return; } }

Target:
public void sysErrAvailable(final byte[] data) { if (this.sysErrStore == null) { this.sysErrStore = new SysOutErrContentStore(false); } try { this.sysErrStore.store(data); } catch (IOException e) { handleException(e); return; } }
Source:
private void testNonOriginatorFailsAfterPrepare(int primaryOwnerIndex, int toKillIndex) throws Exception { Address originator = address(0); Address primaryOwner = address(primaryOwnerIndex); Address toKill = address(toKillIndex); MagicKey key = new MagicKey(cache(primaryOwnerIndex), cache(toKillIndex)); Cache<Object, Object> originatorCache = cache(0); DistributionManager dm0 = advancedCache(0).getDistributionManager(); EmbeddedTransaction dummyTransaction = beginAndSuspendTx(originatorCache, key); prepareTransaction(dummyTransaction); log.debugf("Killing %s, key owners are %s", toKill, dm0.getCacheTopology().getWriteOwners(key)); killMember(toKillIndex); log.debugf("Killed %s, key owners are %s", toKill, dm0.getCacheTopology().getWriteOwners(key)); Address newPrimaryOwner = dm0.getCacheTopology().getDistribution(key).primary(); for (Cache<Object, Object> c : caches()) { if (!address(c).equals(originator)) { TransactionTable nonOwnerTxTable = TestingUtil.extractComponent(c, TransactionTable.class); assertEquals(1, nonOwnerTxTable.getRemoteGlobalTransaction().size()); } boolean expectLocked = newPrimaryOwner.equals(primaryOwner) && address(c).equals(newPrimaryOwner); boolean locked = extractLockManager(c).isLocked(key); log.tracef("On %s, locked = %s", address(c), locked); assertEquals(expectLocked, locked); } log.trace("About to commit. Killed node is: " + toKill); commitTransaction(dummyTransaction); for (Cache<?, ?> c : caches()) { eventuallyEquals(false, () -> extractLockManager(c).isLocked(key)); assertEquals(1, c.keySet().size()); } }

Target:
private void testNonOriginatorFailsAfterPrepare(int primaryOwnerIndex, int toKillIndex) throws Exception { Address originator = address(0); Address primaryOwner = address(primaryOwnerIndex); Address toKill = address(toKillIndex); MagicKey key = new MagicKey(cache(primaryOwnerIndex), cache(toKillIndex)); Cache<Object, Object> originatorCache = cache(0); DistributionManager dm0 = advancedCache(0).getDistributionManager(); EmbeddedTransaction dummyTransaction = beginAndSuspendTx(originatorCache, key); prepareTransaction(dummyTransaction); log.debugf("Killing %s, key owners are %s", toKill, dm0.getCacheTopology().getWriteOwners(key)); killMember(toKillIndex); log.debugf("Killed %s, key owners are %s", toKill, dm0.getCacheTopology().getWriteOwners(key)); Address newPrimaryOwner = dm0.getCacheTopology().getDistribution(key).primary(); for (Cache<Object, Object> c : caches()) { if (!address(c).equals(originator)) { TransactionTable nonOwnerTxTable = TestingUtil.extractComponent(c, TransactionTable.class); assertEquals(1, nonOwnerTxTable.getRemoteGlobalTransaction().size()); } boolean expectLocked = newPrimaryOwner.equals(primaryOwner) && address(c).equals(newPrimaryOwner); boolean locked = extractLockManager(c).isLocked(key); log.tracef("On %s, locked = %s", address(c), locked); assertEquals(expectLocked, locked); } log.trace("About to commit. Killed node is: " + toKill); commitTransaction(dummyTransaction); for (Cache<?, ?> c : caches()) { assertEventuallyNotLocked(c, key); assertEquals(1, c.keySet().size()); } }
Source:
public void dispose() { if (fOverlayStore != null) { fOverlayStore.stop(); fOverlayStore= null; } for (Image image : colorPreviewImages) { image.dispose(); } super.dispose(); }

Target:
public void dispose() { if (fOverlayStore != null) { fOverlayStore.stop(); fOverlayStore= null; } for (Image image : colorPreviewImages) { image.dispose(); } colorPreviewImages= null; super.dispose(); }
Source:
CompletableFuture<?> addToQueue(InternalHiveSplit split) { if (throwable.get() == null) { if (estimatedSplitSizeInBytes.addAndGet(split.getEstimatedSizeInBytes()) > maxOutstandingSplitsBytes) { throw new PrestoException(GENERIC_INTERNAL_ERROR, format( "Split buffering for %s.%s takes too much memory (%s bytes limit). %s splits are buffered.", databaseName, tableName, maxOutstandingSplitsBytes, getOutstandingSplitCount())); } return queue.offer(split); } return completedFuture(null); }

Target:
CompletableFuture<?> addToQueue(InternalHiveSplit split) { if (throwable.get() == null) { if (estimatedSplitSizeInBytes.addAndGet(split.getEstimatedSizeInBytes()) > maxOutstandingSplitsBytes) { throw new PrestoException(GENERIC_INTERNAL_ERROR, format( "Split buffering for %s.%s exceeded memory limit (%s). %s splits are buffered.", databaseName, tableName, succinctBytes(maxOutstandingSplitsBytes), getOutstandingSplitCount())); } return queue.offer(split); } return completedFuture(null); }
Source:
public void deleteTagByRemoveButton(String tagName) { seleniumWebDriverHelper.moveCursorToAndClick( By.xpath( format( " tagName))); }

Target:
public void deleteTagByRemoveButton(String tagName) { String removeButtonXpath = format( FILTERS_INPUT_TAG_XPATH_TEMPLATE + "/parent::md-chip-template/div[@class='stack-library-filter-tag-btn']/i", tagName); seleniumWebDriverHelper.moveCursorToAndClick(By.xpath(removeButtonXpath)); }
Source:
public void onVisible(IObservableValue serviceObservable, DataBindingContext dbc) { Object value = serviceObservable.getValue(); if (!(value instanceof IService)) { return; } IService service = (IService) value; nameText.setText(service.getName()); namespaceText.setText(service.getNamespace()); String labels = org.jboss.tools.openshift.common.core.utils.StringUtils.toString(service.getLabels()); if(labels != null) { labelsText.setText(labels); } String selectors = org.jboss.tools.openshift.common.core.utils.StringUtils.toString(service.getSelector()); if(selectors != null) { selectorsText.setText(selectors); } ipText.setText( org.apache.commons.lang.StringUtils.join(new String[] { service.getPortalIP(), StringUtils.toStringOrNull(service.getTargetPort()) }, ':')); portText.setText(StringUtils.toStringOrNull(service.getPort())); }

Target:
public void onVisible(IObservableValue serviceObservable, DataBindingContext dbc) { Object value = serviceObservable.getValue(); if (!(value instanceof IService)) { return; } IService service = (IService) value; nameText.setText(service.getName()); namespaceText.setText(service.getNamespace()); String labels = org.jboss.tools.openshift.common.core.utils.StringUtils.toString(service.getLabels()); labels = org.apache.commons.lang.StringUtils.defaultString(labels); labelsText.setText(labels); String selectors = org.jboss.tools.openshift.common.core.utils.StringUtils.toString(service.getSelector()); selectors = org.apache.commons.lang.StringUtils.defaultString(selectors); selectorsText.setText(selectors); ipText.setText( org.apache.commons.lang.StringUtils.join(new String[] { service.getPortalIP(), StringUtils.toStringOrNull(service.getTargetPort()) }, ':')); portText.setText(StringUtils.toStringOrNull(service.getPort())); }
Source:
static String createJAASConfigFile(String fileName, String password) { String ret = null; try { File tmpDir = createTmpDir(); File jaasFile = new File(tmpDir, fileName); FileWriter fwriter = new FileWriter(jaasFile); fwriter.write("" + "Server {\n" + " " + digestLoginModule + " required\n" + " user_super=\"test\";\n" + "};\n" + "Client {\n" + " " + digestLoginModule + " required\n" + " username=\"super\"\n" + " password=\"" + password + "\";\n" + "};" + "\n"); fwriter.close(); ret = jaasFile.getAbsolutePath(); } catch (IOException e) { Assert.fail("Unable to create JaaS configuration file!"); } return ret; }

Target:
static String createJAASConfigFile(String fileName, String password) { String ret = null; try { File tmpDir = createTmpDir(); File jaasFile = new File(tmpDir, fileName); FileWriter fwriter = new FileWriter(jaasFile); fwriter.write("" + "Server {\n" + " " + digestLoginModule + " required\n" + " user_super=\"test\";\n" + "};\n" + "Client {\n" + " " + digestLoginModule + " required\n" + " username=\"super\"\n" + " password=\"" + password + "\";\n" + "};" + "\n"); fwriter.close(); ret = jaasFile.getAbsolutePath(); } catch (IOException e) { fail("Unable to create JaaS configuration file!"); } return ret; }
Source:
public boolean isSubtype(final AnnotationMirror subAnno, final AnnotationMirror superAnno) { if (AnnotationUtils.areSame(subAnno, BOTTOM)) { return true; } if (AnnotationUtils.areSame(superAnno, BOTTOM)) { return false; } if (AnnotationUtils.areSame(superAnno, TOP)) { return true; } if (AnnotationUtils.areSame(subAnno, TOP)) { return false; } List<String> subVal = ValueCheckerUtils.getValueOfAnnotationWithStringArgument(subAnno); List<String> superVal = ValueCheckerUtils.getValueOfAnnotationWithStringArgument(superAnno); return subVal.containsAll(superVal); }

Target:
public boolean isSubtype(final AnnotationMirror subAnno, final AnnotationMirror superAnno) { if (AnnotationUtils.areSame(subAnno, bottom)) { return true; } else if (AnnotationUtils.areSame(superAnno, bottom)) { return false; } List<String> subVal = getAccumulatedValues(subAnno); List<String> superVal = getAccumulatedValues(superAnno); return subVal.containsAll(superVal); }
Source:
public boolean contains(T value) { Node node = head.currentFlagAndNext.getReference(); while (node.currentFlagAndNext.getReference() != null && node.value.compareTo(value) < 0) { node = node.currentFlagAndNext.getReference(); } return node.value.compareTo(value) == 0 && !node.currentFlagAndNext.isMarked(); }

Target:
public boolean contains(T value) { Node node = head.currentFlagAndNext.getReference(); if (node == null) { return false; } while (node.currentFlagAndNext.getReference() != null && node.value.compareTo(value) < 0) { node = node.currentFlagAndNext.getReference(); } return node.value.compareTo(value) == 0 && !node.currentFlagAndNext.isMarked(); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((entityId == null) ? 0 : entityId.hashCode()); result = prime * result + ((jobId == null) ? 0 : jobId.hashCode()); return result; }

Target:
public int hashCode() { return Objects.hash(entityId, jobId); }
Source:
private ITypedElement getHeadTypedElement(final IFile baseFile) { final RepositoryMapping mapping = RepositoryMapping.getMapping(baseFile .getProject()); final Repository repository = mapping.getRepository(); String gitPath = mapping.getRepoRelativePath(baseFile); try { GitIndex index = repository.getIndex(); if (index.getEntry(gitPath) == null) { return new GitCompareFileRevisionEditorInput.EmptyTypedElement( NLS.bind(UIText.CompareWithIndexAction_FileNotInIndex, baseFile.getName())); } } catch (IOException e) { return new GitCompareFileRevisionEditorInput.EmptyTypedElement( NLS.bind(UIText.CompareWithIndexAction_FileNotInIndex, baseFile.getName())); } IFileRevision nextFile = GitFileRevision.inIndex(repository, gitPath); final EditableRevision next = new EditableRevision(nextFile); IContentChangeListener listener = new IContentChangeListener() { public void contentChanged(IContentChangeNotifier source) { final byte[] newContent = next.getModifiedContent(); try { final GitIndex index = repository.getIndex(); final File file = new File(baseFile.getLocation() .toString()); index.add(mapping.getWorkDir(), file, newContent); index.write(); } catch (IOException e) { handle(new TeamException( UIText.CompareWithIndexAction_errorOnAddToIndex, e), UIText.CompareWithIndexAction_errorOnAddToIndex, UIText.CompareWithIndexAction_errorOnAddToIndex); return; } } }; next.addContentChangeListener(listener); return next; }

Target:
private ITypedElement getHeadTypedElement(final IFile baseFile) throws InvocationTargetException { final RepositoryMapping mapping = RepositoryMapping.getMapping(baseFile .getProject()); final Repository repository = mapping.getRepository(); String gitPath = mapping.getRepoRelativePath(baseFile); try { GitIndex index = repository.getIndex(); if (index.getEntry(gitPath) == null) { return new GitCompareFileRevisionEditorInput.EmptyTypedElement( NLS.bind(UIText.CompareWithIndexAction_FileNotInIndex, baseFile.getName())); } } catch (IOException e) { throw new InvocationTargetException(e); } IFileRevision nextFile = GitFileRevision.inIndex(repository, gitPath); final EditableRevision next = new EditableRevision(nextFile); IContentChangeListener listener = new IContentChangeListener() { public void contentChanged(IContentChangeNotifier source) { final byte[] newContent = next.getModifiedContent(); try { final GitIndex index = repository.getIndex(); final File file = new File(baseFile.getLocation().toString()); index.add(mapping.getWorkDir(), file, newContent); index.write(); } catch (IOException e) { handle( new TeamException( UIText.CompareWithIndexAction_errorOnAddToIndex, e), UIText.CompareWithIndexAction_errorOnAddToIndex, UIText.CompareWithIndexAction_errorOnAddToIndex); return; } } }; next.addContentChangeListener(listener); return next; }
Source:
void poll(RequestRegistrationCallback<DeleteOperation> requestRegistrationCallback) { try { cleanupExpiredInflightRequests(); checkAndMaybeComplete(); if (!isOperationComplete()) { fetchRequests(requestRegistrationCallback); } } catch (Exception e) { logger.error("Unexpected error in DeleteBlobOperation poll; operation cancelled.", e); routerMetrics.unexpectedErrorCount.inc(); setOperationException(new RouterException("DeleteOperation poll encountered unexpected error", e, RouterErrorCode.UnexpectedInternalError)); } }

Target:
void poll(RequestRegistrationCallback<DeleteOperation> requestRegistrationCallback) { cleanupExpiredInflightRequests(); checkAndMaybeComplete(); if (!isOperationComplete()) { fetchRequests(requestRegistrationCallback); } }
Source:
public String getTableDataDir() { return _tableDataDir; }

Target:
public File getTableDataDir() { return _indexDir; }
Source:
public IConnectionWrapper getConnection() throws CoreException { HashMap<String,String> map = new HashMap<String,String>(); map.put(DefaultConnectionProvider.ID, name); map.put(DefaultConnectionProvider.URL, url); map.put(DefaultConnectionProvider.USERNAME, userName); map.put(DefaultConnectionProvider.PASSWORD, password); IConnectionProvider provider = ExtensionManager.getProvider(DefaultConnectionProvider.PROVIDER_ID); return provider.createConnection(map); }

Target:
public IConnectionWrapper getConnection() throws CoreException { Map<String,String> map = new HashMap<>(); map.put(DefaultConnectionProvider.ID, name); map.put(DefaultConnectionProvider.URL, url); map.put(DefaultConnectionProvider.USERNAME, userName); map.put(DefaultConnectionProvider.PASSWORD, password); IConnectionProvider provider = ExtensionManager.getProvider(DefaultConnectionProvider.PROVIDER_ID); return provider.createConnection(map); }
Source:
public FormValidation doCheckLabelString(@QueryParameter String value, @QueryParameter Node.Mode mode) { if (mode == Node.Mode.EXCLUSIVE && (value == null || value.trim() == "")) { return FormValidation.warning("Probably you should assign labels" + " when usage is 'Leave this machine for tied jobs only'" + " because this slave cannot be tied jobs without labels"); } return FormValidation.ok(); }

Target:
public FormValidation doCheckLabelString(@QueryParameter String value, @QueryParameter Node.Mode mode) { if (mode == Node.Mode.EXCLUSIVE && (value == null || value.trim() == "")) { return FormValidation.warning("You may want to assign labels to this node;" + " it's marked to only run jobs that are exclusively tied to itself or a label."); } return FormValidation.ok(); }
Source:
public AccountingXmlDocumentAccountingLine createAccountingXmlDocumentAccountingLine(GroupLevel costCenterGroupLevel, DefaultKfsAccountForAws defaultKfsAccountForAws) { LOG.info("createAccountingXmlDocumentAccountingLine for " + costCenterGroupLevel.getGroupName()); String costCenterGroupValue = costCenterGroupLevel.getGroupValue(); AccountingXmlDocumentAccountingLine xmlAccountingLine = getEmptyAccountingXmlDocumentAccountingLine(); if (StringUtils.countMatches(costCenterGroupValue, "*") == 6) { xmlAccountingLine = parseCostCenterGroupLevel(costCenterGroupLevel.getGroupValue()); } else if (StringUtils.countMatches(costCenterGroupValue, "-") == 1) { xmlAccountingLine.setAccountNumber(StringUtils.split(costCenterGroupValue, "-")[0]); xmlAccountingLine.setSubAccountNumber(StringUtils.split(costCenterGroupValue, "-")[1]); } else { xmlAccountingLine.setAccountNumber(costCenterGroupValue); } xmlAccountingLine = fixAccountFieldReferences(xmlAccountingLine, defaultKfsAccountForAws.getKfsDefaultAccount()); xmlAccountingLine.setAmount(costCenterGroupLevel.getCost()); return xmlAccountingLine; }

Target:
public AccountingXmlDocumentAccountingLine createAccountingXmlDocumentAccountingLine(GroupLevel costCenterGroupLevel, DefaultKfsAccountForAws defaultKfsAccountForAws) throws IllegalArgumentException { LOG.debug("createAccountingXmlDocumentAccountingLine for " + costCenterGroupLevel.getGroupName()); if (!costCenterGroupLevel.isCostCenterGroupLevel()) { throw new IllegalArgumentException(configurationService.getPropertyValueAsString(CuFPKeyConstants.ERROR_INVALID_GROUP_LEVEL_TYPE)); } String costCenterGroupValue = costCenterGroupLevel.getGroupValue(); AccountingXmlDocumentAccountingLine xmlAccountingLine = getEmptyAccountingXmlDocumentAccountingLine(); if (StringUtils.countMatches(costCenterGroupValue, "*") == 6) { xmlAccountingLine = parseCostCenterGroupLevel(costCenterGroupLevel.getGroupValue()); } else if (StringUtils.countMatches(costCenterGroupValue, "-") == 1) { xmlAccountingLine.setAccountNumber(StringUtils.split(costCenterGroupValue, "-")[0]); xmlAccountingLine.setSubAccountNumber(StringUtils.split(costCenterGroupValue, "-")[1]); } else { xmlAccountingLine.setAccountNumber(costCenterGroupValue); } xmlAccountingLine = fixAccountFieldReferences(xmlAccountingLine, defaultKfsAccountForAws.getKfsDefaultAccount()); xmlAccountingLine.setAmount(costCenterGroupLevel.getCost()); return xmlAccountingLine; }
Source:
public static ObjectFactory loadObjectFactory(ClassFinder classFinder, String objectFactoryClassName) { ObjectFactory objectFactory; try { final Reflections reflections = new Reflections(classFinder); final ServiceLoader<io.cucumber.core.backend.ObjectFactory> loader = ServiceLoader.load(io.cucumber.core.backend.ObjectFactory.class); if (objectFactoryClassName == null) { objectFactory = new ObjectFactoryAdapter(loadSingleObjectFactory(reflections, loader)); } else { objectFactory = new ObjectFactoryAdapter(loadSelectedObjectFactory(reflections, loader, classFinder, objectFactoryClassName)); } } catch (TooManyInstancesException e) { LOG.warn(e.getMessage()); LOG.warn(getMultipleObjectFactoryLogMessage()); objectFactory = new DefaultJavaObjectFactory(); } catch (NoInstancesException e) { objectFactory = new DefaultJavaObjectFactory(); } catch (ClassNotFoundException e) { throw new CucumberException("Couldn't instantiate custom ObjectFactory", e); } return objectFactory; }

Target:
public static ObjectFactory loadObjectFactory(ClassFinder classFinder, String objectFactoryClassName) { try { final Reflections reflections = new Reflections(classFinder); if (objectFactoryClassName == null) { return loadSingleObjectFactory(reflections); } else { return loadSelectedObjectFactory(reflections, classFinder, objectFactoryClassName); } } catch (TooManyInstancesException e) { LOG.warn(e.getMessage()); LOG.warn(getMultipleObjectFactoryLogMessage()); return new DefaultJavaObjectFactory(); } catch (NoInstancesException e) { return new DefaultJavaObjectFactory(); } catch (ClassNotFoundException e) { throw new CucumberException("Couldn't instantiate custom ObjectFactory", e); } }
Source:
public ReplicaSet updateImage(String image) { ReplicaSet oldRC = get(); if (oldRC == null) { throw new KubernetesClientException("Existing replication controller doesn't exist"); } if (oldRC.getSpec().getTemplate().getSpec().getContainers().size() > 1) { throw new KubernetesClientException("Image update is not supported for multicontainer pods"); } if (oldRC.getSpec().getTemplate().getSpec().getContainers().isEmpty()) { throw new KubernetesClientException("Pod has no containers!"); } Container container = oldRC.getSpec().getTemplate().getSpec().getContainers().get(0); return updateImage(Collections.singletonMap(container.getName(), image)); }

Target:
public ReplicaSet updateImage(String image) { ReplicaSet oldRC = get(); if (oldRC == null) { throw new KubernetesClientException("Existing replication controller doesn't exist"); } if (oldRC.getSpec().getTemplate().getSpec().getContainers().size() > 1) { throw new KubernetesClientException("Image update is not supported for multicontainer pods"); } if (oldRC.getSpec().getTemplate().getSpec().getContainers().isEmpty()) { throw new KubernetesClientException("Pod has no containers!"); } Container container = oldRC.getSpec().getTemplate().getSpec().getContainers().iterator().next(); return updateImage(Collections.singletonMap(container.getName(), image)); }
Source:
public String apply(String bytea, String format) { switch (Format.valueOf(format.toUpperCase(Locale.ROOT))) { case BASE64: final byte[] text; if (Hex.isHexFormat(bytea)) { text = Hex.decodeHex(Hex.stripHexFormatFlag(bytea)); } else { text = Octal.decode(bytea); } return Base64.getEncoder().encodeToString(text); case HEX: if (Hex.isHexFormat(bytea)) { return Hex.validateHex(Hex.stripHexFormatFlag(bytea)); } return Hex.encodeHexString(Octal.decode(bytea)); case ESCAPE: if (Hex.isHexFormat(bytea)) { return Octal.encode(Hex.decodeHex(Hex.stripHexFormatFlag(bytea))); } return Octal.encode(bytea.getBytes(StandardCharsets.UTF_8)); default: throw new RuntimeException(); } }

Target:
public String apply(String bytea, String format) { final Format fmt; try { fmt = Format.valueOf(format.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException e) { throw new IllegalArgumentException( String.format(Locale.ENGLISH, "Encoding format '%s' is not supported", format) ); } return fmt.encode(bytea); }
Source:
public RadiologyReport saveRadiologyReport(RadiologyReport radiologyReport) throws IllegalArgumentException { if (radiologyReport == null) { throw new IllegalArgumentException("radiologyReport cannot be null"); } if (radiologyReport.getRadiologyReportStatus() == null) { throw new IllegalArgumentException("radiologyReportStatus is required"); } if (isReportModifiable(radiologyReport)) { return radiologyReportDAO.saveRadiologyReport(radiologyReport); } else { throw new IllegalArgumentException("radiologyReport is not modifiable"); } }

Target:
public RadiologyReport saveRadiologyReport(RadiologyReport radiologyReport) throws IllegalArgumentException, UnsupportedOperationException { if (radiologyReport == null) { throw new IllegalArgumentException("radiologyReport cannot be null"); } if (radiologyReport.getReportStatus() == null) { throw new IllegalArgumentException("radiologyReportStatus cannot be null"); } if (radiologyReport.getReportStatus() == RadiologyReportStatus.DISCONTINUED) { throw new UnsupportedOperationException("a discontinued radiologyReport cannot be saved"); } if (radiologyReport.getReportStatus() == RadiologyReportStatus.COMPLETED) { throw new UnsupportedOperationException("a completed radiologyReport cannot be saved"); } return radiologyReportDAO.saveRadiologyReport(radiologyReport); }
Source:
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception { ItemStack item = user.getBase().getItemInHand(); if (item.getType().name().contains("AIR")) { user.sendMessage(tl("itemloreInvalidItem")); return; } if (args.length == 0) { throw new NotEnoughArgumentsException(); } ItemMeta im = item.getItemMeta(); if (args[0].equalsIgnoreCase("add") && args.length > 1) { String line = FormatUtil.formatString(user, "essentials.itemlore", getFinalArg(args, 1)).trim(); List<String> lore = im.hasLore() ? im.getLore() : new ArrayList<>(); lore.add(line); im.setLore(lore); item.setItemMeta(im); user.sendMessage(tl("itemloreSuccess", line)); } else if (args[0].equalsIgnoreCase("clear")) { im.setLore(new ArrayList<>()); item.setItemMeta(im); user.sendMessage(tl("itemloreClear")); } else if (args[0].equalsIgnoreCase("set") && args.length > 2 && NumberUtil.isInt(args[1])) { if (!im.hasLore()) { throw new Exception(tl("itemloreNoLore")); } int line = Integer.parseInt(args[1]); String newLine = FormatUtil.formatString(user, "essentials.itemlore", getFinalArg(args, 2)).trim(); List<String> lore = im.getLore(); try { lore.set(line - 1, newLine); } catch (Exception e) { throw new Exception(tl("itemloreNoLine", line), e); } im.setLore(lore); item.setItemMeta(im); user.sendMessage(tl("itemloreSuccessLore", line, newLine)); } else { throw new NotEnoughArgumentsException(); } }

Target:
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception { ItemStack item = user.getBase().getItemInHand(); if (item.getType().name().contains("AIR")) { throw new Exception(tl("itemloreInvalidItem")); } if (args.length == 0) { throw new NotEnoughArgumentsException(); } ItemMeta im = item.getItemMeta(); if (args[0].equalsIgnoreCase("add") && args.length > 1) { String line = FormatUtil.formatString(user, "essentials.itemlore", getFinalArg(args, 1)).trim(); List<String> lore = im.hasLore() ? im.getLore() : new ArrayList<>(); lore.add(line); im.setLore(lore); item.setItemMeta(im); user.sendMessage(tl("itemloreSuccess", line)); } else if (args[0].equalsIgnoreCase("clear")) { im.setLore(new ArrayList<>()); item.setItemMeta(im); user.sendMessage(tl("itemloreClear")); } else if (args[0].equalsIgnoreCase("set") && args.length > 2 && NumberUtil.isInt(args[1])) { if (!im.hasLore()) { throw new Exception(tl("itemloreNoLore")); } int line = Integer.parseInt(args[1]); String newLine = FormatUtil.formatString(user, "essentials.itemlore", getFinalArg(args, 2)).trim(); List<String> lore = im.getLore(); try { lore.set(line - 1, newLine); } catch (Exception e) { throw new Exception(tl("itemloreNoLine", line), e); } im.setLore(lore); item.setItemMeta(im); user.sendMessage(tl("itemloreSuccessLore", line, newLine)); } else { throw new NotEnoughArgumentsException(); } }
Source:
public boolean implement(final Network network, final NetworkOffering offering, final DeployDestination dest, final ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException { if (offering.isSystemOnly()) { return false; } final Map<VirtualMachineProfile.Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>(1); params.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true); final RouterDeploymentDefinition routerDeploymentDefinition = routerDeploymentDefinitionBuilder.create() .setGuestNetwork(network) .setDeployDestination(dest) .setAccountOwner(_accountMgr.getAccount(network.getAccountId())) .setParams(params) .build(); final List<DomainRouterVO> routers = routerDeploymentDefinition.deployVirtualRouter(); int routerCounts = 1; if (offering.getRedundantRouter() || network.isRollingRestart()) { routerCounts = 2; } if (routers == null || routers.size() < routerCounts) { List<DomainRouterVO> current_routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER); if (current_routers.size() < 2) { updateToFailedState(network); throw new ResourceUnavailableException("Can't find all necessary running routers!", DataCenter.class, network.getDataCenterId()); } } return true; }

Target:
public boolean implement(final Network network, final NetworkOffering offering, final DeployDestination dest, final ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException { if (offering.isSystemOnly()) { return false; } final Map<VirtualMachineProfile.Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>(1); params.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true); final RouterDeploymentDefinition routerDeploymentDefinition = routerDeploymentDefinitionBuilder.create() .setGuestNetwork(network) .setDeployDestination(dest) .setAccountOwner(_accountMgr.getAccount(network.getAccountId())) .setParams(params) .build(); final List<DomainRouterVO> routers = routerDeploymentDefinition.deployVirtualRouter(); int expectedRouters = 1; if (offering.getRedundantRouter() || network.isRollingRestart()) { expectedRouters = 2; } if (routers == null || routers.size() < expectedRouters) { List<DomainRouterVO> current_routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER); if (current_routers.size() < 2) { updateToFailedState(network); throw new ResourceUnavailableException("Can't find all necessary running routers!", DataCenter.class, network.getDataCenterId()); } } return true; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); if (view == null) { view = inflater.inflate(R.layout.fragment_random_item, container, false); ButterKnife.bind(this, view); imageView.setLegacyVisibilityHandlingEnabled(true); setContents(null); errorView.setBackClickListener(v -> getActivity().finish()); errorView.setVisibility(View.GONE); new RandomSummaryClient().request(WikipediaApp.getInstance().getWikiSite(), new RandomSummaryClient.Callback() { @Override public void onSuccess(@NonNull Call<RbPageSummary> call, @NonNull RbPageSummary pageSummary) { if (!isAdded()) { return; } setContents(pageSummary); } @Override public void onError(@NonNull Call<RbPageSummary> call, @NonNull Throwable t) { if (!isAdded()) { return; } setErrorState(t); } }); } return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); if (view == null) { view = inflater.inflate(R.layout.fragment_random_item, container, false); ButterKnife.bind(this, view); imageView.setLegacyVisibilityHandlingEnabled(true); setContents(null); errorView.setBackClickListener(v -> getActivity().finish()); errorView.setRetryClickListener(v -> { progressBar.setVisibility(View.VISIBLE); getRandomPage(); }); getRandomPage(); } return view; }
Source:
public void migration_must_set_analysis_uuid() throws SQLException { String ceTaskUuid = RandomStringUtils.randomAlphanumeric(40); String analysisUuid = RandomStringUtils.randomAlphanumeric(40); String webhookDeliveryUuid = RandomStringUtils.randomAlphanumeric(40); insertWebhookDelivery(webhookDeliveryUuid,null, ceTaskUuid); insertCeActivity(ceTaskUuid, analysisUuid); assertThat(db.countRowsOfTable(TABLE_WEBHOOK_DELIVERY)).isEqualTo(1); assertThat(db.countRowsOfTable(TABLE_CE_ACTIVITIY)).isEqualTo(1); underTest.execute(); List<Map<String, Object>> maps = selectAllWebhookDeliveries(); assertThat(maps).hasSize(1); assertThat(maps.get(0)).containsExactly( entry("ANALYSIS_UUID", analysisUuid), entry("UUID", webhookDeliveryUuid), entry("CE_TASK_UUID", ceTaskUuid)); }

Target:
public void migration_must_set_analysis_uuid() throws SQLException { String ceTaskUuid = randomAlphanumeric(40); String analysisUuid = randomAlphanumeric(40); String webhookDeliveryUuid = randomAlphanumeric(40); insertWebhookDelivery(webhookDeliveryUuid,null, ceTaskUuid); insertCeActivity(ceTaskUuid, analysisUuid); assertThat(db.countRowsOfTable(TABLE_WEBHOOK_DELIVERY)).isEqualTo(1); assertThat(db.countRowsOfTable(TABLE_CE_ACTIVITIY)).isEqualTo(1); underTest.execute(); List<Map<String, Object>> maps = selectAllWebhookDeliveries(); assertThat(maps).hasSize(1); assertThat(maps.get(0)).containsExactly( entry("ANALYSIS_UUID", analysisUuid), entry("UUID", webhookDeliveryUuid), entry("CE_TASK_UUID", ceTaskUuid)); }
Source:
public void configure(Binder binder) { JsonConfigProvider.bind(binder, "druid.discovery.curator", CuratorDiscoveryConfig.class); binder.bind(CuratorServiceAnnouncer.class).in(LazySingleton.class); DruidBinders.discoveryAnnouncementBinder(binder); binder.bind(ServiceAnnouncer.class) .to(Key.get(CuratorServiceAnnouncer.class, Names.named(NAME))) .in(LazySingleton.class); DruidDiscoveryModule.createBindingChoices(binder, CURATOR_KEY); PolyBind.optionBinder(binder, Key.get(DruidNodeDiscoveryProvider.class)) .addBinding(CURATOR_KEY) .to(CuratorDruidNodeDiscoveryProvider.class) .in(LazySingleton.class); PolyBind.optionBinder(binder, Key.get(DruidNodeAnnouncer.class)) .addBinding(CURATOR_KEY) .to(CuratorDruidNodeAnnouncer.class) .in(LazySingleton.class); }

Target:
public void configure(Binder binder) { JsonConfigProvider.bind(binder, "druid.discovery.curator", CuratorDiscoveryConfig.class); binder.bind(CuratorServiceAnnouncer.class).in(LazySingleton.class); DruidBinders.discoveryAnnouncementBinder(binder); binder.bind(ServiceAnnouncer.class) .to(Key.get(CuratorServiceAnnouncer.class, Names.named(NAME))) .in(LazySingleton.class); PolyBind.createChoiceWithDefault( binder, INTERNAL_DISCOVERY_PROP, Key.get(DruidNodeAnnouncer.class), CURATOR_KEY ); PolyBind.createChoiceWithDefault( binder, INTERNAL_DISCOVERY_PROP, Key.get(DruidNodeDiscoveryProvider.class), CURATOR_KEY ); PolyBind.optionBinder(binder, Key.get(DruidNodeDiscoveryProvider.class)) .addBinding(CURATOR_KEY) .to(CuratorDruidNodeDiscoveryProvider.class) .in(LazySingleton.class); PolyBind.optionBinder(binder, Key.get(DruidNodeAnnouncer.class)) .addBinding(CURATOR_KEY) .to(CuratorDruidNodeAnnouncer.class) .in(LazySingleton.class); }
Source:
@Override public WebElement findElement(SearchContext context) throws WebDriverException, IllegalArgumentException { Class<?> contextClass = context.getClass(); if (FindsByAndroidViewTag.class.isAssignableFrom(contextClass)) { return FindsByAndroidViewTag.class.cast(context) .findElementByAndroidViewTag(getLocatorString()); } if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) { return super.findElement(context); } throw formIllegalArgumentException(contextClass, FindsByAccessibilityId.class, FindsByFluentSelector.class); }

Target:
@Override public WebElement findElement(SearchContext context) throws WebDriverException, IllegalArgumentException { Class<?> contextClass = context.getClass(); if (FindsByAndroidViewTag.class.isAssignableFrom(contextClass)) { return FindsByAndroidViewTag.class.cast(context) .findElementByAndroidViewTag(getLocatorString()); } if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) { return super.findElement(context); } throw formIllegalArgumentException(contextClass, FindsByAndroidViewTag.class, FindsByFluentSelector.class); }
Source:
String locate(String name, CompilerInput referrer) { URI base = isRelativeIdentifier(name) ? createUri(referrer) : createUri(moduleRoot); return convertSourceUriToModuleAddress(base.resolve(createUri(name))); }

Target:
String locate(String name, CompilerInput referrer) { URI base = isRelativeIdentifier(name) ? createUri(referrer) : moduleRootURI; return convertSourceUriToModuleAddress(base.resolve(createUri(name))); }
Source:
public void historyNotification(OperationHistoryEvent event) { if (session != null && SessionStatus.DIRTY.equals(session.getStatus())) { if (marker == null) { marker = event.getOperation(); } } }

Target:
public void historyNotification(OperationHistoryEvent event) { if (session != null && SessionStatus.DIRTY == session.getStatus()) { if (marker == null) { marker = event.getOperation(); } } }
Source:
Mono<Response<KeyVaultKey>> createKeyWithResponse(CreateKeyOptions createKeyOptions, Context context) { Objects.requireNonNull(createKeyOptions, "The key create options parameter cannot be null."); context = context == null ? Context.NONE : context; KeyRequestParameters parameters = new KeyRequestParameters() .setKty(createKeyOptions.getKeyType()) .setKeyOps(createKeyOptions.getKeyOperations()) .setKeyAttributes(new KeyRequestAttributes(createKeyOptions)) .setKeyReleasePolicy(createKeyOptions.getKeyReleasePolicy()); return service.createKey(vaultUrl, createKeyOptions.getName(), apiVersion, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context.addData(AZ_TRACING_NAMESPACE_KEY, KEYVAULT_TRACING_NAMESPACE_VALUE)) .doOnRequest(ignored -> logger.info("Creating key - {}", createKeyOptions.getName())) .doOnSuccess(response -> logger.info("Created key - {}", response.getValue().getName())) .doOnError(error -> logger.warning("Failed to create key - {}", createKeyOptions.getName(), error)); }

Target:
Mono<Response<KeyVaultKey>> createKeyWithResponse(CreateKeyOptions createKeyOptions, Context context) { Objects.requireNonNull(createKeyOptions, "The key create options parameter cannot be null."); context = context == null ? Context.NONE : context; KeyRequestParameters parameters = new KeyRequestParameters() .setKty(createKeyOptions.getKeyType()) .setKeyOps(createKeyOptions.getKeyOperations()) .setKeyAttributes(new KeyRequestAttributes(createKeyOptions)) .setReleasePolicy(createKeyOptions.getReleasePolicy()); return service.createKey(vaultUrl, createKeyOptions.getName(), apiVersion, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context.addData(AZ_TRACING_NAMESPACE_KEY, KEYVAULT_TRACING_NAMESPACE_VALUE)) .doOnRequest(ignored -> logger.info("Creating key - {}", createKeyOptions.getName())) .doOnSuccess(response -> logger.info("Created key - {}", response.getValue().getName())) .doOnError(error -> logger.warning("Failed to create key - {}", createKeyOptions.getName(), error)); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; boolean persistentAuth = FiltersHelper.isPersistentAuth(req); HttpSession session = req.getSession(); if (persistentAuth) { try { int ttlValue = Integer.parseInt(req.getHeader("Session-TTL")) * SECONDS_IN_MINUTE; if (ttlValue >= MINIMAL_SESSION_TTL) { session.setMaxInactiveInterval(ttlValue); } session.setAttribute( SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY, req.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY ) ); } catch (NumberFormatException ex) { log.error("Session-TTL header was not passed. Not setting TTL value"); } } chain.doFilter(request, response); try { if (!persistentAuth && FiltersHelper.isAuthenticated(req)) { InitialContext ctx = new InitialContext(); try { FiltersHelper.getBackend(ctx).runAction( VdcActionType.LogoutBySession, new VdcActionParametersBase( (String) req.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY) ) ); req.getSession().invalidate(); } finally { ctx.close(); } } } catch (Exception ex) { log.error("Error in REST-API session management. ", ex); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; boolean persistentAuth = FiltersHelper.isPersistentAuth(req); if (persistentAuth) { HttpSession session = req.getSession(true); try { int ttlValue = Integer.parseInt(req.getHeader("Session-TTL")) * SECONDS_IN_MINUTE; if (ttlValue >= MINIMAL_SESSION_TTL) { session.setMaxInactiveInterval(ttlValue); } } catch (NumberFormatException ex) { log.error("Session-TTL header was not passed. Not setting TTL value"); } String engineSessionId = (String)req.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); if (engineSessionId != null) { session.setAttribute( SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY, engineSessionId ); } } chain.doFilter(request, response); try { if (!persistentAuth && FiltersHelper.isAuthenticated(req)) { InitialContext ctx = new InitialContext(); try { FiltersHelper.getBackend(ctx).runAction( VdcActionType.LogoutBySession, new VdcActionParametersBase( (String) req.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY) ) ); req.getSession().invalidate(); } finally { ctx.close(); } } else { HttpSession session = req.getSession(false); if (session != null && session.isNew() && session.getAttribute("async") != null && !Boolean.valueOf((boolean)session.getAttribute("async"))) { ((HttpServletResponse)response).addHeader(FiltersHelper.Constants.JSESSIONID_COOKIE, session.getId()); } } } catch (Exception ex) { log.error("Error in REST-API session management. ", ex); } }
Source:
void testSerialiseRepeatableGroupForm() throws IOException { Survey form1 = new Survey(); form1.setKey(KeyFactory.createKey("Survey", 17L)); form1.setName("This is a form"); form1.setVersion(12.0); QuestionGroup qg = new QuestionGroup(); qg.setKey(KeyFactory.createKey("Survey", 18L)); qg.setSurveyId(17L); qg.setName("This is a group"); qg.setOrder(1); qg.setRepeatable(true); TreeMap<Integer, QuestionGroup> gm = new TreeMap<>(); gm.put(1, qg); form1.setQuestionGroupMap(gm); TreeMap<Integer, Question> qm = new TreeMap<>(); qg.setQuestionMap(qm); int questionCount = qm.size(); SurveyGroup survey = new SurveyGroup(); survey.setCode("Name of containing survey"); survey.setKey(KeyFactory.createKey("SurveyGroup", 123L)); form1.setSurveyGroupId(survey.getKey().getId()); XmlForm form = new XmlForm(form1, survey); assertNotEquals(null, form); assertNotEquals(null, form.getQuestionGroup()); XmlQuestionGroup xqg = form.getQuestionGroup().get(0); assertNotEquals(null, xqg); assertNotEquals(null, xqg.getQuestion()); assertEquals(questionCount, xqg.getQuestion().size()); assertTrue(xqg.getRepeatable()); String xml = PublishedForm.generate(form); assertEquals(EXPECTED_REPEATABLE_XML, xml); SurveyDto dto = PublishedForm.parse(xml, true).toDto(); assertNotEquals(null, dto); assertEquals(17L, dto.getKeyId()); assertEquals("This is a form", dto.getName()); assertEquals("12.0", dto.getVersion()); assertEquals("This is a form", dto.getName()); }

Target:
void testSerialiseRepeatableGroupForm() throws IOException { Survey form1 = new Survey(); form1.setKey(KeyFactory.createKey("Survey", 17L)); form1.setName("This is a form"); form1.setVersion(12.0); QuestionGroup qg = new QuestionGroup(); qg.setKey(KeyFactory.createKey("QuestionGroup", 18L)); qg.setSurveyId(17L); qg.setName("This is a group"); qg.setOrder(1); qg.setRepeatable(true); TreeMap<Integer, QuestionGroup> gm = new TreeMap<>(); gm.put(1, qg); form1.setQuestionGroupMap(gm); TreeMap<Integer, Question> qm = new TreeMap<>(); qg.setQuestionMap(qm); int questionCount = qm.size(); SurveyGroup survey = new SurveyGroup(); survey.setCode("Name of containing survey"); survey.setKey(KeyFactory.createKey("SurveyGroup", 123L)); form1.setSurveyGroupId(survey.getKey().getId()); XmlForm form = new XmlForm(form1, survey); assertNotEquals(null, form); assertNotEquals(null, form.getQuestionGroup()); XmlQuestionGroup xqg = form.getQuestionGroup().get(0); assertNotEquals(null, xqg); assertNotEquals(null, xqg.getQuestion()); assertEquals(questionCount, xqg.getQuestion().size()); assertTrue(xqg.getRepeatable()); String xml = PublishedForm.generate(form); assertEquals(EXPECTED_REPEATABLE_XML, xml); SurveyDto dto = PublishedForm.parse(xml, true).toDto(); assertNotEquals(null, dto); assertEquals(17L, dto.getKeyId()); assertEquals("This is a form", dto.getName()); assertEquals("12.0", dto.getVersion()); assertEquals("This is a form", dto.getName()); }
Source:
public static boolean[] hexDigitToBinary(final char hexDigit) { switch (hexDigit) { case '0': return FFFF.clone(); case '1': return TFFF.clone(); case '2': return FTFF.clone(); case '3': return TTFF.clone(); case '4': return FFTF.clone(); case '5': return TFTF.clone(); case '6': return FTTF.clone(); case '7': return TTTF.clone(); case '8': return FFFT.clone(); case '9': return TFFT.clone(); case 'a':// fall through case 'A': return FTFT.clone(); case 'b':// fall through case 'B': return TTFT.clone(); case 'c':// fall through case 'C': return FFTT.clone(); case 'd':// fall through case 'D': return TFTT.clone(); case 'e':// fall through case 'E': return FTTT.clone(); case 'f':// fall through case 'F': return TTTT.clone(); default: throw IllegalArgumentExceptions.format("Cannot interpret '%s' as a hexadecimal digit", hexDigit); } }

Target:
public static boolean[] hexDigitToBinary(final char hexDigit) { switch (hexDigit) { case '0': return FFFF.clone(); case '1': return TFFF.clone(); case '2': return FTFF.clone(); case '3': return TTFF.clone(); case '4': return FFTF.clone(); case '5': return TFTF.clone(); case '6': return FTTF.clone(); case '7': return TTTF.clone(); case '8': return FFFT.clone(); case '9': return TFFT.clone(); case 'a':// fall through case 'A': return FTFT.clone(); case 'b':// fall through case 'B': return TTFT.clone(); case 'c':// fall through case 'C': return FFTT.clone(); case 'd':// fall through case 'D': return TFTT.clone(); case 'e':// fall through case 'E': return FTTT.clone(); case 'f':// fall through case 'F': return TTTT.clone(); default: throw IllegalArgumentExceptions.format("Cannot interpret '%d' as a hexadecimal digit", hexDigit); } }