auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void updateCustomizedStates(String instanceName, String customizedStateType, Map<String, CustomizedState> customizedStates, CustomizedStateOutput customizedStateOutput, Map<String, Resource> resourceMap) { for (CustomizedState customizedState : customizedStates.values()) { String resourceName = customizedState.getResourceName(); Resource resource = resourceMap.get(resourceName); if (resource == null) { continue; } Map<String, String> partitionStateMap = customizedState .getPartitionStateMap(CustomizedState.CustomizedStateProperty.CURRENT_STATE); for (String partitionName : partitionStateMap.keySet()) { Partition partition = resource.getPartition(partitionName); if (partition != null) { customizedStateOutput .setCustomizedState(customizedStateType, resourceName, partition, instanceName, customizedState.getState(partitionName)); customizedStateOutput .setStartTime(customizedStateType, resourceName, partition, instanceName, String.valueOf(customizedState.getStartTime(partitionName))); } } } }

Target:
private void updateCustomizedStates(String instanceName, String customizedStateType, Map<String, CustomizedState> customizedStates, CustomizedStateOutput customizedStateOutput, Map<String, Resource> resourceMap) { for (CustomizedState customizedState : customizedStates.values()) { String resourceName = customizedState.getResourceName(); Resource resource = resourceMap.get(resourceName); if (resource == null) { continue; } Map<String, String> partitionStateMap = customizedState .getPartitionStateMap(CustomizedState.CustomizedStateProperty.CURRENT_STATE); for (String partitionName : partitionStateMap.keySet()) { Partition partition = resource.getPartition(partitionName); if (partition != null) { customizedStateOutput .setCustomizedState(customizedStateType, resourceName, partition, instanceName, customizedState.getState(partitionName), customizedState.getStartTime(partitionName)); } } } }
Source:
static <E> TList<E> createList(E... elements) { if (elements == null || elements.length == 0) { return TCollections.emptyList(); } final TList<E> list = new TArrayList<>(); for (E element : elements) { list.add(requireNonNull(element, "element")); } return TCollections.unmodifiableList(list); }

Target:
static <E> TList<E> createList(E... elements) { if (elements.length == 0) { return TCollections.emptyList(); } for (E element : elements) { requireNonNull(element, "element"); } return new ImmutableArrayList<>(elements); }
Source:
public void should_not_loose_InnerClasses_attribute() throws Exception { final ClassWriter cw = new ClassWriter(0); final ClassReader cr = new ClassReader(Java9Support.downgradeIfRequired( TargetLoader.getClassDataAsBytes(Inner.class))); cr.accept(new ClassVisitor(InstrSupport.ASM_API_VERSION, cw) { @Override public void visitEnd() { final MethodVisitor mv = cv.visitMethod(0, "m", "()V", null, null); mv.visitCode(); addCauseOfResizeInstructions(mv); mv.visitMaxs(2, 1); mv.visitEnd(); super.visitEnd(); } }, 0); final byte[] bytes = instrumenter.instrument(cw.toByteArray(), ""); final TargetLoader targetLoader = new TargetLoader(); final Class outer = targetLoader.add(ResizeInstructionsTest.class, TargetLoader.getClassDataAsBytes(ResizeInstructionsTest.class)); final Class inner = targetLoader.add(Inner.class, bytes); assertNotSame(outer, inner.getEnclosingClass()); assertNull(inner.getEnclosingClass()); assertNotSame(outer, inner.getDeclaringClass()); assertNull(inner.getDeclaringClass()); }

Target:
public void should_not_loose_InnerClasses_attribute() throws Exception { final ClassWriter cw = new ClassWriter(0); final ClassReader cr = new ClassReader(Java9Support.downgradeIfRequired( TargetLoader.getClassDataAsBytes(Inner.class))); cr.accept(new ClassVisitor(InstrSupport.ASM_API_VERSION, cw) { @Override public void visitEnd() { final MethodVisitor mv = cv.visitMethod(0, "m", "()V", null, null); mv.visitCode(); addCauseOfResizeInstructions(mv); mv.visitMaxs(2, 1); mv.visitEnd(); super.visitEnd(); } }, 0); final byte[] bytes = instrumenter.instrument(cw.toByteArray(), ""); final TargetLoader targetLoader = new TargetLoader(); final Class<?> outer = targetLoader.add(ResizeInstructionsTest.class, TargetLoader.getClassDataAsBytes(ResizeInstructionsTest.class)); final Class<?> inner = targetLoader.add(Inner.class, bytes); assertNotSame(outer, inner.getEnclosingClass()); assertNull(inner.getEnclosingClass()); assertNotSame(outer, inner.getDeclaringClass()); assertNull(inner.getDeclaringClass()); }
Source:
private void restoreRoots(File buRoot, Set<File> unrestorable) { File[] children = buRoot.listFiles(); if (children == null) { unrestorable.add(buRoot); return; } for (File children1 : children) { String name = children1.getName(); String rName = name; String prefix = ""; while (rName.startsWith(ROOTCHAR)) { prefix += File.separator; rName = rName.substring(1); } if (prefix.length() < 1) { rName = rName + ":" + File.separator; } else rName = prefix + rName; File bu = new File(buRoot, name); File target = new File(rName); if (!bu.isDirectory()) { unrestorable.add(bu); continue; } if (!(target.exists() && target.isDirectory())) { unrestorable.add(bu); continue; } restore(target, bu, unrestorable); } restoreRenamedFiles(unrestorable); }

Target:
private void restoreRoots(File buRoot, Set<File> unrestorable) { File[] children = buRoot.listFiles(); if (children == null) { unrestorable.add(buRoot); return; } for (File child : children) { String name = child.getName(); String rName = name; String prefix = ""; while (rName.startsWith(ROOTCHAR)) { prefix += File.separator; rName = rName.substring(1); } if (prefix.length() < 1) { rName = rName + ":" + File.separator; } else rName = prefix + rName; File bu = new File(buRoot, name); File target = new File(rName); if (!bu.isDirectory()) { unrestorable.add(bu); continue; } if (!(target.exists() && target.isDirectory())) { unrestorable.add(bu); continue; } restore(target, bu, unrestorable); } restoreRenamedFiles(unrestorable); }
Source:
public void addUmiObservation(String observedUmi, String inferredUmi) { observedUmis.increment(observedUmi); inferredUmis.increment(inferredUmi); observedUmiBases += observedUmi.length(); totalObservedUmis++; }

Target:
public void addUmiObservation(String observedUmi, String inferredUmi) { observedUmis.increment(observedUmi); inferredUmis.increment(inferredUmi); observedUmiBases += observedUmi.length(); totalObservedUmisWithoutNs++; }
Source:
public void execute() { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow window = workbench .getActiveWorkbenchWindow(); if (window == null) { return; } IWorkbenchPage activePage = window.getActivePage(); if (activePage != null) { activePage.setPerspective(descriptor); } else { try { window.openPage(descriptor.getId(), ((Workbench) workbench) .getDefaultPageInput()); } catch (WorkbenchException e) { IStatus errorStatus = WorkbenchPlugin.newError(NLS.bind( WorkbenchMessages.Workbench_showPerspectiveError, descriptor.getLabel()), e); StatusManager.getManager().handle(errorStatus, StatusManager.SHOW); } } }

Target:
public void execute() { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow window = workbench .getActiveWorkbenchWindow(); Assert.isNotNull(window); IWorkbenchPage activePage = window.getActivePage(); if (activePage != null) { activePage.setPerspective(descriptor); } else { try { window.openPage(descriptor.getId(), ((Workbench) workbench) .getDefaultPageInput()); } catch (WorkbenchException e) { IStatus errorStatus = WorkbenchPlugin.newError(NLS.bind( WorkbenchMessages.Workbench_showPerspectiveError, descriptor.getLabel()), e); StatusManager.getManager().handle(errorStatus, StatusManager.SHOW); } } }
Source:
public String getTaskIdFromTaskUrl(String url) { if (url == null) { return null; } int index = url.indexOf(CHANGE_PREFIX_OLD); if (index > 0) { return url.substring(index + CHANGE_PREFIX_OLD.length()); } index = url.indexOf(CHANGE_PREFIX_NEW); if (index > 0) { Matcher matcher = CHANGE_ID_PATTERN.matcher(url.substring(index)); if (matcher.find()) { return matcher.group(1); } } return null; }

Target:
public String getTaskIdFromTaskUrl(String url) { if (url == null) { return null; } Matcher matcher = CHANGE_ID_PATTERN.matcher(url); if (matcher.find()) { return matcher.group(2); } return null; }
Source:
public Page buildDictionaryPage(int[] indices, PageBuilder sourcePageBuilder) { int[] outputChannels = new int[probeOutputChannels.size()]; for (int i = 0; i < outputChannels.length; i++) { outputChannels[i] = probeOutputChannels.get(i); } return internalBuildDictionaryPage(indices, outputChannels, sourcePageBuilder); }

Target:
public Page buildDictionaryPage(int[] indices, PageBuilder sourcePageBuilder) { return internalBuildDictionaryPage(indices, probeOutputChannels.stream().mapToInt(i -> i).toArray(), sourcePageBuilder); }
Source:
public InstrumentationContext<List<ValidationError>> beginValidation(InstrumentationValidationParameters parameters) { return whenCompleted((errors, throwable) -> { if ((errors != null && errors.size() > 0) || throwable != null) { return; } QueryTraversal queryTraversal = newQueryTraversal(parameters); int depth = queryTraversal.reducePreOrder((env, acc) -> Math.max(getPathLength(env.getParentEnvironment()), acc), 0); log.debug("Query depth: {}", depth); if (depth > maxDepth) { if (abortExecution) { throw mkAbortException(depth, maxDepth); } else { log.warn("Maximum query depth exceeded > {}", depth, maxDepth); } } }); }

Target:
public InstrumentationContext<List<ValidationError>> beginValidation(InstrumentationValidationParameters parameters) { return whenCompleted((errors, throwable) -> { if ((errors != null && errors.size() > 0) || throwable != null) { return; } QueryTraversal queryTraversal = newQueryTraversal(parameters); int depth = queryTraversal.reducePreOrder((env, acc) -> Math.max(getPathLength(env.getParentEnvironment()), acc), 0); log.debug("Query depth info: {}", depth); if (depth > maxDepth) { QueryDepthInfo queryDepthInfo = QueryDepthInfo.newQueryDepthInfo() .depth(depth) .build(); boolean throwAbortException = maxQueryDepthExceededFunction.apply(queryDepthInfo); if (throwAbortException) { throw mkAbortException(depth, maxDepth); } } }); }
Source:
public void handleMessageLog(TelemetryMessageLogDTO messageLog) { LOG.debug("Received telemetry messages", messageLog.getMessages().size()); for (TelemetryMessageDTO eachMessage : messageLog.getMessages()) { LOG.debug("Parse log message {}", eachMessage); final NetflowPackage flowPackage = new NetflowPackage(eachMessage.getBytes()); if (flowPackage.getVersion() != NetflowPackage.VERSION) { LOG.warn("Invalid Version. Expected {}, received {}. Skipping flow package.", NetflowPackage.VERSION, flowPackage.getVersion()); continue; } if (flowPackage.getHeader().getCount() == 0) { LOG.warn("Received Package has no content. Skipping flow package."); continue; } if (!flowPackage.isValid()) { LOG.warn("Received Package is not valid. Skipping flow package."); continue; } LOG.debug("FlowPackage received: {}", flowPackage); } }

Target:
public void handleMessageLog(TelemetryMessageLogDTO messageLog) { LOG.debug("Received telemetry messages", messageLog.getMessages().size()); for (TelemetryMessageDTO eachMessage : messageLog.getMessages()) { LOG.debug("Parse log message {}", eachMessage); try { final NetflowPacket flowPacket = new NetflowPacket(eachMessage.getBytes()); if (flowPacket.getVersion() != NetflowPacket.VERSION) { LOG.warn("Invalid Version. Expected {}, received {}. Skipping flow packet.", NetflowPacket.VERSION, flowPacket.getVersion()); continue; } if (flowPacket.getCount() == 0) { LOG.warn("Received packet has no content. Skipping flow packet."); continue; } if (!flowPacket.isValid()) { LOG.warn("Received packet is not valid. Skipping flow packet."); continue; } LOG.debug("Flow packet received: {}", flowPacket); } catch (Exception e) { LOG.error("Received packet cannot be read.", e); } } }
Source:
for (WeaponType type : WeaponType.values()) { ELF_ARSENAL.put(type, new ElfWeapon(type)); }

Target:
for (WeaponType type : WeaponType.values()) { ELFARSENAL.put(type, new ElfWeapon(type)); }
Source:
public Map<Class<?>, Object> build(KieServicesConfiguration configuration, ClassLoader classLoader) { final Map<Class<?>, Object> services = new HashMap<>(); services.put(TaskAssigningRuntimeClient.class, new TaskAssigningRuntimeClientImpl(configuration, classLoader)); return services; }

Target:
public Map<Class<?>, Object> build(KieServicesConfiguration configuration, ClassLoader classLoader) { return Collections.singletonMap(TaskAssigningRuntimeClient.class, new TaskAssigningRuntimeClientImpl(configuration, classLoader)); }
Source:
pathname -> pathname.isFile() && pathname.getName().startsWith(RESERVE_FILE_PREFIX); private static final FileFilter FILE_SIZE_DIR_FILTER = pathname -> pathname.isDirectory() && getFileSizeForDirName(pathname.getName()) != null; private final File reserveDir; private final long requiredSwapSegmentsPerSize; private final StorageManagerMetrics metrics; private ReserveFileMap reserveFiles; private PoolState poolState = PoolState.NOT_INVENTORIED; DiskSpaceAllocator(File reserveDir, long requiredSwapSegmentsPerSize, StorageManagerMetrics metrics) { this.reserveDir = reserveDir; this.requiredSwapSegmentsPerSize = requiredSwapSegmentsPerSize; this.metrics = metrics; try { if (reserveDir.isDirectory()) { reserveFiles = inventoryExistingReserveFiles(); poolState = PoolState.INVENTORIED; } } catch (Exception e) { logger.error("Could not inventory preexisting reserve directory", e); } }

Target:
pathname -> pathname.isFile() && pathname.getName().startsWith(RESERVE_FILE_PREFIX); private static final FileFilter FILE_SIZE_DIR_FILTER = pathname -> pathname.isDirectory() && getFileSizeForDirName(pathname.getName()) != null; private final boolean enablePooling; private final File reserveDir; private final long requiredSwapSegmentsPerSize; private final StorageManagerMetrics metrics; private final ReserveFileMap reserveFiles = new ReserveFileMap(); private PoolState poolState = PoolState.NOT_INVENTORIED; private Exception inventoryException = null; DiskSpaceAllocator(boolean enablePooling, File reserveDir, long requiredSwapSegmentsPerSize, StorageManagerMetrics metrics) { this.enablePooling = enablePooling; this.reserveDir = reserveDir; this.requiredSwapSegmentsPerSize = requiredSwapSegmentsPerSize; this.metrics = metrics; try { if (enablePooling) { prepareDirectory(reserveDir); inventoryExistingReserveFiles(); poolState = PoolState.INVENTORIED; } } catch (Exception e) { inventoryException = e; logger.error("Could not inventory preexisting reserve directory", e); } }
Source:
public Map getActivityChristmasInvestAmountAndCount(){ List<InvestModel> investModels = investMapper.countSuccessInvestByInvestTime(null, activityChristmasStartTime, activityChristmasEndTime); Map<String,Object> param = Maps.newConcurrentMap(); long amount = 0l; long count = 0l; Map<String,String> userMap = Maps.newConcurrentMap(); for(InvestModel investModel : investModels){ LoanDetailsModel loanDetailsModel = loanDetailsMapper.getByLoanId(investModel.getLoanId()); if(loanDetailsModel != null && loanDetailsModel.isActivity() && loanDetailsModel.getActivityDesc().equals("圣诞专享")){ amount += investModel.getAmount(); if(userMap.get(investModel.getLoginName()) == null){ userMap.put(investModel.getLoginName(),investModel.getLoginName()); count ++; } } } param.put("investAmount",amount); param.put("investCount",count); return param; }

Target:
public Map getActivityChristmasInvestAmountAndCount(){ List<InvestModel> investModels = investMapper.countSuccessInvestByInvestTime(null, activityChristmasStartTime, activityChristmasEndTime); Map<String,Object> param = Maps.newConcurrentMap(); long amount = 0l; Set userSet = new HashSet(); for(InvestModel investModel : investModels){ LoanDetailsModel loanDetailsModel = loanDetailsMapper.getByLoanId(investModel.getLoanId()); if(loanDetailsModel != null && loanDetailsModel.isActivity() && loanDetailsModel.getActivityDesc().equals("圣诞专享")){ amount += investModel.getAmount(); userSet.add(investModel.getLoginName()); } } param.put("investAmount",amount); param.put("investCount",userSet.size()); return param; }
Source:
public void testSnapshotDroplet() { int powerOffEvent = api.getDropletApi().powerOff(droplet.getId()); assertTrue(powerOffEvent > 0, "The event id should not be null"); waitForEvent(powerOffEvent); int event = api.getDropletApi().snapshot(droplet.getId(), "testsnapshot"); assertTrue(event > 0, "The event id should not be null"); waitForEvent(event); Optional<Image> snapshot = tryFind(api.getImageApi().list(), new Predicate<Image>() { @Override public boolean apply(Image input) { return input.getName().equals("testsnapshot"); } }); assertTrue(snapshot.isPresent(), "The created snapshot should exist in the image list"); api.getImageApi().delete(snapshot.get().getId()); }

Target:
public void testSnapshotDroplet() { int powerOffEvent = api.getDropletApi().powerOff(droplet.getId()); assertTrue(powerOffEvent > 0, "The event id should be > 0"); waitForEvent(powerOffEvent); int event = api.getDropletApi().snapshot(droplet.getId(), "testsnapshot"); assertTrue(event > 0, "The event id should be > 0"); waitForEvent(event); Optional<Image> snapshot = tryFind(api.getImageApi().list(), new Predicate<Image>() { @Override public boolean apply(Image input) { return input.getName().equals("testsnapshot"); } }); assertTrue(snapshot.isPresent(), "The created snapshot should exist in the image list"); this.snapshot = snapshot.get(); }
Source:
public boolean commitRequired() { return !dirtyChunks.isEmpty() || !positions.isEmpty(); }

Target:
public boolean commitRequired() { return enabled || postEditSimulation; }
Source:
protected boolean isUserAuthorizedToRunAction() { log.debug("IsUserAutorizedToRunAction: login on behalf - no permission check"); return true; }

Target:
protected boolean isUserAuthorizedToRunAction() { log.debug("isUserAuthorizedToRunAction: login on behalf - no permission check"); return true; }
Source:
public boolean onKeyPreIme(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && isSheetShowing()) { if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { KeyEvent.DispatcherState state = getKeyDispatcherState(); if (state != null) { state.startTracking(event, this); } return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { KeyEvent.DispatcherState state = getKeyDispatcherState(); if (state != null) { state.handleUpEvent(event); } if (event.isTracking() && !event.isCanceled()) { if (isSheetShowing()) { if (getState() == BottomSheetLayout.State.EXPANDED) { peekSheet(); } else { dismissSheet(); } } return true; } } } return super.onKeyPreIme(keyCode, event); }

Target:
public boolean onKeyPreIme(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && isSheetShowing()) { if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { KeyEvent.DispatcherState state = getKeyDispatcherState(); if (state != null) { state.startTracking(event, this); } return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { KeyEvent.DispatcherState dispatcherState = getKeyDispatcherState(); if (dispatcherState != null) { dispatcherState.handleUpEvent(event); } if (isSheetShowing() && event.isTracking() && !event.isCanceled()) { if (state == State.EXPANDED && dismissMode == State.PEEKED) { peekSheet(); } else { dismissSheet(); } return true; } } } return super.onKeyPreIme(keyCode, event); }
Source:
private boolean checkCurrentNetworkAsCaptivePortal() { String captivePortalURL = "<LINK_0>"; CommCareNetworkService commCareNetworkService = CommCareNetworkServiceGenerator.createNoAuthCommCareNetworkService(); try { Response<ResponseBody> response = commCareNetworkService.makeGetRequest(captivePortalURL, new HashMap<>(), new HashMap<>()).execute(); Logger.log(LogTypes.TYPE_WARNING_NETWORK, "Detecting captive portal, Response Code: " + response.code() + " and Response Body: " + response.body()); return response.code() == 200 && !"success".equals(response.body().string()); } catch (IOException e) { Logger.log(LogTypes.TYPE_WARNING_NETWORK, "Detecting captive portal failed with exception" + e.getMessage()); return false; } }

Target:
private boolean checkCurrentNetworkAsCaptivePortal() { String captivePortalURL = "<LINK_0>"; CommCareNetworkService commCareNetworkService = CommCareNetworkServiceGenerator.createNoAuthCommCareNetworkService(); try { Response<ResponseBody> response = commCareNetworkService.makeGetRequest(captivePortalURL, new HashMap<>(), new HashMap<>()).execute(); return response.code() == 200 && !"success".equals(response.body().string()); } catch (IOException e) { Logger.log(LogTypes.TYPE_WARNING_NETWORK, "Detecting captive portal failed with exception" + e.getMessage()); return false; } }
Source:
public LRUCache(int cacheSize) { this.cacheSize = cacheSize; }

Target:
LRUCache(int cacheSize) { super(cacheSize/4); this.cacheSize = cacheSize; }
Source:
public DFUFileDetailInfo getFileDetails(String logicalname, String clustername) throws Exception { try { DFUInfoResponse resp = this.getFileInfo(logicalname, clustername); if (resp == null) { throw new FileNotFoundException(logicalname + " does not exist"); } this.handleException(resp.getExceptions()); DFUFileDetailInfo info = new DFUFileDetailInfo(resp.getFileDetail()); try { info.setFirstline(this.getFirstRow(logicalname, clustername)); } catch (Exception e) { info.setFirstline(""); } if (info.getFilename() != null) { try { info.setColumns(getFileMetaData(logicalname, clustername)); } catch (ArrayOfEspException e) { if (e.getException().length > 0 && e.getException(0).getMessage() != null && e.getException(0).getMessage().contains("not available in service WsDfu")) { info.setColumns(this.getFileDataColumns(logicalname, clustername)); } } } if ((info.getEcl() == null || info.getEcl().isEmpty()) && info.getIsSuperfile() && info.getSubfiles() != null && info.getSubfiles().length != 0) { DFUFileDetailInfo subfile = this.getFileDetails(info.getSubfiles()[0], info.getCluster()); if (subfile != null) { info.setEcl(subfile.getEcl()); } } return info; } catch (ArrayOfEspException e) { if (e != null) { for (EspException espexception : e.getException()) { Utils.println(System.out, "Error retrieving file type for file" + logicalname + ": " + espexception.getSource() + espexception.getMessage(), false, true); } } throw e; } }

Target:
public DFUFileDetailInfo getFileDetails(String logicalname, String clustername) throws Exception { try { DFUInfoResponse resp = this.getFileInfo(logicalname, clustername); if (resp == null) { throw new FileNotFoundException(logicalname + " does not exist"); } this.handleException(resp.getExceptions()); DFUFileDetailInfo info = new DFUFileDetailInfo(resp.getFileDetail()); try { info.setFirstline(this.getFirstRow(logicalname, clustername)); } catch (Exception e) { info.setFirstline(""); } if (info.getFilename() != null) { try { info.setColumns(getFileMetaData(logicalname, clustername)); } catch (ArrayOfEspException e) { if (e.getException().length > 0 && e.getException(0).getMessage() != null && e.getException(0).getMessage().contains("not available in service WsDfu")) { info.setColumns(this.getFileDataColumns(logicalname, clustername)); } } } if ((info.getEcl() == null || info.getEcl().isEmpty()) && info.getIsSuperfile() && info.getSubfiles() != null && info.getSubfiles().length != 0) { DFUFileDetailInfo subfile = this.getFileDetails(info.getSubfiles()[0], info.getCluster()); if (subfile != null) { info.setEcl(subfile.getEcl()); info.setColumns(subfile.getColumns()); info.setContentType(subfile.getContentType()); info.setFormat(subfile.getFormat()); } } return info; } catch (ArrayOfEspException e) { if (e != null) { for (EspException espexception : e.getException()) { Utils.println(System.out, "Error retrieving file type for file" + logicalname + ": " + espexception.getSource() + espexception.getMessage(), false, true); } } throw e; } }
Source:
public Tag tagCreate(TagCreateRequest request) throws ApiException { GitConnection gitConnection = getGitConnection(); try { TagCreateParams params = TagCreateParams.create(request.getName()) .withCommit(request.getCommit()) .withMessage(request.getMessage()) .withForce(request.isForce()); return gitConnection.tagCreate(params); } finally { gitConnection.close(); } }

Target:
public Tag tagCreate(TagCreateRequest request) throws ApiException { GitConnection gitConnection = getGitConnection(); try { return gitConnection.tagCreate(TagCreateParams.create(request.getName()) .withCommit(request.getCommit()) .withMessage(request.getMessage()) .withForce(request.isForce())); } finally { gitConnection.close(); } }
Source:
private void updateForwardedStatsFromNetd() { final TetherStatsParcel[] tetherStatsList; try { tetherStatsList = mNetd.tetherOffloadGetStats(); } catch (RemoteException | ServiceSpecificException e) { throw new IllegalStateException("problem parsing tethering stats: ", e); } for (TetherStatsParcel tetherStats : tetherStatsList) { try { final Integer ifIndex = tetherStats.ifIndex; final ForwardedStats curr = new ForwardedStats(tetherStats); final ForwardedStats base = mOffloadTetherStats.get(ifIndex); final ForwardedStats diff = (base != null) ? curr.subtract(base) : curr; mOffloadTetherStats.put(ifIndex, curr); accumulateDiffToStatsProvider(ifIndex, diff); } catch (ArrayIndexOutOfBoundsException e) { throw new IllegalStateException("invalid tethering stats " + e); } } }

Target:
private void updateForwardedStatsFromNetd() { final TetherStatsParcel[] tetherStatsList; try { tetherStatsList = mNetd.tetherOffloadGetStats(); } catch (RemoteException | ServiceSpecificException e) { throw new IllegalStateException("problem parsing tethering stats: ", e); } for (TetherStatsParcel tetherStats : tetherStatsList) { try { final Integer ifIndex = tetherStats.ifIndex; final ForwardedStats curr = new ForwardedStats(tetherStats); final ForwardedStats base = mOffloadTetherStats.get(ifIndex); final ForwardedStats diff = (base != null) ? curr.subtract(base) : curr; mOffloadTetherStats.put(ifIndex, curr); if (mStatsProvider != null) { mStatsProvider.accumulateDiff( buildNetworkStats(StatsType.STATS_PER_IFACE, ifIndex, diff), buildNetworkStats(StatsType.STATS_PER_UID, ifIndex, diff)); } } catch (ArrayIndexOutOfBoundsException e) { throw new IllegalStateException("invalid tethering stats " + e); } } }
Source:
public String toString() { return "TaskResultData{" + "id=" + id + ", serializedValue=" + Arrays.toString(serializedValue) + '}'; }

Target:
public String toString() { return "TaskResultData{" + "id=" + id + ", serializedValue=" + Arrays.toString(serializedValue) + ", metadata=" + metadata + '}'; }
Source:
public static void setup() { raising.setFalseWhen(BooleanMixing.onPress(topLimitSwitch)); lowering.setFalseWhen(BooleanMixing.onPress(bottomLimitSwitch)); raising.toggleWhen(raisingInput); raising.setFalseWhen(loweringInput); lowering.toggleWhen(loweringInput); lowering.setFalseWhen(raisingInput); FloatMixing.pumpWhen(QuasarHelios.globalControl, Mixing.quadSelect(raising, lowering, 0.0f, -1.0f, 1.0f, 0.0f), winch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Motor Speed", winch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Top", topLimitSwitch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Bottom", bottomLimitSwitch); }

Target:
public static void setup() { raising.setFalseWhen(EventMixing.filterEvent(topLimitSwitch, true, Igneous.globalPeriodic)); lowering.setFalseWhen(EventMixing.filterEvent(bottomLimitSwitch, true, Igneous.globalPeriodic)); raising.toggleWhen(raisingInput); raising.setFalseWhen(loweringInput); lowering.toggleWhen(loweringInput); lowering.setFalseWhen(raisingInput); FloatMixing.pumpWhen(QuasarHelios.globalControl, Mixing.quadSelect(raising, lowering, 0.0f, -1.0f, 1.0f, 0.0f), winch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Motor Speed", winch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Top", topLimitSwitch); Cluck.publish(QuasarHelios.testPrefix + "Elevator Limit Bottom", bottomLimitSwitch); }
Source:
public List<User> call(ApiCaller ac, Deserializer parms) throws PerunException { return ac.getSecurityTeamsManager().getDirectAdmins(ac.getSession(), ac.getSecurityTeamById(parms.readInt("securityTeam"))); }

Target:
public List<SecurityTeam> call(ApiCaller ac, Deserializer parms) throws PerunException { return ac.getSecurityTeamsManager().getSecurityTeams(ac.getSession()); }
Source:
private CompletionStage<RestResponse> serveStaticResource(RestRequest request, String resource) throws ServerInternalException { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); try { URL staticResource = SplashResource.class.getClassLoader().getResource(resource); return CompletableFuture.completedFuture(responseBuilder.entity(loadFile(staticResource)) .contentType(getMediaType(resource)) .status(HttpResponseStatus.OK) .build()); } catch (Exception e) { throw new ServerInternalException(e); } }

Target:
private CompletionStage<RestResponse> serveStaticResource(RestRequest request, String resource) throws ServerInternalException { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); try { URL staticResource = SplashResource.class.getClassLoader().getResource(resource); NettyRestResponse response = responseBuilder.entity(loadFile(staticResource)) .contentType(getMediaType(resource)) .status(HttpResponseStatus.OK) .build(); return CompletableFuture.completedFuture(response); } catch (Exception e) { throw new ServerInternalException(e); } }
Source:
void write(final Collection<SinkRecord> records) throws SQLException { final Connection connection = cachedConnectionProvider.getConnection(); final Map<TableId, BufferedRecords> bufferByTable = new HashMap<>(); for (SinkRecord record : records) { final TableId tableId = destinationTable(record.topic()); BufferedRecords buffer = bufferByTable.get(tableId); if (buffer == null) { buffer = new BufferedRecords(config, tableId, dbDialect, dbStructure, connection); bufferByTable.put(tableId, buffer); } buffer.add(record); } for (TableId tableId : bufferByTable.keySet()) { BufferedRecords buffer = bufferByTable.get(tableId); log.debug("Flushing records in JDBC Writer for table ID: {}", tableId); buffer.flush(); buffer.close(); } connection.commit(); }

Target:
void write(final Collection<SinkRecord> records) throws SQLException { final Connection connection = cachedConnectionProvider.getConnection(); final Map<TableId, BufferedRecords> bufferByTable = new HashMap<>(); for (SinkRecord record : records) { final TableId tableId = destinationTable(record.topic()); BufferedRecords buffer = bufferByTable.get(tableId); if (buffer == null) { buffer = new BufferedRecords(config, tableId, dbDialect, dbStructure, connection); bufferByTable.put(tableId, buffer); } buffer.add(record); } for (Map.Entry<TableId, BufferedRecords> entry : bufferByTable.entrySet()) { TableId tableId = entry.getKey(); BufferedRecords buffer = entry.getValue(); log.debug("Flushing records in JDBC Writer for table ID: {}", tableId); buffer.flush(); buffer.close(); } connection.commit(); }
Source:
private AsyncCallback.ChildrenCallback constructChildRetrievalCallback() { if (shutdown || m_drainedSources.get() == m_numSources) { return null; } return new AsyncCallback.ChildrenCallback() { @Override public void processResult(final int rc, final String path, Object ctx, final List<String> children) { m_childUpdatingThread.submit(new Runnable() { @Override public void run() { try { if (shutdown) return; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.NONODE) { exportLog.info("Path not found generation drain most likely finished on other node: " + path); } else if (code != KeeperException.Code.OK) { throw KeeperException.create(code); } final String split[] = path.split("/"); final int partition = Integer.valueOf(split[split.length - 1]); ImmutableList.Builder<Long> mailboxes = ImmutableList.builder(); for (String child : children) { if (child.equals(Long.toString(m_mbox.getHSId()))) continue; mailboxes.add(Long.valueOf(child)); } ImmutableList<Long> mailboxHsids = mailboxes.build(); for( ExportDataSource eds: m_dataSourcesByPartition.get( partition).values()) { eds.updateAckMailboxes(Pair.of(m_mbox, mailboxHsids)); } } catch (Throwable t) { VoltDB.crashLocalVoltDB("Error in export ack handling", true, t); } } }); } }; }

Target:
private AsyncCallback.ChildrenCallback constructChildRetrievalCallback() { if (shutdown || m_drainedSources.get() == m_numSources) { return null; } return new AsyncCallback.ChildrenCallback() { @Override public void processResult(final int rc, final String path, Object ctx, final List<String> children) { m_childUpdatingThread.submit(new Runnable() { @Override public void run() { try { if (shutdown) return; KeeperException.Code code = KeeperException.Code.get(rc); if (code == KeeperException.Code.NONODE) { if (exportLog.isDebugEnabled()) { exportLog.debug("Path not found generation drain most likely finished on other node: " + path); } } else if (code != KeeperException.Code.OK) { throw KeeperException.create(code); } final String split[] = path.split("/"); final int partition = Integer.valueOf(split[split.length - 1]); ImmutableList.Builder<Long> mailboxes = ImmutableList.builder(); for (String child : children) { if (child.equals(Long.toString(m_mbox.getHSId()))) continue; mailboxes.add(Long.valueOf(child)); } ImmutableList<Long> mailboxHsids = mailboxes.build(); for( ExportDataSource eds: m_dataSourcesByPartition.get( partition).values()) { eds.updateAckMailboxes(Pair.of(m_mbox, mailboxHsids)); } } catch (Throwable t) { VoltDB.crashLocalVoltDB("Error in export ack handling", true, t); } } }); } }; }
Source:
public void setup(TestContext testContext) throws Exception { this.testContext = testContext; targetInstance = testContext.getTargetInstance(); keyCounter = targetInstance.getAtomicLong("keyCounter"); MapConfig mapConfig = targetInstance.getConfig().getMapConfig(basename); maxMapSize = mapConfig.getMaxSizeConfig().getSize(); MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig(); mapStoreConfig.setWriteCoalescing(true); }

Target:
public void setup(TestContext testContext) throws Exception { this.testContext = testContext; targetInstance = testContext.getTargetInstance(); keyCounter = targetInstance.getAtomicLong("MapEvictAndStoreTest.keyCounter"); MapConfig mapConfig = targetInstance.getConfig().getMapConfig(basename); mapConfig.setTimeToLiveSeconds(timeToLiveSeconds); mapConfig.getMaxSizeConfig() .setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.PER_NODE) .setSize(maxMapSize); MapStoreConfig mapStoreConfig = new MapStoreConfig(); mapStoreConfig.setEnabled(true) .setClassName(MAPSTORECLASS) .setWriteDelaySeconds(writeDelaySeconds); mapConfig.setMapStoreConfig(mapStoreConfig); mapStoreConfig.setWriteCoalescing(true); }
Source:
public void testJMSMessagesFromOozieForNonFalconWF() throws Exception { sendMessages(TOPIC_NAME, WorkflowExecutionContext.Type.WORKFLOW_JOB, false ); final BrokerView adminView = broker.getAdminView(); Assert.assertEquals(adminView.getTotalDequeueCount(), 0); Assert.assertEquals(adminView.getTotalEnqueueCount(), 10); Assert.assertEquals(adminView.getTotalConsumerCount(), 2); Assert.assertEquals(adminView.getTotalMessageCount(), 0); Thread.sleep(100); Mockito.verify(jobEndService, Mockito.never()).notifyStart(Mockito.any(WorkflowExecutionContext.class)); Mockito.verify(jobEndService, Mockito.never()).notifySuccess(Mockito.any(WorkflowExecutionContext.class)); Mockito.verify(jobEndService, Mockito.never()).notifySuspend(Mockito.any(WorkflowExecutionContext.class)); Mockito.verify(jobEndService, Mockito.never()).notifyWait(Mockito.any(WorkflowExecutionContext.class)); Mockito.verify(jobEndService, Mockito.never()).notifyFailure(Mockito.any(WorkflowExecutionContext.class)); }

Target:
public void testJMSMessagesFromOozieForNonFalconWF() throws Exception { sendMessages(TOPIC_NAME, WorkflowExecutionContext.Type.WORKFLOW_JOB, false ); final BrokerView adminView = broker.getAdminView(); Assert.assertEquals(adminView.getTotalConsumerCount(), 2); Thread.sleep(100); Mockito.verify(jobEndService, Mockito.never()).notifyStart(Mockito.any(WorkflowExecutionContext.class)); Mockito.verify(jobEndService, Mockito.never()).notifySuccess(Mockito.any(WorkflowExecutionContext.class)); Mockito.verify(jobEndService, Mockito.never()).notifySuspend(Mockito.any(WorkflowExecutionContext.class)); Mockito.verify(jobEndService, Mockito.never()).notifyWait(Mockito.any(WorkflowExecutionContext.class)); Mockito.verify(jobEndService, Mockito.never()).notifyFailure(Mockito.any(WorkflowExecutionContext.class)); }
Source:
public void testReadPDBFile() throws Exception { assertEquals("pdb code not set!","5PTI",structure.getPDBCode()); Chain c = structure.getChain(0); assertEquals("did not find the expected 58 amino acids!",58,c.getAtomGroups(GroupType.AMINOACID).size()); assertEquals(0 , c.getAtomGroups(GroupType.HETATM).size()); Chain c2 = structure.getChain(1); assertEquals(64, c2.getAtomGroups(GroupType.HETATM).size()); assertEquals(0, c2.getAtomGroups(GroupType.NUCLEOTIDE).size()); List<EntityInfo> compounds= structure.getEntityInformation(); assertEquals(2, compounds.size()); EntityInfo mol = compounds.get(0); assertTrue(mol.getDescription().startsWith("TRYPSIN INHIBITOR")); }

Target:
public void testReadPDBFile() throws Exception { assertEquals("pdb code not set!","5PTI",structure.getPDBCode()); Chain c = structure.getChain(0); assertEquals("did not find the expected 58 amino acids!",58,c.getAtomGroups(GroupType.AMINOACID).size()); assertEquals(0 , c.getAtomGroups(GroupType.HETATM).size()); Chain c2 = structure.getChain(1); assertEquals(64, c2.getAtomGroups(GroupType.HETATM).size()); assertEquals(0, c2.getAtomGroups(GroupType.NUCLEOTIDE).size()); List<EntityInfo> compounds= structure.getEntityInfos(); assertEquals(2, compounds.size()); EntityInfo mol = compounds.get(0); assertTrue(mol.getDescription().startsWith("TRYPSIN INHIBITOR")); }
Source:
private PoolingHttpClientConnectionManager getConnectionManager(Builder builder) { return new PoolingHttpClientConnectionManager(getSchemeRegistry(builder)); }

Target:
private PoolingHttpClientConnectionManager getConnectionManager(Builder builder) { final PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(getSchemeRegistry(builder)); cm.setMaxTotal(builder.connectionPoolSize); cm.setDefaultMaxPerRoute(cm.getMaxTotal()); return cm; }
Source:
public final MesosSchedulerClient<Send, Receive> build() { return new MesosSchedulerClient<>( mesosUri, checkNotNull(applicationUserAgentEntry), checkNotNull(sendCodec), checkNotNull(receiveCodec), checkNotNull(subscribe), checkNotNull(streamProcessor) ); }

Target:
public final MesosSchedulerClient<Send, Receive> build() { return new MesosSchedulerClient<>( checkNotNull(mesosUri), checkNotNull(applicationUserAgentEntry), checkNotNull(sendCodec), checkNotNull(receiveCodec), checkNotNull(subscribe), checkNotNull(streamProcessor) ); }
Source:
public IEventDeclaration getEventType(long streamId, long id) { return getEvents(streamId).get((int) id); }

Target:
public IEventDeclaration getEventType(long streamId, long id) { return getEventDeclarations(streamId).get((int) id); }
Source:
private String[] getPathArray(String field) { if (field.equals(fPathAsString)) { return fPathAsArray; } StringBuilder sb = new StringBuilder(); List<String> list = new ArrayList<>(); for (int i = 1; i < field.length(); i++) { char charAt = field.charAt(i); if (charAt == SLASH) { list.add(sb.toString()); sb = new StringBuilder(); } else if (charAt == BACKSLASH) { if (i != field.length() - 1) { char nextChar = field.charAt(++i); if (nextChar == SLASH) { sb.append(SLASH); } else { sb.append(BACKSLASH); i--; } } else { sb.append(BACKSLASH); } } else { sb.append(charAt); } } list.add(sb.toString()); String[] array = new String[list.size()]; list.toArray(array); fPathAsString = field; fPathAsArray = array; return array; }

Target:
private String[] getPathArray(String field) { if (field.equals(fPathAsString)) { return fPathAsArray; } StringBuilder sb = new StringBuilder(); List<String> list = new ArrayList<>(); for (int i = 1; i < field.length(); i++) { char charAt = field.charAt(i); if (charAt == SLASH) { list.add(sb.toString()); sb = new StringBuilder(); } else if (charAt == BACKSLASH && i < field.length() - 1 && field.charAt(i + 1) == SLASH) { sb.append(SLASH); i++; } else { sb.append(charAt); } } list.add(sb.toString()); String[] array = new String[list.size()]; list.toArray(array); fPathAsArray = array; fPathAsString = field; return array; }
Source:
public ComplexMetricExtractor getExtractor() { return new ComplexMetricExtractor() { @Override public Class<?> extractedClass() { return Object.class; } @Override public Object extractValue(final InputRow inputRow, final String metricName) { return inputRow.getRaw(metricName); } }; }

Target:
public ComplexMetricExtractor getExtractor() { return RawInputValueExtractor.getInstance(); }
Source:
public static ZipOutputStream pack(Path sourcePath, Path destPath) throws IOException { if (Files.exists(destPath)) { Files.delete(destPath); } Files.createFile(destPath); ZipOutputStream zipOutputStream = new ZipOutputStream(Files.newOutputStream(destPath)); try { Files.walk(sourcePath) .filter(path -> !Files.isDirectory(path)) .forEach(path -> { ZipEntry zipEntry = new ZipEntry(sourcePath.relativize(path).toString()); try { zipOutputStream.putNextEntry(zipEntry); Files.copy(path, zipOutputStream); zipOutputStream.closeEntry(); } catch (IOException e) { System.err.println(e); } }); } catch (IOException e){ throw new IOException(); } return zipOutputStream; }

Target:
public static void pack(Path sourcePath, Path destPath) { Compress.zip(sourcePath,destPath); }
Source:
private ValidatingSchemaQuery(Timer timer, StressSettings settings, PartitionGenerator generator, SeedManager seedManager, ValidatingStatement[] statements, ConsistencyLevel cl, ConsistencyLevel serialCl, int clusteringComponents) { super(timer, settings, new DataSpec(generator, seedManager, new DistributionFixed(1), settings.insert.rowPopulationRatio.get(), 1)); this.statements = statements; this.cl = cl; argumentIndex = new int[statements[0].statement.getVariables().size()]; bindBuffer = new Object[argumentIndex.length]; int i = 0; for (ColumnDefinitions.Definition definition : statements[0].statement.getVariables()) argumentIndex[i++] = spec.partitionGenerator.indexOf(definition.getName()); com.datastax.driver.core.ConsistencyLevel tmpCl = JavaDriverClient.from(cl); com.datastax.driver.core.ConsistencyLevel tmpSerialCl = JavaDriverClient.from(serialCl); for (ValidatingStatement statement : statements) { if(statement.statement.getConsistencyLevel() == null) statement.statement.setConsistencyLevel(tmpCl); if(statement.statement.getSerialConsistencyLevel() == null) statement.statement.setSerialConsistencyLevel(tmpSerialCl); } this.clusteringComponents = clusteringComponents; }

Target:
private ValidatingSchemaQuery(Timer timer, StressSettings settings, PartitionGenerator generator, SeedManager seedManager, ValidatingStatement[] statements, ConsistencyLevel cl, ConsistencyLevel serialCl, int clusteringComponents) { super(timer, settings, new DataSpec(generator, seedManager, new DistributionFixed(1), settings.insert.rowPopulationRatio.get(), 1)); this.statements = statements; this.cl = cl; argumentIndex = new int[statements[0].statement.getVariables().size()]; bindBuffer = new Object[argumentIndex.length]; int i = 0; for (ColumnDefinitions.Definition definition : statements[0].statement.getVariables()) argumentIndex[i++] = spec.partitionGenerator.indexOf(definition.getName()); com.datastax.driver.core.ConsistencyLevel consistencyLevel = JavaDriverClient.from(cl); com.datastax.driver.core.ConsistencyLevel serialConsistencyLevel = JavaDriverClient.from(serialCl); for (ValidatingStatement statement : statements) { if (statement.statement.getConsistencyLevel() == null) statement.statement.setConsistencyLevel(consistencyLevel); if (statement.statement.getSerialConsistencyLevel() == null) statement.statement.setSerialConsistencyLevel(serialConsistencyLevel); } this.clusteringComponents = clusteringComponents; }
Source:
private static void validateFormSelectionMarkData(List<SelectionMark> expectedMarks, List<FormSelectionMark> actualMarks, int pageNumber) { for (int i = 0; i < actualMarks.size(); i++) { final SelectionMark expectedMark = expectedMarks.get(i); final FormSelectionMark actualMark = actualMarks.get(i); assertTrue(expectedMark.getState().toString().equalsIgnoreCase(actualMark.getState().toString())); validateBoundingBoxData(expectedMark.getBoundingBox(), actualMark.getBoundingBox()); assertNull(actualMark.getText()); assertEquals(pageNumber, actualMark.getPageNumber()); } }

Target:
private static void validateFormSelectionMarkData(List<SelectionMark> expectedMarks, List<FormSelectionMark> actualMarks, int pageNumber) { for (int i = 0; i < actualMarks.size(); i++) { final SelectionMark expectedMark = expectedMarks.get(i); final FormSelectionMark actualMark = actualMarks.get(i); assertEquals(expectedMark.getState().toString(), actualMark.getState().toString()); validateBoundingBoxData(expectedMark.getBoundingBox(), actualMark.getBoundingBox()); assertNull(actualMark.getText()); assertEquals(pageNumber, actualMark.getPageNumber()); } }
Source:
private void writeMapToJSON(String jsonMapName, LinkedHashMap<String, Object> data, MaxwellOutputConfig outputConfig) throws IOException { JsonGenerator generator = jsonGeneratorThreadLocal.get(); if(outputConfig.encryptData && !outputConfig.encryptAll){ ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); JsonGenerator obj = jsonFactory.createGenerator(outputStream); obj.writeStartObject(); for (String key : data.keySet()) { Object value = data.get(key); if (value == null && !outputConfig.includesNulls) continue; if ( value instanceof List ) { List stringList = (List) value; obj.writeArrayFieldStart(key); for ( Object s : stringList ) { obj.writeObject(s); } obj.writeEndArray(); } else if (value instanceof RawJSONString) { obj.writeFieldName(key); obj.writeRawValue(((RawJSONString) value).json); } else { obj.writeObjectField(key, value); } } obj.writeEndObject(); obj.close(); outputStream.close(); generator.writeStringField(jsonMapName, RowEncrypt.encrypt(outputStream.toString(), outputConfig.encryption_key, outputConfig.secret_key)); } else { generator.writeObjectFieldStart(jsonMapName); for (String key : data.keySet()) { Object value = data.get(key); if (value == null && !outputConfig.includesNulls) continue; if (value instanceof List) { List stringList = (List) value; generator.writeArrayFieldStart(key); for (Object s : stringList) { generator.writeObject(s); } generator.writeEndArray(); } else if (value instanceof RawJSONString) { generator.writeFieldName(key); generator.writeRawValue(((RawJSONString) value).json); } else { generator.writeObjectField(key, value); } } generator.writeEndObject(); } }

Target:
private void writeMapToJSON(String jsonMapName, LinkedHashMap<String, Object> data, MaxwellOutputConfig outputConfig) throws IOException, NoSuchAlgorithmException { DataJsonGenerator dataGenerator = dataJsonGenerator(outputConfig); if(jsonMapName != "old") { dataGenerator.set(outputConfig.secret_key); } dataGenerator.begin(jsonMapName, byteArrayThreadLocal.get()); for (String key : data.keySet()) { Object value = data.get(key); if (value == null && !outputConfig.includesNulls) continue; if (value instanceof List) { List stringList = (List) value; dataGenerator.writeArrayFieldStart(key); for (Object s : stringList) { dataGenerator.writeObject(s); } dataGenerator.writeEndArray(); } else if (value instanceof RawJSONString) { dataGenerator.writeFieldName(key); dataGenerator.writeRawValue(((RawJSONString) value).json); } else { dataGenerator.writeObjectField(key, value); } } dataGenerator.end(); }